hping wiki



hping setfield layer field value ?skip? packet

hping setfield is used to set a given field in a packet, it returns a new packet with the given field set to the specified value:
hping3.0.0-alpha> hping setfield udp sport 2000 $packet
ip(ihl=5,ver=4,tos=c0,totlen=58,id=62912,fragoff=0,mf=0,df=0,rf=0,ttl=64,proto=1,cksum=e500,saddr=192.168.1.7,daddr=192.168.1.6)+icmp(type=3,code=3,unused=0)+ip(ihl=5,ver=4,tos=00,totlen=30,id=60976,fragoff=0,mf=0,df=1,rf=0,ttl=64,proto=17,cksum=40c9,saddr=192.168.1.6,daddr=192.168.1.7)+udp(sport=2000,dport=10,len=10,cksum=94d6)+data(str=fa)

So in order to modify a packet hold in a Tcl variable it is possible to write:
set packet [hping setfield udp sport 2000 $packet]

hping setfield can't add fields, so an attempt to set a non-existent layer/field returns an error.
 
Edit this page Upload file Page history - Page last update: Sun Sep 05 07:14:25 GMT 2004 by 82.49.49.250 | Your address: 18.225.255.134 | Admin