Log All Ip's of visitors

By Ivanalicius on Mar 19, 2008

This scripts log all IP's of visiors who came to ur site using proxy

#!/usr/bin/perl
# This scripts log all IP's of visiors who came to ur site using proxy 
# Setup: use SSI (if dont what hell it is check out www.apache.org's faq
# or use image example: <img src="http://www.mysite.com/cgi-bin/proxylog.pl">
use Socket;
$pic_url = "http://www.aol.com/gr/homepage/logo.gif";
if(!$ENV{'REMOTE_ADDR'}) { print "Not http requestn"; exit(0);}
my($rhost,$i,$paddr,$sux);
$rhost = $ENV{'REMOTE_ADDR'};
@ports = (1080,3128,8080);
open(DB,">>log.txt");
for($i=0;$i<=2;$i++) {
socket(SOCKET, PF_INET, SOCK_STREAM, getprotobyname('tcp'));
$paddr  = sockaddr_in($ports[$i],inet_aton($rhost));
if (connect(SOCKET, $paddr)) {
open(DB1,"log.txt");
while(<DB1>){
($addr,$port) = split(':',$_);
if($rhost eq $addr){
$sux = 1;}
}
close DB1;
if($sux !=1){
print DB "$rhost:$ports[$i]n";
}
close (SOCKET);
}
else {
close (SOCKET);
}}
close DB;
print "Location: $pic_url nn";

Comments

Sign in to comment.
Jonesy44   -  Mar 30, 2008

lol, you\'re welcome =P

 Respond  
Ivanalicius   -  Mar 20, 2008

thanks for note jonsey :]

 Respond  
Jonesy44   -  Mar 19, 2008

Using my extrodinare technical skills, i have noticed one tiny error;

# Setup: use SSI (if dont what hell is it check out 

should be :

# Setup: use SSI (if dont what hell **it is** check out 
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.