English Proxy Detector

17 replies
Goto Page
To the start Previous 1 Next To the start
10.03.12 03:58:50 pm
Up
Apache uwu
User
Offline Off
--testing is over--

Thanks to everyone who participated.

As said, I will release the source, it's not impressive, but it's nice to filter out most of the open proxies.

Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
     function is_proxy($ip) {
          if (file_exists("safe/".$ip)) {
               return false;
          } elseif (file_exists("unsafe/".$ip)) {
               return true;
          }
          $raw=file_get_contents("http://en.m.wikipedia.org/wiki/Special:BlockList?limit=1&wpTarget=".$ip,false,stream_context_create(array('http'=>array('method'=>"GET",'header'=>"User-Agent: PHP\r\n"))));
          if (strpos($raw,"The requested IP address or username is not blocked.")) {
               fclose(fopen("safe/".$ip, 'w'));
               return false;
          }
          fclose(fopen("unsafe/".$ip, 'w'));
          return true;
     }
     if (is_proxy($_SERVER["REMOTE_ADDR"])) {
          echo "You have been detected as an open proxy, if you believe this is an error please contact the site administrator.";
     } else {
          echo "Welcome! Site content will be shown here.";
     }
?>


If you are a proxy it should indicate that you aren't allowed to use this website, and if not it should show a welcome message.
edited 1×, last 10.03.12 10:29:23 pm
10.03.12 04:01:22 pm
Up
Yates
Reviewer
Offline Off
Works. Can't access it.
10.03.12 04:05:01 pm
Up
DannyDeth
User
Offline Off
Works, I can see the content.
10.03.12 04:25:43 pm
Up
Mechanolith
User
Offline Off
Works, i can see the welcome stuff.
10.03.12 04:48:30 pm
Up
MAX-russia
User
Offline Off
It works bro !
10.03.12 05:11:14 pm
Up
Big Bang Mafia
User
Offline Off
works perfect.
I'm back.
10.03.12 06:17:19 pm
Up
0a
User
Offline Off
So I guess, you've blacklisted some of proxy servers? Because I can acess it with some lesser-known proxy servers.
10.03.12 06:25:02 pm
Up
Yates
Reviewer
Offline Off
He blocked Opera proxy.
10.03.12 06:46:03 pm
Up
oxytamine
User
Offline Off
Does not work, I got access to the web-site using proxy server.
10.03.12 09:32:38 pm
Up
ThunderByte
User
Offline Off
I can access with proxy server.
10.03.12 10:27:34 pm
Up
Apache uwu
User
Offline Off
Well of course there is no fool-proof method, a proxy server is just a normal computer.
10.03.12 11:03:47 pm
Up
ThunderByte
User
Offline Off
Thx for sharing the source code! Its good against transparent proxies.
10.03.12 11:06:33 pm
Up
oxytamine
User
Offline Off
Bad user agent you have here, bro.
10.03.12 11:07:33 pm
Up
Apache uwu
User
Offline Off
Wikipedia throws a 403-forbidden if I don't provide one.
10.03.12 11:20:19 pm
Up
oxytamine
User
Offline Off
But your one is bad.
Code:
1
Googlebot/2.1 (+http://www.google.com/bot.html)

Use this.
Spoiler >
10.03.12 11:23:35 pm
Up
Apache uwu
User
Offline Off
I don't see how getting the real ip is relevant, unless you're comparing it to the request.

ex. if real_ip does not equal remote_addr then act as if it were a proxy

As for the user_agent, it doesn't matter either √
10.03.12 11:25:44 pm
Up
oxytamine
User
Offline Off
user Apache uwu has written:
As for the user_agent, it doesn't matter either √

It does matter a lot. It's much easier to spam/brute-force using Google's user agent.
10.03.12 11:28:54 pm
Up
Apache uwu
User
Offline Off
They get billions of requests a day, I doubt it matters, besides my php script uses HTTP 1.0, where as google does not.
To the start Previous 1 Next To the start