Wednesday, July 20, 2011

Change order of packets in pcap file

Hi all, I have found new cap edit tool by which you can reorder the packets in pcap file. Not only ordering but also changing fields, fragmenting packets and adding vlan headers and so many other options. It has nice GUI will provide you user friendly experience.
Here is the GUI screen shot


Steps to install.
just check out the code from net
#svn co svn+http://code.google.com/p/packetsquare-capedit/source/browse/#svn/branches/0.0.1
#cd svn/branches/0.0.1/
#make
If you get any gtk+2 not installed issue then install gtk libs.
In ubuntu simply run below command
apt-get install libgtk2.0-dev
After successful installation, install capedit tool.
Once compiled you can run tool by simply typing below command.
./capedit
This tool is very usefull when your are working with protocol stacks...

Ok, just dig and explore more. Happy crafting packets :)

Friday, July 1, 2011

cmds grouping in expect script if we are expecting on same patron

Hi, below script is just to explain a data variable that can be used as list. So each value in the list are send to spawned program. This is helpful only if you are expecting on same string.
#!/usr/bin/expect -f


set force_conservative 0 ;# set to 1 to force conservative mode even if
;# script wasn't run conservatively originally
if {$force_conservative} {
set send_slow {1 .1}
proc send {ignore arg} {
sleep .1
exp_send -s -- $arg
}
}


set timeout -1
set data "ls
date
ls -ltr
bla
bla
bla
exit"

#Spwan the new bash shell
spawn bash


match_max 100000

foreach line [split $data \n] {
expect "root@phaneedra:/home/phaneedra#"
send -- "$line\r"
sleep 1
}



Above foreach will split each line (each element) from data and copies to line variable. Now our script will look for "root@phaneedra:/home/phaneedra#" this and when ever it occurs send first and then next cmds.

This is just for example so it may not make much sense. But use full to test Cli interacting applications where expecting string patron not changed.