Date: Fri, 11 Aug 1995 16:06:12 PDT From: Bill Fenner <fenner@parc.xerox.com> To: Robin Cutshaw <robin@intercore.com> Cc: current@freebsd.org Subject: Re: speaking of tcpdump Message-ID: <95Aug11.160618pdt.177475@crevenia.parc.xerox.com> In-Reply-To: Your message of "Fri, 11 Aug 95 12:23:46 PDT." <199508111923.PAA25640@intercore.com>
index | next in thread | previous in thread | raw e-mail
[-- Attachment #1 --]
In message <199508111923.PAA25640@intercore.com> you write:
>I use tcpdump pretty extensively as a network tool and wanted to see
>both ascii and hex for full packet dumps
I wrote this perl script and called it "tcpdumpscii"... it displays an ascii
version of the hex output, iff the tcpdump outputs the "-x" format stuff.
Call it with normal tcpdump arguments.
Bill
[-- Attachment #2 --]
#!/usr/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;
}
help
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?95Aug11.160618pdt.177475>
