Monday, January 23, 2012

Command to know information for partation..

list partition
                      $fdisk -l 

disk space usage:
                      $df -h     or       $df -k

display mount point :
                      $mount

quickly mount all file system present in /etc/fstab
                       $mount -a

File system mount points and other information present in /etc/fstab

Saturday, January 14, 2012

Scapy - Easy packet generation

Scapy is a python command based packet generation tool. It help to create packet very easily. It has full control over protocol stack. We can alter all the bits in the packet and modify any packet according to our wish.

installing scapy:
                          $ wget scapy.net
                          $ unzip scapy-latest.zip
                          $ cd scapy-2.*
                          $ sudo python setup.py install

starting scapy:
                         $ scapy



Documentation present at : www.dirk-loss.de/scapy-doc/Scapy.pdf


Sample code: [ICMP packet generation ]
                     
root@bt:~# scapy
WARNING: No route found for IPv6 destination :: (no default route?)
Welcome to Scapy (2.1.0)
>>> a= ICMP()
>>> b= IP()
>>> c=Ether()
>>> d=c/b/a

>>> d.display()
###[ Ethernet ]###
  dst= ff:ff:ff:ff:ff:ff
  src= 00:00:00:00:00:00
  type= 0x800
###[ IP ]###
     version= 4
     ihl= None
     tos= 0x0
     len= None
     id= 1
     flags=
     frag= 0
     ttl= 64
     proto= icmp
     chksum= None
     src= 127.0.0.1
     dst= 127.0.0.1
     \options\
###[ ICMP ]###
        type= echo-request
        code= 0
        chksum= None
        id= 0x0
        seq= 0x0
>>> send (d)       // sending the packet d into network


## send () is used when we are injecting packet at layer3.
and if we want to send packet with modification at layer 2 entry then we will use sendp() to send packet.
otherwise we will get a warning message. 
      >>> send(ether/ip/icmp)
WARNING: Mac address to reach destination not found. Using broadcast.
.
Sent 1 packets.


for more information

enjoy coding.. :) B-)