Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Nov 1997 14:35:23 PST
From:      Bill Fenner <fenner@parc.xerox.com>
To:        Nate Williams <nate@mt.sri.com>
Cc:        bmah@ca.sandia.gov, hackers@freebsd.org
Subject:   Re: Getting ethernet packets content under FreeBSD? 
Message-ID:  <97Nov22.143538pst.177476@crevenia.parc.xerox.com>
In-Reply-To: Your message of "Fri, 21 Nov 97 14:34:22 PST." <199711212234.PAA15870@mt.sri.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
I usually just use this perl script, which I call "tcpdumpscii".
Then run "tcpdumpscii -s 1500 -x [other tcpdump args]".

  Bill

#!/import/misc/bin/perl
#
#
open(TCPDUMP,"tcpdump -l @ARGV|");
while (<TCPDUMP>) {
	if (/^\s+(\S\S)+/) {
		$sav = $_;
		$asc = "";
		while (s/\s*(\S\S)\s*//) {
			$i = hex($1);
			if ($i < 32 || $i > 126) {
				$asc .= ".";
			} else {
				$asc .= pack(C,hex($1));
			}
		}
		$foo = "." x length($asc);
		$_ = $sav;
		s/\t/        /g;
		s/^$foo/$asc/;
	}
	print;
}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?97Nov22.143538pst.177476>