Linux Forums - Linux Help,Advice & support community:LinuxSolved.com
Linux in General => Linux Development & Programming => Topic started by: bahram741413 on January 25, 2004, 09:14:44 AM
-
Hi 2 all
i am a network administerator and want to write a packet sniffer for monitoring my network. i know that there is some program, but i want to do myself, to have complete information.
please give me a start point.
thanks
-
Man.. if you know basic programming then give this guide a look..
http://www.ecst.csuchico.edu/~beej/guide/net/html/
-
hi i want source code for socket coding in c++ using tcp/ip protocols in linux
-
Mark if you look the link below you will find that it has all what you want..
Man.. if you know basic programming then give this guide a look..
http://www.ecst.csuchico.edu/~beej/guide/net/html/
-
Hi you can try this script:
It is a bit of a modified version of tcpdump
You may need to run it as root
#!/usr/bin/perl
$LIMIT = shift || 5000;
$|=1;
open (STDIN,"/usr/sbin/tcpdump -lnx -s 1024 dst port 80 |");
while (<>) {
if (/^\S/) {
last unless $LIMIT--;
while ($packet=~/(GET|POST|WWW-Authenticate|Authorization).+/g) {
print "$client -> $host\t$&\n";
}
undef $client; undef $host; undef $packet;
($client,$host) = /(\d+\.\d+\.\d+\.\d+).+ > (\d+\.\d+\.\d+\.\d+)/
if /P \d+:\d+\((\d+)\)/ && $1 > 0;
}
next unless $client && $host;
s/\s+//;
s/([0-9a-f]{2})\s?/chr(hex($1))/eg;
tr/\x1F-\x7E\r\n//cd;
$packet .= $_;
}