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>
next in thread | previous in thread | raw e-mail | index | archive | help
This is a multipart MIME message. --===_0_Fri_Aug_11_16:05:31_PDT_1995 Content-Type: text/plain; charset=us-ascii 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 --===_0_Fri_Aug_11_16:05:31_PDT_1995 Content-Type: text/plain; charset=us-ascii Content-Description: tcpdumpscii #!/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; } --===_0_Fri_Aug_11_16:05:31_PDT_1995--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?95Aug11.160618pdt.177475>