in reply to Re^3: Getting ethernet type using NetPacket
in thread Getting ethernet type using NetPacket

What part did you have trouble with ? Any error messages ?

If you un-comment the lines below, it will print packets as they arrive.

#print("RcvPkt Totlen(PacketLen) $hdr->{len}($hdr->{caplen})" . # "\t Time.Usec=$hour:$min:$sec.$hdr->{tv_usec}\n");
If you capture packets, you can control-feed them into the program (read pcap docs), and run the "perl -d <program>" debugger, and examine data as you go.

            "XML is like violence: if it doesn't solve your problem, use more."

Replies are listed 'Best First'.
Re^5: Getting ethernet type using NetPacket
by merrittr (Novice) on Jul 28, 2011 at 21:32 UTC

    Hi NetWhallah

    I can run the code however it doesn't like my interfaces

    root@robm-desktop:/scripts/pcap# ./netpkt.pl eth0 No description available vmnet1 No description available usbmon1 USB bus number 1 usbmon2 USB bus number 2 eth3 No description available usbmon3 USB bus number 3 usbmon4 USB bus number 4 usbmon5 USB bus number 5 usbmon6 USB bus number 6 usbmon7 USB bus number 7 vmnet8 No description available usbmon8 USB bus number 8 any Pseudo-device that captures on all interfaces lo Loopback device Found device intel Found Net net 0.0.0.0 mask 0.0.0.0 Net::Pcap::open_live returned error SIOCGIFHWADDR: No such device
      If you examine the parameters, you will notice that there is hard-coding to look for an "intel" type NIC.
      "NETWORK_INTERFACE => 'intel',# Network interface to open
      Try modifying that to match your hardware, or change it to a proper parameter...

                  "XML is like violence: if it doesn't solve your problem, use more."