Here is a snippet from some code I wrote in 2006 - hopefully this will give you an idea what to do. Note - I have not looked at this since then, and the modules may have changed.
my $SNIFF_NIC = q(\Device\NPF_{6098F1AA-BEB5-49D4-8DEC-9B08EE8CE35C}); ... my %pcap_parameters = ( SNAPLEN => 256, # Num bytes to capture from packet PROMISCUOUS_MODE => 1, # Operate in promiscuous mode? TIMEOUT => 1000, # Read timeout (ms) NUMPACKETS => 0, # Pkts to read (-1 = loop forever) FILTER => '(ip proto \icmp) or dst port 80 or 135 or 139 or 44 +5 or 3127 or 4444', # Filter string USERDATA => '', # Passed as first arg to callback fn SAVEFILE => '', # Default save file # Items below are RETURNED values from PCap calls. # Do not attempt to change them in the declaration. FILTER_HANDLE => 0, # Reference to compiled filter NETWORK_INTERFACE => '',# Network interface to open NETWORK_ADDR =>0, # Network Address (32 bit number) NETWORK_MASK =>0, # Mask (32-bit number) mode => '', # Internal variable ); ..... $pcap_parameters{NETWORK_INTERFACE} = $SNIFF_NIC; ### Net::Pcap::lookupdev(\$err) or die "No Network device found:$e +rr\n"; if ($verbose){ print "Requested device \t[$pcap_parameters{NETWORK_INTERFACE}]\n" +; my $dev = Net::Pcap::lookupdev(\$err) or die "Net::Pcap::lookupdev failed. Error was :$err;\n"; print "Default device:$dev\n;"; my ($error, %description); print $error if defined $error; } $result = Net::Pcap::lookupnet($pcap_parameters{NETWORK_INTERFACE}, \$pcap_parameters{NETWORK_ADDR}, \$pcap_parameters{NETWORK_MASK}, \$err); $verbose and print "Found Net \tnet " . NetPacket::IP::to_dotquad($p +cap_parameters{NETWORK_ADDR}) . " mask " . NetPacket::IP::to_dotquad($pcap_parameters{NETWORK +_MASK}) . "\n"; .... # Signal handler $SIG{INT} = 'KeyboardInput'; my $count = 0; Net::Pcap::loop($pcap_desc, $pcap_parameters{NUMPACKETS}, \&process_pk +t, "abc"); Net::Pcap::close($pcap_desc);
Yes - this was for a Windows (probably Win2003) system.

     Syntactic sugar causes cancer of the semicolon.        --Alan Perlis


In reply to Re^5: Perl Script on Windows Vista by NetWallah
in thread Perl Script on Windows Vista by burningredmoon

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.