in reply to How to use raw socket by perl?

Have a look at Net::PCap and Net::PCapUtils, two modules that are very good for sniffing packets, as they rely on the libpcap library. That library also has (very limited) packet injection capabilities, so you might actually find this enough for your needs.

If you have a BSD-based operating system, you might also find the other modules by Stephanie Wehner, Net::Divert and Net::ProxyMod helpfull, as they make modifying, injecting and sniffing packets very easy.

Replies are listed 'Best First'.
Re^2: How to use raw socket by perl?
by JanneVee (Friar) on Sep 10, 2004 at 14:27 UTC
    Net::RawIP has also a Pcap interface Net::RawIP::libpcap.
Re^2: How to use raw socket by perl?
by A_Banknote (Initiate) on Sep 11, 2004 at 02:31 UTC
    thx alot first.
    but how should I recive a packet?
    example manpage gived is:
    $a->ethnew("eth0"); $a->ethset(source => 'my.target.lan',dest =>'my.target.lan'); $a->ethsend; $p = $a->pcapinit("eth0","dst port 21",1500,30); $f = dump_open($p,"/my/home/log"); loop $p,10,\&dump,$f;

    where can I get a packet? when dump_open() ? Does it log the recved pack to /my/home/log?
    And always when I call
    $a->ethset(source => '111.111.111.2',dest =>'111.111.111.2');
    error says can't look up mac addr, but if I give the max addr, it says undefind vararibles.