Results 1 to 2 of 2

Thread: htaccess blocking on a per country

  1. #1
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,193
    Blog Entries
    8

    Default htaccess blocking on a per country

    I discovered this somewhat recently...

    http://ip-to-country.webhosting.info/book/print/5

    Its a list of all the IP codes around the world and to which physical country they belong. So I wrote a perl script to convert the CSV file and a set of named countries into a list of htaccess blocking codes. So I can block my website to people and proxies from a particular country.

    I thought the link interesting enough to post - if you want the perl script then shout below. Its not extremely well tested but I dont appear to be having as much ukraine / latvian hacks since I added it. Though I am not known for posting code, I thought this one good to share if required and maybe if enough people took a more proactive filtering of their sites then maybe they would have less ability to hit them so much - wishful thinking I am sure !

  2. #2
    Administrator Redrobes's Avatar
    Join Date
    Dec 2007
    Location
    England
    Posts
    7,193
    Blog Entries
    8

    Default

    Just revisiting this in the wake of the jersey spam... You can download the latest IP to country conversions from here.

    ftp.arin.net/pub/stats/arin/delegated-arin-latest
    ftp.ripe.net/ripe/stats/delegated-ripencc-latest
    ftp.afrinic.net/pub/stats/afrinic/delegated-afrinic-latest
    ftp.apnic.net/pub/stats/apnic/delegated-apnic-latest
    ftp.lacnic.net/pub/stats/lacnic/delegated-lacnic-latest

    The format is documented in this ftp://ftp.arin.net/pub/stats/arin/README

    the apnic one being the most relevant I think

    I am sure that this format is the same as the one I have a perl script to convert into Apache mod redirect regex code if required.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •