13.8. Eavesdropping

Sometimes you'd just like to listen in on the conversation between a browser and a server, like a gossip-hungry neighbor on a party line. Perhaps you're dealing with browsers whose caching behavior is questionable, and you don't want to guess what's really being fetched. You could use a connection-sniffing tool like tcpdump to monitor the traffic between the client and the server, but this generally requires superuser access to put the network interface into “promiscuous” mode. So try instead our proxylog tool:

 #!/usr/bin/perl -w use strict; use Getopt::Std; use IO::Socket; use IO::Select; sub usage { <<"EndUsage"; $0 lets you snoop on the conversation between a client and server. $0 -i clientport -o serverhost:port [-1] ...

Get Perl Debugged now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.