Web Hosting Talk







View Full Version : How to ban like china/iran/ etc?


Hands-on Mark
02-02-2006, 05:55 PM
I saw somewhere in someone's thread, they had a proxy site I think. They, in their .htaccess somehow banned everyone except the USA. Does anyone know of how I could get a list like that?

Thanks.

Patrick
02-02-2006, 09:06 PM
I'm sorry this isn't that helpful, but have you looked at http://www.hotscripts.com for something like a Country blocker?

... other then a custom script which does a bunch of lookups or blocking tons of subnets, that's the only way I can think of...

Hands-on Mark
02-02-2006, 09:15 PM
No results were found
Click here to do an Advanced Search

:|

Patrick
02-02-2006, 09:43 PM
No results were found
Click here to do an Advanced Search

:|

Well, I wish I could be more of a help... but do a Google on "htaccess ban an entire country" and you'll find some solutions... not the best ones, but non the less still solutions.

Hands-on Mark
02-02-2006, 10:14 PM
Still can't find the thread I am looking for. Wanted to ask the person how they did it / would they mind sharing the IP's.

the_pm
02-02-2006, 10:18 PM
Couldn't you ban any IP under APNIC or RIPE jurisdiction? Allowing ARIN IPs only would get you pretty close to your desired goal.

Hands-on Mark
02-02-2006, 11:40 PM
The_pm, I don't understand what you mean. I guess I don't understand IP's that well.

Mr.Muffinman
02-02-2006, 11:50 PM
I -think- he means by choosing IP's that are in the region. Like -most- ips from UK, i belive have 194.xxx.xxx.xxx something around there. He is saying go for a ball park in that area by region ips.

Again, I am not sure...Feel free to correct me as you wish.

the_pm
02-02-2006, 11:51 PM
The_pm, I don't understand what you mean. I guess I don't understand IP's that well.I'm not entirely an expert either, but my understanding is that IP ranges are apportioned to a handful of registries around the world - http://www.arin.net/community/index.html

ARIN only deals with IPs for North America. So, if you can write a script that can identify the registry responsible for for an IP, you can prevent all but ARIN IPs from viewing a site. There are many types of IP tools that return this information as part of their functions (whois, to name one). So, if you know precisely how to extract this information, you could test every visiting IP and allow/disallow based on the result.

Hands-on Mark
02-03-2006, 01:21 AM
I think the best way to do it would be just getting a list and doing it with .htaccess.

Searched google for a long time, couldn't get anything.

the_pm
02-03-2006, 01:25 AM
Well, the end result of such a script would be to write the IP/IP range into an Allow/Deny range within .htaccess. If the script can be written without too much difficulty, you could save yourself trying to come up with such a list, as everything would be automated. Of course, if the lists exist, then you're right, you may as well use them. It won't stop someone who is spoofing IPs, but this is pretty rare anyway.

Hands-on Mark
02-03-2006, 10:26 PM
Does anyone know the website that has like a black backround and yellow-ish text that lists ALL the IP's? Then there are categories like china and whatever. Saw it a long time ago but don't have the bookmark.


....

http://www.google.com/search?hl=en&lr=&q=ban+china+ip%27s&btnG=Search

lol WHT is crazy in rankings.

FHDave
02-03-2006, 10:44 PM
If you ban China, you ban 20% of world populations from reaching your site, ever ....
And together with Iran, that would be 21.5% :D

Hands-on Mark
02-03-2006, 11:11 PM
So what. They leech my bandwidth and make 1-2 pennies per click. They upload porn. I want to ban them.