/usr/share/doc/libhttp-proxy-perl/examples/tracker.pl is in libhttp-proxy-perl 0.304-3.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #!/usr/bin/perl -w
use HTTP::Proxy;
use HTTP::Proxy::HeaderFilter::simple;
use Fcntl ':flock';
use strict;
# this is a tracker proxy that stores Referer, URL, CODE
# and output them to STDOUT or the given file
#
# Example output:
#
# NULL http://www.perl.org/ 200
# http://www.perl.org/ http://learn.perl.org/ 200
#
my $file = shift || '-';
open OUT, ">> $file" or die "Can't open $file: $!";
my $proxy = HTTP::Proxy->new( @ARGV ); # pass the args you want
$proxy->push_filter(
response => HTTP::Proxy::HeaderFilter::simple->new(
sub {
my ( $self, $headers, $message ) = @_;
flock( OUT, LOCK_EX );
print OUT join( " ",
$message->request->headers->header( 'Referer' ) || 'NULL',
$message->request->uri,
$message->code ), $/;
flock( OUT, LOCK_UN );
}
)
);
$proxy->start;
END { close OUT; }
|