Sunday, 30 December 2012

wiki camcom milano - manual from casaleggio associati 2010

Wednesday, 5 December 2012

ban Asian ip addresses. Ban chinese spammers with htaccess

After receiving tons of spam on a few websites I've decided to ban the whole apnic addresses

Since I've not found anything to ban the whole APNIC I've searched for the assigned classes that they manage.
How to ban chinese spammers.

P.S. I've added a few LACNIC
(last update 2012-11-16)

Download here the file or just add the content in a .htaccess file and the spam from the Asia should be gone.
Put the .htaccess in the main (or any other) folder of your website.
You can use the same approach to ban any other ipv4 address space.

__________.htaccess____________
#list retrieved from
#http://www.iana.org/assignments/ipv4-address-space/ipv4-address-space.txt

#Banning APNIC
deny from 1.0.0.0/8
deny from 14.0.0.0/8
deny from 27.0.0.0/8
deny from 36.0.0.0/8
deny from 39.0.0.0/8
deny from 42.0.0.0/8
deny from 43.0.0.0/8
deny from 49.0.0.0/8
deny from 58.0.0.0/8
deny from 59.0.0.0/8
deny from 60.0.0.0/8
deny from 61.0.0.0/8
deny from 101.0.0.0/8
deny from 103.0.0.0/8
deny from 106.0.0.0/8
deny from 110.0.0.0/8
deny from 111.0.0.0/8
deny from 112.0.0.0/8
deny from 113.0.0.0/8
deny from 114.0.0.0/8
deny from 115.0.0.0/8
deny from 116.0.0.0/8
deny from 117.0.0.0/8
deny from 118.0.0.0/8
deny from 119.0.0.0/8
deny from 120.0.0.0/8
deny from 121.0.0.0/8
deny from 122.0.0.0/8
deny from 123.0.0.0/8
deny from 124.0.0.0/8
deny from 125.0.0.0/8
deny from 126.0.0.0/8
deny from 133.0.0.0/8
deny from 150.0.0.0/8
deny from 153.0.0.0/8
deny from 163.0.0.0/8
deny from 171.0.0.0/8
deny from 175.0.0.0/8
deny from 180.0.0.0/8
deny from 182.0.0.0/8
deny from 183.0.0.0/8
deny from 202.0.0.0/8
deny from 203.0.0.0/8
deny from 210.0.0.0/8
deny from 211.0.0.0/8
deny from 218.0.0.0/8
deny from 219.0.0.0/8
deny from 220.0.0.0/8
deny from 221.0.0.0/8
deny from 222.0.0.0/8
deny from 223.0.0.0/8
__________end of .htaccess____________

Don't do it if you have contents that should be available to Asian people.
I'm not racists but the contents of my website is not intended for asian people and any asian person can understand that I'm just cutting down the spam in websites where the content is not supposed to be read by non eu persons.

You can also redirect the persons to other pages (ex. a form).