hi all - another help request
i have a student who needs a short script that will use tcpdump to count the total # of packets heard on a wireless network every N seconds
was able to find this Perl snippet as a start, but need to figure out a way to make it end after N seconds and then output the total # of packets (i.e. the total number of lines), and dump the IP filters and just count all the packets.
open(TCPDUMP,"/usr/sbin/tcpdump -q -i wlan0|") or die "Can't open
tcpdump: $!";
for (<TCPDUMP>) {
++$hogcount[0] if /192.168.1.15$/; # hog #1
++$hogcount[1] if /192.168.1.45$/; # hog #2
}END { close TCPDUMP; print "Hog 1 had $hogcount[0] packets and Hog 2 had
$hogcount[1]\n"; }
thanks in advance for anyone willing to help
-- NYCwireless - http://www.nycwireless.net/ Un/Subscribe: http://lists.nycwireless.net/mailman/listinfo/nycwireless/ Archives: http://lists.nycwireless.net/pipermail/nycwireless/
