Skip to content

URL Encoding

://,    ?   &   /  ;   = are special chracter in a URL. So what if fine name contains these characters ???

/   Path

?  Query

at end is Fragment, contains part of the page.


Setting up S3

sudo /usr/sbin/alternatives –install /usr/bin/java java /usr/java/jdk1.7.0_10/bin/java 20001 && sudo /usr/sbin/alternatives –config java && java -version

s3cmd -c


cd s3cmd

python install

s3cmd –ocnfigure

cloc…. count lines of code

prompt> cloc perl-5.10.0.tar.gz
    4076 text files.
    3883 unique files.                                          
    1521 files ignored. v 1.50  T=12.0 s (209.2 files/s, 70472.1 lines/s)
Language                     files          blank        comment           code
Perl                          2052         110356         130018         292281
C                              135          18718          22862         140483
C/C++ Header                   147           7650          12093          44042
Bourne Shell                   116           3402           5789          36882
Lisp                             1            684           2242           7515
make                             7            498            473           2044
C++                             10            312            277           2000
XML                             26            231              0           1972
yacc                             2            128             97           1549
YAML                             2              2              0            489
DOS Batch                       11             85             50            322
HTML                             1             19              2             98
SUM:                          2510         142085         173903         529677

prompt> cloc --show-lang

prompt> cloc --diff gcc-4.4.0.tar.bz2 gcc-4.5.0.tar.bz2

prompt> cloc --diff  Python-2.6.6.tar.bz2 Python-2.7.tar.bz2

SSH Tips

— git config –global http.sslVerify false

for x in $(seq 9); do for y in c ; do ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no beacon-00${x}${y} ‘df -h /’; done ;done

1) Creating the key

You can create a private/public key pair (in the files ~/.ssh/filename and ~/.ssh/ that has no passphrase protecting the private key, by doing the following:

cd ~/.ssh   ;  ssh-keygen -f filename -C ‘Some comment’  -N ” -t  rsa  -q


If on the other hand, you’d like to protect the private key file with a passphrase (which will be needed to be typed at any client that wants to use the key pair):

cd ~/.ssh
   ssh-keygen -f filename -C 'Some comment' -t rsa -q

3) authorized_keys There are a number of things that can be done in an authorized_keys to further 
restrict access. These are all arranged by prefixing the line containing the public key by a single 
"phrase" of comma-separated options (see below for an example of what this winds up looking like) 

a) Host access list

If the options phrase at the beginning of a line contains the keyword from="string" this restricts the use of the key on that line to sessions that originate from hosts that match "string". Examples might be


 b) Forced command

If the options phrase at the beginning of a line contains the keyword command="string", then any ssh connection that authenticates using that particular key will only run the command specified, even if the command line it was given specified another command.

Other options

Various ssh facilities may be suppressed by adding the following options to the options phrase at the beginning of a line:


Example authorized_keys file

This example file has two entries. Note that there is no whitespace in the list of options; they are separated by commas, and strings are double-quoted (eg in the argument to from=).

# comments are ignored in authorized_keys files
from="",no-port-forwarding,no-pty ssh-rsa AAAAB
fMKMKg+ERAz9XHYH3608RL1RQ== This comment describes key #1
# this one should be restricted so that only machines with hostnames
# matching * can use it.
from="*",no-X11-forwarding,noagent-forwarding ssh-rsa 
+7hZu9XvNfMKMKg+ERAz9XHYH3608RL1RQ== This comment describes key #2

Possible Issues ::::

1) Wrong keys

First, check that you really have put the matching public key in the ~/.ssh/authorized_keys file on the machine you’re trying to connect to, and that you’re telling your ssh client about the correct private key using the -i argument.

Keys the wrong way round

The public key goes in the destination host’s ~/.ssh/authorized_keys file.

The private key is needed on the machine you’re running ssh or slogin from.

2) File permissions

3) Wrong ssh protocol version :::

Sometimes, however, they’ll both decide to prefer v1.5 even though they both support v2. In such cases, your ssh-rsa key (which is v2 compliant) won’t work.

Solution: Force v2 by using the -2 flag to ssh or slogin

ssh -2 -i ~/.ssh/my_private_key remotemachine

4) failure to use the right authentication mechanisms

The client can be configured to request particular authentication mechanisms in a particular order. A non-standard local configuration file can therefore potentially lead the client to prompt for a password before in a particular ordera successful keybased authentication can occur.

The following options passed to ssh or slogin should compel the client to only offer/try the key-based authentication mechanism only:

   ssh -2 -i ~/.ssh/my_private_key \
       -o 'PasswordAuthentication no' \
       -o 'ChallengeResponseAuthentication no' \
       -o 'PreferredAuthentications publickey' \

This may be a useful way of minimising the chances of an entirely autonomous ssh-based command execution failing due to attempting a user interaction.

 SSH-Agent  ::::
the ssh-agent daemon exists to store decrypted private-keys you plan on using in a given session. The thing most people get tripped up on when using ssh-agent is that what the program outputs, some borne or csh shell commands, needs to be run. It may look like ssh-agent has set some variables for you, but it has in fact done no such thing. If you call 
without processing 
ssh-agent’s     output, it will complain it is unable to open a connection to your authentication agent. The most straightforward way to run ssh-agent on the command line is as follows: 
eval `ssh-agent`. 
After doing this, calls to ssh-add should succeed without error.

Usable Scripts

3) nohup find . -type f -not -name “*.gz” -exec gzip -vf {} \; &,    du -ks * | sort -n

1) $ cat nrpe_restart
for i in $@
ssh -o StrictHostKeyChecking=no $i -t sudo /etc/init.d/nrpe-server restart

2) for NAME in Rajesh Yug Manzoor



MESSAGE=’Proj r due today!!!!’

echo $MESSAGE |  mail -s Reminder $ADDRESS


3) for n in {1…20}; do


ping -c2 $host &> /dev/null

if [ $? = 0 ]; then

echo “” $host is up””


echo “$host is down”




SSH Aliases   In ~/.ssh/config

host foo bar
username webadmin
and then ssh foo will turn into while ssh bar will turn into

JPS Java Process Status tool | Hyper threading (HT)

Hyper-threading (officially Hyper-Threading Technology or HT Technology, abbreviated HTT or HT) is Intel’s proprietary simultaneous multithreading (SMT) implementation used to improve parallelization of computations (doing multiple tasks at once) performed on PC microprocessors. It first appeared in February 2002 on Xeon server processors and in November 2002 on Pentium 4 desktop CPUs.[1] Later, Intel included this technology in Itanium, Atom, and Core ‘i’ Series CPUs, among others.
Hyper-threading works by duplicating certain sections of the processor—those that store the architectural state—but not duplicating the main execution resources. This allows a hyper-threading processor to appear as the usual “physical” processor and an extra “logical” processor to the host operating system (legacy operating systems see two “physical” processors), allowing the operating system to schedule two threads or processes simultaneously and appropriately. When execution resources would not be used by the current task in a processor without hyper-threading, and especially when the processor is stalled, a hyper-threading equipped processor can use those execution resources to execute another scheduled task. (The processor may stall due to a cache miss, branch misprediction, or data dependency.)
Important Options::
Suppress the output of the class name, JAR file name, and arguments passed to the main method, producing only a list of local VM identifiers.
Output the arguments passed to the main method. The output may be null for embedded JVMs.
Output the full package name for the application’s main class or the full path name to the application’s JAR file.
sudo jps -l
16390 org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode
20889 org.apache.hadoop.mapred.TaskTracker
21629 org.apache.hadoop.hdfs.server.datanode.DataNode
24129 org.apache.zookeeper.server.quorum.QuorumPeerMain
Output the arguments passed to the JVM.
 sudo jps  -v
16390 SecondaryNameNode -Dproc_secondarynamenode -Xmx1000m -Dhadoop.log.dir=/home/hdfs/logs g -Dhadoop.home.dir=/usr/lib/hadoop-0.20 -Dhadoop.root.logger=INFO,DRFA -Djava.library.path=/usr/lib/hadoop-0.20/lib/native/Linux-amd64-64 -Dhadoop.policy.file=hadoop-policy.xml
Output the arguments passed to the JVM through the flags file (the .hotspotrc file or the file specified by the -XX:Flags=<filename> argument).

UseFull Blogs and Books
1)    Ankur aggarwal

2) or

3) Avinash



7) Soumya Ranjan

Cyber Attacks

1) Device Evasions. 

a) Router Evasion–> route hijacking,

b) FIrewall Evasion –> Firewall request Spoffing, Firewall DoS, pkt Forging, Rule Exploitation.

c) IDS and Switch Evasion