net::rawip source code question

net::rawip source code question

am 08.01.2006 21:38:28 von August Reno

Hello!
I'm a total newbie in perl. I examined some scripts where the net::rawip
module
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,
regards,
august

Re: net::rawip source code question

am 09.01.2006 20:22:18 von Jim Gibson

In article , August Reno
wrote:

> Hello!
> I'm a total newbie in perl. I examined some scripts where the net::rawip
> module

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

> was used. What does the following mean ?
>
> $s = new Net::RawIP;

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

> $filter = "ip proto \\tcp and src host $daddr and src port $dport";

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.

> $pcap = $a->pcapinit($device,$filter,1500,60);

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).

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

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
knowledge.

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

Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com