Understanding a WordPress Plugin

<?php
/*
Plugin Name: Yet Another Search Meddle
Plugin URI:
Version: 0.1
Author: Jeffrin Jose T and Public Domain
Author URI: http://linkedin.com/in/jeffrinl
Description: modifying the way search results are displayed

*/

function resultsperpage($limits) {
/* resultsperpage - it is a custom created php function. */

if (is_search()) {
/* is_search() - it is an inbuilt php function in wordpress */
/* http://codex.wordpress.org/Function_Reference/is_search */

return 'LIMIT 0, 25';
}
return $limits;
}

add_filter('post_limits', 'resultsperpage');
/* post_limits - a wordpress hook ( a filter hook ) */
/* http://codex.wordpress.org/Plugin_API/Filter_Reference/post_limits */

/* add_filter - Hook a function to a specific filter action. */
/* http://codex.wordpress.org/Function_Reference/add_filter */

Crash: glibc: compile from upstream source related

Log Report Related

the following content may not be accurate.

1. unable to find getty program  upstream source.
2. need to get libc-2.14 for getty.
3. trying to upgrade another system to get libc-2.14
4. is it possible to get multiple versions of glibc installed
on a same system.
compile another version of glibc and just take the necessary
files and copy into into may be /lib
5. a new method of installing package using apt-get
apt-get install libc6-dev=2.17-7
apt-show-versions -a -p libc6

Debug Methods

1. update LD_LIBRARY_PATH with the old and new path of libraries installed
2. use debian disc wit rescue mode and try to fix libraries
with matching versions of libraries with new glibc
3. add proper symlinks for the new libraries under glibc
4. try to make a separate installation of debian in another(may be swap
of the crashed debian ) and try to chroot to crashed debian root
and try to fix the errors.
5. try to find out where to set LD_LIBRARY_PATH by default automatically.
6. if chroot is success related, then try to apt-get upgrade the crashed
debian so that it may fix other errors automatically.

Maths : What is a Function : y=f(x)

commandline session and notes related
may be engineering functions related.
suppose y=f(x).
y = output.
suppose i equate y to ls
ls is a	GNU command.
ls contains different methods(ingredients) which form ls command.
suppose	i write	 ls = f (-a,-i,-l,...)
different cases	:
1. y = -a
2. y = -al
3. y = -l,
4. y = -i
5. y = -ail



$ls -ail
total 1708
3673124 drwxr-xr-x  4 jeffrin jeffrin    4096 Nov 27 20:18 .
3670018 drwxr-xr-x 48 jeffrin jeffrin    4096 Nov 27 19:13 ..
3804877 drwxr-xr-x  2 jeffrin jeffrin    4096 Nov 22 21:40 direct
3670534 lrwxrwxrwx  1 jeffrin jeffrin       7 Nov 22 21:41 directlink -> direct/
3673719 -rw-r--r--  1 jeffrin jeffrin     104 Nov 15 20:50 file
3805205 drwx------  2 jeffrin jeffrin    4096 Nov 25 20:18 Mail
3671094 -rw-r--r--  1 jeffrin jeffrin 1710918 Nov 25 02:23 out.ogv
3673430 -rw-r--r--  1 jeffrin jeffrin    7946 Nov 25 01:55 shelr-record.json
3673230 -rw-r--r--  1 jeffrin jeffrin     217 Nov 27 20:16 tmp
3672617 lrwxrwxrwx  1 jeffrin jeffrin      30 Nov 27 20:18 .#tmp -> jeffrin@debian.5024:1385559781
3673193 -rw-r--r--  1 jeffrin jeffrin       1 Nov 27 19:54 tmp~
$ls -a
.  ..  direct  directlink  file  Mail  out.ogv  shelr-record.json  tmp  .#tmp  tmp~
$ls -i
3804877 direct      3673719 file  3671094 out.ogv            3673230 tmp
3670534 directlink  3805205 Mail  3673430 shelr-record.json  3673193 tmp~
$ls -l
total 1700
drwxr-xr-x 2 jeffrin jeffrin    4096 Nov 22 21:40 direct
lrwxrwxrwx 1 jeffrin jeffrin       7 Nov 22 21:41 directlink -> direct/
-rw-r--r-- 1 jeffrin jeffrin     104 Nov 15 20:50 file
drwx------ 2 jeffrin jeffrin    4096 Nov 25 20:18 Mail
-rw-r--r-- 1 jeffrin jeffrin 1710918 Nov 25 02:23 out.ogv
-rw-r--r-- 1 jeffrin jeffrin    7946 Nov 25 01:55 shelr-record.json
-rw-r--r-- 1 jeffrin jeffrin     217 Nov 27 20:16 tmp
-rw-r--r-- 1 jeffrin jeffrin       1 Nov 27 19:54 tmp~
$

common network utilities/tools

commandline session

$ping www.beautifulwork.org
PING beautifulwork.org (46.22.210.18) 56(84) bytes of data.
64 bytes from mars.infoclub.in (46.22.210.18): icmp_req=1 ttl=53 time=310 ms
64 bytes from mars.infoclub.in (46.22.210.18): icmp_req=2 ttl=53 time=210 ms
64 bytes from mars.infoclub.in (46.22.210.18): icmp_req=3 ttl=53 time=210 ms
64 bytes from mars.infoclub.in (46.22.210.18): icmp_req=4 ttl=53 time=210 ms
64 bytes from mars.infoclub.in (46.22.210.18): icmp_req=5 ttl=53 time=211 ms
^C
--- beautifulwork.org ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4069ms
rtt min/avg/max/mdev = 210.503/230.707/310.307/39.800 ms
$ping -c 2 www.beautifulwork.org
PING beautifulwork.org (46.22.210.18) 56(84) bytes of data.
64 bytes from mars.infoclub.in (46.22.210.18): icmp_req=1 ttl=53 time=302 ms
64 bytes from mars.infoclub.in (46.22.210.18): icmp_req=2 ttl=53 time=209 ms

--- beautifulwork.org ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 209.468/256.133/302.799/46.668 ms
$ping -c 2 -i 1 www.beautifulwork.org
PING beautifulwork.org (46.22.210.18) 56(84) bytes of data.
64 bytes from mars.infoclub.in (46.22.210.18): icmp_req=1 ttl=53 time=328 ms
64 bytes from mars.infoclub.in (46.22.210.18): icmp_req=2 ttl=53 time=347 ms

--- beautifulwork.org ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 328.452/337.938/347.425/9.504 ms
$netstat  -ntl
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 0.0.0.0:45517           0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN
tcp6       0      0 :::111                  :::*                    LISTEN
tcp6       0      0 :::22                   :::*                    LISTEN
tcp6       0      0 ::1:25                  :::*                    LISTEN
tcp6       0      0 :::51975                :::*                    LISTEN
$netstat  -ntlp
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:45517           0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      -
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      -
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      -
tcp6       0      0 :::111                  :::*                    LISTEN      -
tcp6       0      0 :::22                   :::*                    LISTEN      -
tcp6       0      0 ::1:25                  :::*                    LISTEN      -
tcp6       0      0 :::51975                :::*                    LISTEN      -
$sudo netstat  -ntlp
[sudo] password for jeffrin:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:45517           0.0.0.0:*               LISTEN      1859/rpc.statd
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1828/rpcbind
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      3099/sshd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      27100/exim4
tcp6       0      0 :::111                  :::*                    LISTEN      1828/rpcbind
tcp6       0      0 :::22                   :::*                    LISTEN      3099/sshd
tcp6       0      0 ::1:25                  :::*                    LISTEN      27100/exim4
tcp6       0      0 :::51975                :::*                    LISTEN      1859/rpc.statd
$sudo netstat  -n

GNU/Linux Common Network Utilities/Tools – Video Tutorial Related

[source : http://www.youtube.com/user/frankperez87]

[youtube https://www.youtube.com/watch?v=CigJXmUYXJY?rel=0&w=853&h=480]

nmap . -O: Enable OS detection

commandline session

$nmap 127.0.0.1

Starting Nmap 6.00 ( http://nmap.org ) at 2013-11-24 17:56 IST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.00019s latency).
Not shown: 997 closed ports
PORT    STATE SERVICE
22/tcp  open  ssh
25/tcp  open  smtp
111/tcp open  rpcbind

Nmap done: 1 IP address (1 host up) scanned in 0.10 seconds
$nmap -O 127.0.0.1
TCP/IP fingerprinting (for OS scan) requires root privileges.
QUITTING!
$sudo nmap -O 127.0.0.1
[sudo] password for jeffrin:

Starting Nmap 6.00 ( http://nmap.org ) at 2013-11-24 17:56 IST
Nmap scan report for localhost (127.0.0.1)
Host is up (0.000057s latency).
Not shown: 997 closed ports
PORT    STATE SERVICE
22/tcp  open  ssh
25/tcp  open  smtp
111/tcp open  rpcbind
No exact OS matches for host (If you know what OS is running on it, see http://nmap.org/submit/ ).
TCP/IP fingerprint:
OS:SCAN(V=6.00%E=4%D=11/24%OT=22%CT=1%CU=32670%PV=N%DS=0%DC=L%G=Y%TM=5291F0
OS:7A%P=x86_64-unknown-linux-gnu)SEQ(SP=FF%GCD=1%ISR=111%TI=Z%CI=Z%II=I%TS=
OS:8)OPS(O1=M400CST11NW6%O2=M400CST11NW6%O3=M400CNNT11NW6%O4=M400CST11NW6%O
OS:5=M400CST11NW6%O6=M400CST11)WIN(W1=8000%W2=8000%W3=8000%W4=8000%W5=8000%
OS:W6=8000)ECN(R=Y%DF=Y%T=41%W=8018%O=M400CNNSNW6%CC=Y%Q=)T1(R=Y%DF=Y%T=41%
OS:S=O%A=S+%F=AS%RD=0%Q=)T2(R=N)T3(R=N)T4(R=Y%DF=Y%T=41%W=0%S=A%A=Z%F=R%O=%
OS:RD=0%Q=)T5(R=Y%DF=Y%T=41%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)T6(R=Y%DF=Y%T=41%W
OS:=0%S=A%A=Z%F=R%O=%RD=0%Q=)T7(R=Y%DF=Y%T=41%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)
OS:U1(R=Y%DF=N%T=41%IPL=164%UN=0%RIPL=G%RID=G%RIPCK=G%RUCK=G%RUD=G)IE(R=Y%D
OS:FI=N%T=41%CD=S)

Network Distance: 0 hops

OS detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 12.17 seconds
$
$sudo nmap -O 192.168.0.1

Starting Nmap 6.00 ( http://nmap.org ) at 2013-11-24 17:59 IST
Nmap scan report for 192.168.0.1
Host is up (0.00047s latency).
Not shown: 998 closed ports
PORT   STATE SERVICE
53/tcp open  domain
80/tcp open  http
MAC Address: 5C:D9:98:5C:01:1A (D-Link)
Device type: general purpose
Running: Linux 2.6.X
OS CPE: cpe:/o:linux:kernel:2.6
OS details: Linux 2.6.29 - 2.6.31
Network Distance: 1 hop

OS detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 2.10 seconds
$

nmap . -O: Enable OS detection – Video Tutorial Related

[source : http://www.youtube.com/user/metalx1000 ]

[youtube https://www.youtube.com/watch?v=XaCzpqIU5-A?rel=0&w=560&h=315]

What does the command “netstat ” do ?

ABOUT netstat

In computing, netstat (network statistics) is a command-line network utility tool that displays network connections for the Transmission Control Protocol (both incoming and outgoing), routing tables, and a number of network interface (network interface controller or software-defined network interface) and network protocol statistics. It is available on Unix-like operating systems including macOS, Linux, Solaris, and BSD, and is available on Windows NT-based operating systems including Windows XP, Windows Vista, Windows 7, Windows 8 and Windows 10.

It is used for finding problems in the network and to determine the amount of traffic on the network as a performance measurement.[1] On Linux this program is mostly obsolete, although still included in many distributions.

On Linux, netstat (part of "net-tools") is superseded by ss (part of iproute2). Replacement for netstat -r is ip route. Replacement for netstat -i is ip -s link, replacement for netstat -g is ip maddr, all of which are recommended instead

RELATED SHELL SESSION EXPOSURE
[bash light=”true”]
$netstat –tcp
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 debian.local:39585 74.125.169.8:http ESTABLISHED
tcp 0 0 debian.local:39586 74.125.169.8:http ESTABLISHED
tcp 0 0 debian.local:47951 maa03s17-in-f6.1e:https ESTABLISHED
tcp 0 0 debian.local:47203 maa03s17-in-f0.1e1:http ESTABLISHED
$
$netstat –tcp –numeric
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 1 0 192.168.0.101:54541 46.22.210.18:80 CLOSE_WAIT
tcp 0 0 192.168.0.101:54542 46.22.210.18:80 ESTABLISHED
tcp 0 0 192.168.0.101:39585 74.125.169.8:80 ESTABLISHED
tcp 0 0 192.168.0.101:39586 74.125.169.8:80 TIME_WAIT
tcp 0 0 192.168.0.101:47951 74.125.236.198:443 ESTABLISHED
tcp 0 0 192.168.0.101:47203 74.125.236.192:80 ESTABLISHED
$netstat –tcp –numeric
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 192.168.0.101:54542 46.22.210.18:80 TIME_WAIT
tcp 0 0 192.168.0.101:39585 74.125.169.8:80 ESTABLISHED
tcp 0 0 192.168.0.101:39586 74.125.169.8:80 TIME_WAIT
tcp 0 0 192.168.0.101:47951 74.125.236.198:443 ESTABLISHED
tcp 0 0 192.168.0.101:47203 74.125.236.192:80 ESTABLISHED
$netstat –tcp –listen
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:35436 *:* LISTEN
tcp 0 0 *:sunrpc *:* LISTEN
tcp 0 0 *:ssh *:* LISTEN
tcp 0 0 localhost:smtp *:* LISTEN
tcp6 0 0 [::]:sunrpc [::]:* LISTEN
tcp6 0 0 [::]:501100 [::]:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
tcp6 0 0 localhost:smtp [::]:* LISTEN
$netstat –tcp –listen
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 *:35436 *:* LISTEN
tcp 0 0 *:sunrpc *:* LISTEN
tcp 0 0 *:ssh *:* LISTEN
tcp 0 0 localhost:smtp *:* LISTEN
tcp6 0 0 [::]:sunrpc [::]:* LISTEN
tcp6 0 0 [::]:501100 [::]:* LISTEN
tcp6 0 0 [::]:ssh [::]:* LISTEN
tcp6 0 0 localhost:smtp [::]:* LISTEN
$netstat –tcp –program
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 debian.local:39600 74.125.169.8:http ESTABLISHED 3846/chrome
tcp 0 0 debian.local:47951 maa03s17-in-f6.1e:https ESTABLISHED 3846/chrome
tcp 0 0 debian.local:47203 maa03s17-in-f0.1e1:http ESTABLISHED 3846/chrome
$
$netstat –tcp –route
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
default 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
$netstat –tcp –statistics
IcmpMsg:
OutType3: 1
Tcp:
522 active connections openings
0 passive connection openings
14 failed connection attempts
16 connection resets received
2 connections established
60302 segments received
41524 segments send out
22 segments retransmited
21 bad segments received.
140 resets sent
UdpLite:
TcpExt:
190 TCP sockets finished time wait in fast timer
495 delayed acks sent
1 delayed acks further delayed because of locked socket
Quick ack mode was activated 32 times
47899 packet headers predicted
1353 acknowledgments not containing data payload received
406 predicted acknowledgments
7 congestion windows recovered without slow start after partial ack
22 other TCP timeouts
32 DSACKs sent for old packets
3 DSACKs sent for out of order packets
5 DSACKs received
25 connections reset due to unexpected data
16 connections reset due to early user close
TCPSackShiftFallback: 2
TCPChallengeACK: 21
TCPSYNChallenge: 21
IpExt:
InMcastPkts: 929
OutMcastPkts: 42
InBcastPkts: 16
OutBcastPkts: 14
InOctets: 83827635
OutOctets: 2776707
InMcastOctets: 332300
OutMcastOctets: 5264
InBcastOctets: 1808
OutBcastOctets: 1006
$

[/bash]
LINKS
https://en.wikipedia.org/wiki/Netstat
https://stackoverflow.com/tags/netstat/info

Bash – netstat ( network statistics related ) – Video Tutorial Related

[ source : http://www.youtube.com/user/metalx1000 ]

[youtube https://www.youtube.com/watch?v=wcrQgKNUD10?rel=0&w=560&h=315]

GNU/Linux BASH builtin commands

commandline session

$pwd
/home/jeffrin/playground
$which pwd
/bin/pwd
$
$/bin/pwd
/home/jeffrin/playground
$/bin/pwd -P
/home/jeffrin/playground
$pwd -P
/home/jeffrin/playground
$help pwd
pwd: pwd [-LP]
    Print the name of the current working directory.

    Options:
      -L	print the value of $PWD if it names the current working
    	directory
      -P	print the physical directory, without any symbolic links

    By default, `pwd' behaves as if `-L' were specified.

    Exit Status:
    Returns 0 unless an invalid option is given or the current directory
    cannot be read.
$mkdir  direct
$ln -s  direct/  directlink
$pwd
/home/jeffrin/playground
$cd direct
$pwd
/home/jeffrin/playground/direct
$pwd -P
/home/jeffrin/playground/direct
$/bin/pwd
/home/jeffrin/playground/direct
$/bin/pwd -P
/home/jeffrin/playground/direct
$cd ..
$cd directlink
$pwd
/home/jeffrin/playground/directlink
$pwd -P
/home/jeffrin/playground/direct
$/bin/pwd
/home/jeffrin/playground/direct
$/bin/pwd -P
/home/jeffrin/playground/direct
$/bin/pwd --help
Usage: /bin/pwd [OPTION]...
Print the full filename of the current working directory.

  -L, --logical   use PWD from environment, even if it contains symlinks
  -P, --physical  avoid all symlinks
      --help     display this help and exit
      --version  output version information and exit

NOTE: your shell may have its own version of pwd, which usually supersedes
the version described here.  Please refer to your shell's documentation
for details about the options it supports.

Report pwd bugs to bug-coreutils@gnu.org
GNU coreutils home page: 
General help using GNU software: 
For complete documentation, run: info coreutils 'pwd invocation'
$pwd --help
bash: pwd: --: invalid option
pwd: usage: pwd [-LP]
$

GNU/Linux BASH builtin commands – Video Tutorial Related

[ source : http://www.youtube.com/user/theurbanpenguin ]

[youtube https://www.youtube.com/watch?v=Kv42Beohmyo?rel=0&w=560&h=315]