PDA

View Full Version : Proxy Detector


Takara
05-06-2002, 04:26 AM
NOTE: I didnt have the patience to wait a day for someone else to do it, lol. So i did it myself https://vborg.vbsupport.ru/showthread.php?s=&threadid=38358

The basis for this hack is that when mods/admins click on the link to see the persons IP (assuming they have IPs logged, but only viewable to mods/admins) it will tell them if the person is using a proxy, and if they are it will tell you the real IP of the person.

How? Well as some of you may know, most proxys send out an additional header $HTTP_X_FORWARDED_FOR . This gives the real IP of the person. For example, right now I am using rogers default user proxy, my environmental variables would read:

$REMOTE_ADDR 66.185.84.198
$HTTP_X_FORWARDED_FOR 24.100.4.29

So, when posting, the php would do something like
if ($HTTP_X_FORWARDED_FOR) {
//insert into sql table etc
}

Then somewhere in the inner workings of the vb code, it would check if there is data in that sql table, if there is then it would display the IP. This could be done in the IP viewing php, or as I thought origionally somewhere in the post on the left side under the username etc.

Anyone want to help me with this? I can do the php, but I dont know what vb scripts to edit (or you can just do it all yourself :p)

Thanks ^_^ :bunny: (kawaii bunny, hehe)

Keyser S?ze
05-06-2002, 05:17 AM
to add to that, proxy detecter that checks their real IP and if that IP is banned bans them

i have alot of lamers that i IP ban and they come back with a proxy to cause trouble

Takara
05-06-2002, 06:44 AM
If anyone could get me started on what files I would start to look at for this I can do it myself ^^

Ren
05-06-2002, 04:28 PM
sweet idea ..I would love that feature!!

Demascus
05-06-2002, 05:10 PM
so would i

RDX1
05-06-2002, 07:09 PM
how can i test this on my page? i would like to test a proxy, but not sure how i would do that using ssi, or php

Takara
05-06-2002, 08:28 PM
Eurgh, if anyone is willing to give me a hand, point out where I have to do each thing, or just some general guidance please PM me.

heretic
05-06-2002, 08:43 PM
This would be good- maybe not ban them, but have a little icon next to their name in the postbit that shows it's a proxy..

(some people use proxys to surf the web when at work- bypasses stupid filters)

Takara
05-06-2002, 09:04 PM
Uh huh Heretic, thats what I was thinking

heretic
05-06-2002, 09:52 PM
k, so you need something that referes to the IP every time.

the only issue that gets me is how to use the header information, i.e. HTTP_X_FORWARDED_FOR

Takara
05-06-2002, 10:21 PM
Lets see, the files we would have to edit would be, newreply.php and newpost.php

First, I guess we would have to add another column to our 'post' table.. we would execute this mysql query:


ALTER TABLE post ADD proxyip VARCHAR(16) not null AFTER ipaddress


in newthread.php find
if ($logip==1 or $logip==2) {
$ipaddress=iif(getenv("REMOTE_ADDR")!="",getenv("REMOTE_ADDR"),$HTTP_HOST);
} else {
$ipaddress="";
}

And change it to
if ($logip==1 or $logip==2) {
$ipaddress=iif(getenv("REMOTE_ADDR")!="",getenv("REMOTE_ADDR"),$HTTP_HOST);
if (getenv("HTTP_X_FORWARDED_FOR")!="") {
$proxyip=getenv("HTTP_X_FORWARDED_FOR");
}
}
} else {
$ipaddress="";
$proxyip="";
}

That should get $proxyip set. I'm not quite sure how iff works, but if I'm not mistaken instead of using
if (getenv("HTTP_X_FORWARDED_FOR")!="") {
$proxyip=getenv("HTTP_X_FORWARDED_FOR");
}

would it be:
$proxyip=iif(getenv("HTTP_X_FORWARDED_FOR")!="",getenv("HTTP_X_FORWARDED_FOR"));

Can someone confirm it?

Now we have to add it to the sql table...

RDX1
05-06-2002, 11:33 PM
<? echo $HTTP_X_FORWARDED_FOR; ?>

would this work for a normal page to display the real address?

Takara
05-06-2002, 11:44 PM
Yes, if they were using a proxy that gave out that variable. Most proxys do, some dont.

use this btw:

<?=$HTTP_X_FORWARDED_FOR;?>

Easyer way to echo out stuff

heretic
05-07-2002, 12:18 AM
have you tested this out yet?

Takara
05-07-2002, 12:38 AM
No, hehe. Its not done. I'm just, starting it out hoping someone else will jump in and help some. Here is the next part I supose

in newthread.php still, find:
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,at tachmentid,pagetext,allowsmilie,showsignature,ipad dress,iconid,visible) VALUES (NULL,'$threadid','".addslashes(htmlspecialchars($subject))."','".addslashes($postusername)."','$bbuserinfo[userid]','".time()."','$attachmentid','".addslashes($message)."','$allowsmilie','$signature','$ipaddress','$iconi d','1')");

Replace by:
$DB_site->query("INSERT INTO post (postid,threadid,title,username,userid,dateline,at tachmentid,pagetext,allowsmilie,showsignature,ipad dress,proxyip,iconid,visible) VALUES (NULL,'$threadid','".addslashes(htmlspecialchars($subject))."','".addslashes($postusername)."','$bbuserinfo[userid]','".time()."','$attachmentid','".addslashes($message)."','$allowsmilie','$signature','$ipaddress','$proxy ip','$iconid','1')");

Ok, I think thats basically it that has to be done in newthread.php. The proxy IP, if there is now inserted into there.

Now I'll take a look at newreply.php, as there will be stuff to edit in there. Also I'm unsure about how it will effect other sql queries, since there is now another column in there. I'll look at, edit post, and a fiew more things to see if the post template is modified anywhere else.

heretic
05-07-2002, 12:54 AM
the only thing is when users try to find the query, they might not find it if they've added hacks that add there.

I'm not much help php-wise, I'm learning myself

also, I think if we're going the way of adding some kind of proxy icon in the postbit, don't you have to define it in functions.php?

Takara
05-07-2002, 01:03 AM
umm, I dunno T_T

Thats why I need more help. lol

I'm going to put what I think all of it is into a text file, then let someone look at it. Maybe they could help

Takara
05-07-2002, 01:44 AM
Okie, I've taken a look at everything. And the only modifications for getting the proxy IP is done. Aswell it wont interfer with other sql queries. But if you have another hack installed you have to adjust the one line thats listed in there.

Now, what I want is to make it so that you have to edit the postbit template, and under the posts add something like '$proxydetector'

if there is something in the the sql column proxyip, then it will print out something determined via a template, if not it wont return anything.

Problem is is that I dont know anything about templates. Can someone help me from here. I attached what I managed sofar.

Takara
05-07-2002, 07:53 AM
Ah well, no one helped (except heretic) so I ended up learning more about templates etc. I figured it all out and will be releasing a version tommorow.

Thanks ppl ^_^ :bunny:

I managed to get it together alredy: https://vborg.vbsupport.ru/showthread.php?s=&threadid=38358