From owner-freebsd-current Fri Aug 11 16:07:21 1995 Return-Path: current-owner Received: (from majordom@localhost) by freefall.FreeBSD.org (8.6.11/8.6.6) id QAA18754 for current-outgoing; Fri, 11 Aug 1995 16:07:21 -0700 Received: from alpha.xerox.com (alpha.Xerox.COM [13.1.64.93]) by freefall.FreeBSD.org (8.6.11/8.6.6) with SMTP id QAA18710 for ; Fri, 11 Aug 1995 16:07:09 -0700 Received: from crevenia.parc.xerox.com ([13.2.116.11]) by alpha.xerox.com with SMTP id <15520(2)>; Fri, 11 Aug 1995 16:06:23 PDT Received: from localhost by crevenia.parc.xerox.com with SMTP id <177475>; Fri, 11 Aug 1995 16:06:18 -0700 X-Mailer: exmh version 1.6.1 5/23/95 To: Robin Cutshaw cc: current@freebsd.org Subject: Re: speaking of tcpdump In-reply-to: Your message of "Fri, 11 Aug 95 12:23:46 PDT." <199508111923.PAA25640@intercore.com> Mime-Version: 1.0 Content-Type: multipart/mixed ; boundary="===_0_Fri_Aug_11_16:05:31_PDT_1995" Date: Fri, 11 Aug 1995 16:06:12 PDT From: Bill Fenner Message-Id: <95Aug11.160618pdt.177475@crevenia.parc.xerox.com> Sender: current-owner@freebsd.org Precedence: bulk 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 () { 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--