#!/usr/bin/perl #Simple program to give me my IP address wherever I am. #Also extended to give other stuff sent by the browser. use Socket; print "Content-Type: text/plain\r\n\r\n"; #CGI carp print "Referer: $ENV{HTTP_REFERER}\r\n"; #Referrer (designers of HTTP can't spell) print "User Agent: $ENV{HTTP_USER_AGENT}\r\n"; #Browser software print "Address: $ENV{REMOTE_ADDR}\r\n"; #IP address of peer $addr = inet_aton($ENV{REMOTE_ADDR}); $name = gethostbyaddr($addr, AF_INET); print "Hostname: $name\r\n"; #Hostname of peer print "Server: $ENV{SERVER_SOFTWARE} at $ENV{SERVER_NAME}\r\n"; #Server information