net::rawip source code question

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I'm a total newbie in perl. I examined some scripts where the net::rawip
was used. What does the following mean ?

$s = new Net::RawIP;
$filter = "ip proto \tcp and src host $daddr and src port $dport";
$pcap = $a->pcapinit($device,$filter,1500,60);

So I'm trouble with the $filter line. (daddr = destination address,
dport=destination port).
Please explain this to me! Thanks in advance,

Re: net::rawip source code question

Quoted text here. Click to load it

I have not used the Net::RawIP module, so can't help you with what the
lines below will actually do.

Quoted text here. Click to load it

This line results in the variable $s becoming an instance of the
Net::RawIP class.

Quoted text here. Click to load it

This assigns the string 'ip proto \tcp and src host xxx and src port
yyy' to the variable $filter. Note that the two backslashes have been
converted to a single backslash in the string, and the current values
of the variables $daddr and $dport have been interpolated into the
string. This string is used as a filter program in the line below.

Quoted text here. Click to load it

This is a call to the Net::RawIP::pcapinit method. The values in
$device and $filter are passed to it, as are the constants 1500 (for
packet size) and 60 (for timeout).

Quoted text here. Click to load it

The $filter contains a filter program for the pcap library. The syntax
and meaning are determined by the pcap library, of which I have no

See the output from 'perldoc Net::RawIP' and 'man pcap' for more

 Posted Via Premium Usenet Newsgroup Services

Site Timeline