Ethereal-users: Re: [Ethereal-users] use the option "-l" to pipe the output of Tethereal to ano

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Paul Hoffman / VPNC <paul.hoffman@xxxxxxxx>
Date: Wed, 24 Sep 2003 08:01:31 -0700
At 8:18 PM +0800 9/24/03, Ching-Tung Lo wrote:
My question is that how to use the option "-l" to pipe the output of Tethereal to another program.

Anybody can  give me an  example?

I use tethereal in testing IPsec gateways. It is good to see the tethreal text go zipping by as the test happens so I can see when the gateways are talking to each other, but I also want to keep the output for later so people can see what I saw. (For examples of the output, see <http://www.vpnc.org/detail-basic-interop.html>.)

I use the following minimalist Perl script to both see what is happening on the screen and capture at the same time.

#!/usr/bin/perl

use IO::Handle;

$Source = $ARGV[0];
$Dest = $ARGV[1];

unless($Dest) { die "Not enough arguments\n" };

$TheCmd = "sudo tethereal -i en0 -n -x -l -V udp port 500 " .
        "or proto 50 and host 165.227.249.$Source";

open(OUT, "$TheCmd |");

open(SAVE, ">$Source-$Dest.txt");

autoflush SAVE 1;

while(<OUT>) {
        print $_;
        print SAVE $_;
}

--Paul Hoffman, Director
--VPN Consortium