sending icmp packets with raw::ip

Discussion in 'Perl Misc' started by lucas, Apr 27, 2005.

  1. lucas

    lucas Guest

    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 => { saddr => $saddr, 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;
    -------------------------
    lucas, Apr 27, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike Ayers

    Raw IP packets on Linux

    Mike Ayers, Aug 15, 2004, in forum: Python
    Replies:
    0
    Views:
    337
    Mike Ayers
    Aug 15, 2004
  2. Ashoka!
    Replies:
    6
    Views:
    543
    Ashoka!
    Apr 26, 2007
  3. Thomas Jollans
    Replies:
    0
    Views:
    373
    Thomas Jollans
    Aug 2, 2007
  4. Gary Herron
    Replies:
    1
    Views:
    435
    Azazello
    Aug 2, 2007
  5. Sagy Drucker

    icmp and raw sockets in python

    Sagy Drucker, Dec 13, 2011, in forum: Python
    Replies:
    1
    Views:
    353
    Martin P. Hellwig
    Dec 13, 2011
Loading...

Share This Page