Jump to content

IP Ranges


TriumphTalk
 Share

Recommended Posts

It probably isn't the quickest way, but I look up IP addresses at the whois at arin.net. They tell you whether it belongs to Asia, Europe, etc. Then you can look up on RIPE (Europe), etc. Usually they give a range. Or you can just block that whole range of IP addresses if it is not from an area where you might have legitimate people interested in your website - particularly if variations within the range keep trying to post spam. Or you can just block that IP address.

It seems to me there was another topic recently where the poster found a solution - yes, here it is. Don't know if it is the same situation or not, but perhaps there is something else there.

Thank´s for all help, you are showing me the right way. I attack the security problem of PHP-nuke using a security module for apache web server, your name is mod security and i find it in http://www.modsecurity.org. This module filter bad requests to PHP and other http requests. I make a few tests and the results is aparentely good. I will continuing testing...

Miss Betsy

Link to comment
Share on other sites

It probably isn't the quickest way, but I look up IP addresses at the whois at arin.net. They tell you whether it belongs to Asia, Europe, etc. Then you can look up on RIPE (Europe), etc. Usually they give a range. Or you can just block that whole range of IP addresses if it is not from an area where you might have legitimate people interested in your website - particularly if variations within the range keep trying to post spam. Or you can just block that IP address.

It seems to me there was another topic recently where the poster found a solution - yes, here it is. Don't know if it is the same situation or not, but perhaps there is something else there.

Miss Betsy

At this stage I am also doing it manually. I have picked up a trend in the way IP are acting on my board and then I do a IP whois search if it is a non English type country I just ban that whole range before they can eve register. How ever it would be easer if I could find some type of list that would just allow me to ban those countries that I would not want on my board in advance.

Link to comment
Share on other sites

Is there a list any place that I can get the IP ranges of different countries like

203.133 – Asia and so on

Not to worry I think this thread will give me what I am looking for

Clicky

Had a look at the other thread and I think I have some information that it doesn't supply.

If you have perl, you can do it quickly with no DNS lookups using the IP::Country::Fast CPAN module

Sample code:

#!/usr/bin/perl

use strict;
use warnings;
use IP::Country::Fast;

my $reg = IP::Country::Fast->new();

my [at]input = [at]ARGV;
if (![at]input)
{
		print "Usage: jwhereis host [host] [host]...\n";
						exit;
								}

foreach my $ip ([at]input) {
		my $cc = $reg->inet_atocc($ip) || "XX";
		print "$ip - $cc\n";
}

Alternatively, the zz.countries.nerd.dk can be used in a DNSBL style lookup to return answers that map to country ISO codes. the following example uses a Google IP address.

dig 104.59.239.216.zz.countries.nerd.dk

; <<>> DiG 9.3.1 <<>> 104.59.239.216.zz.countries.nerd.dk
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 14348
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 3, ADDITIONAL: 3

;; QUESTION SECTION:
;104.59.239.216.zz.countries.nerd.dk. IN		A

;; ANSWER SECTION:
104.59.239.216.zz.countries.nerd.dk. 2100 IN A  127.0.3.72

;; AUTHORITY SECTION:
countries.nerd.dk.	  6665	IN	  NS	  michelin.bananas.dk.
countries.nerd.dk.	  6665	IN	  NS	  countries.pil.dk.
countries.nerd.dk.	  6665	IN	  NS	  countries-ns.mdc.dk.

;; ADDITIONAL SECTION:
michelin.bananas.dk.	5759	IN	  A	   194.255.237.134
countries.pil.dk.	   1608	IN	  A	   83.90.248.118
countries-ns.mdc.dk.	66	  IN	  A	   193.189.92.58

127.0.3.72 maps to "us" on the listing found here. Code for implementing this to map an IP to a country code is a bit long to post here, but anybody wanting an example can PM me.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...