For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > April 2005 > sending icmp packets with raw::ip









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author sending icmp packets with raw::ip
lucas

2005-04-27, 8:57 pm

okay, i'm having trouble mimiking proper icmp packets, so here with hping2 i
send a proper packet:
hping2 -1 -C 11 -K 0 nexuss -c 1

and from tcpdump:
17:36:47.213148 IP (tos 0x0, ttl 64, id 15954, offset 0, flags [none],
length: 56) 192.168.0.2 > 192.168.0.1: icmp 36: time exceeded in-transit

and my perl code to do the same:
my $a = new Net::RawIP ({icmp =>{}});
$a->set({
ip => { dr => $dr, daddr => $daddr, protocol => 1, tos => 0,
id => $$},
icmp => {type => $type, code => $code, id => $$, sequence => $seq}
});
$a->send(1,1);

taken from tcpdump:
17:42:13.741040 IP (tos 0x0, ttl 64, id 8408, offset 0, flags [DF], length:
28) 192.168.0.2 > 192.168.0.1: [|icmp]

i figure that tcpdump isn't recognizing it becuase i missed an option in the
packet somewhere. can anybody help me with this?

thx,
--
lucas
-------------------------
Perl Coder since 2001
shift || die;
-------------------------
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com