Proxy trace headers

Proxy trace headers

Post by Cameron Ker » Thu, 17 Jun 2004 03:28:17



Hello, I've made myself a small Perl program to trace which proxies are
being used to service various HTTP requests, and would like to know what
HTTP headers, other than x-cache and x-cache-lookup are inserted by
proxies (so far, I have only encountered Squid).

I'd post it on my website, but it currently won't let me in, so I've
stuck it below. It's still in its early stages, in that it's output
needs to be tidied up a bit.

$ pxytrace
Proxy detected
x-cache: MISS from proxy2.akl1.maxnet.net.nz
x-cache: MISS from belgarath.localdomain

$ pxytrace -a -u http://slashdot.org/
link = ARRAY(0x82f5790)
slash-log-data = shtml
connection = close
x-powered-by = Slash 2.003000
client-response-num = 1
cache-control = private
date = Tue, 15 Jun 2004 22:16:37 GMT
client-peer = 66.35.250.150:80
client-date = Tue, 15 Jun 2004 22:16:47 GMT
pragma = private
content-type = text/html; charset=iso-8859-1
title = Slashdot: News for nerds, stuff that matters
x-cache-lookup = MISS from belgarath.localdomain:3128
Proxy detected
x-cache: MISS from proxy1.akl1.maxnet.net.nz
x-cache: MISS from belgarath.localdomain
x-cache = ARRAY(0x81d3eec)
server = Apache/1.3.29 (Unix) mod_gzip/1.3.26.1a mod_perl/1.29
x-fry = Hey look, it's that guy you are!

Any help would be appreciated.

---- pxytrace ----
#!/usr/bin/perl -w
#
# Are we subject to a transparent proxy? If so, where is it?
# This is done by looking using the online proxy-detection service.
#
# Cameron Kerr
# 12 June 2004

use strict;
use Getopt::Std;
use LWP::UserAgent;
use Data::Dumper;

my $deturl = 'http://www.google.com/';
my $usage = "Usage: pxydetect-trans [-q] [-a] [-u URL]\n" .
    "   -q (Quiet), -a (Print all headers), -u (URL to request)\n";

my %opts;
getopts "qu:a", \%opts or die $usage;

$deturl = $opts{'u'} if defined $opts{'u'};

my $ua = LWP::UserAgent->new;
$ua->agent("Proxy Detector");
$ua->env_proxy;

my $req = HTTP::Request->new( GET => $deturl );
my $res = $ua->request($req);

my $foundproxy = 0;

if( $res->is_success ) {
    foreach my $header (keys %{$res->headers}) {
        my $value = $res->headers->{$header};

            $foundproxy++;
            print "Proxy detected\n" unless $opts{'q'};
            if( ref($value) eq "ARRAY" ) {

                    print $header, ": ", $i, "\n";
                }
            } else {
                print $header, ": ", $value, "\n";
            }
        }
        print $header, " = ", $value, "\n" if $opts{'a'};
    }
    exit 0 if $foundproxy;
    print "No proxy detected\n";
    exit 1

Quote:} else {

    die $res->status_line . "\n";

Quote:}

die "Should not have gotten here\n";
------------------

--
Cameron Kerr

Empowered by Perl!

 
 
 

1. Tracing sender from message with forged header

Thanks to the people in this newsgroup, I've found out about the
wonderful tools, such as dig, nslookup, and traceroute, that can
be used to trace back the origin of a UCE/spam with a forged
header. So, these tools let you trace the message back to the
domain from which it was sent... Now, is there any way to
actually find out the actual sender, perhaps from the Message-ID
or SMTP id info in the header?

--
"The society which scorns excellence in plumbing as a humble activity
and tolerates shoddiness in philosophy because it is an exalted activity
will have neither good plumbing nor good philosophy ...  neither its
pipes nor its theories will hold water."
         ===============================================
         + http://personal.riverusers.com/~thegrendel/ +
         ===============================================

2. How to let apache work on diffirent port with diffrent id

3. IP header traces

4. autoconf/automake to compile and produce an object module file

5. 441 Can't set system "X-Trace" header

6. Linux w/ Hard Drive Boot Sector Utility

7. Headers, Headers, whos got the Headers

8. Recovert from corrupt harddrive

9. Tracing proxy connections with Apache

10. Apache Proxy: Filtering *request* headers

11. How I trace back SIGSEGV etc. (was: Re: SIGSEGV trace)

12. can proxy add headers

13. Apache proxy and HTTP header