You are missing our premiere tool bar navigation system! Register and use it for FREE!

NukeCops  
•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
Modules
· Home
· FAQ
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· PHP-Nuke HOWTO
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 246 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
Nuke Cops :: View topic - Possible to Block All IP Addresses Outside United States [ ]
 Forum FAQ  •  Search  •   •  Memberlist  •  Usergroups   •  Register  •  Profile •    •  Log in to check your private messages  •  Log in

 
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
Author Message
DivotMaker
Nuke Soldier
Nuke Soldier


Joined: Sep 05, 2004
Posts: 29


PostPosted: Wed Oct 13, 2004 7:20 am Reply with quoteBack to top

I run a very small website and the only users coming to it are from the state I live in. I'm trying to figure out if it's possible to block all IP addreses from everywhere except the U.S. I can't seem to find a list anywhere that shows what ranges are used inside/outside the U.S., or if one even exists. Thanks for any help.
Find all posts by DivotMakerView user's profileSend private message
FreeBee
Sergeant
Sergeant


Joined: Aug 26, 2004
Posts: 75


PostPosted: Wed Oct 13, 2004 8:20 am Reply with quoteBack to top

And what if i use a US proxy ?
Find all posts by FreeBeeView user's profileSend private message
DivotMaker
Nuke Soldier
Nuke Soldier


Joined: Sep 05, 2004
Posts: 29


PostPosted: Wed Oct 13, 2004 8:23 am Reply with quoteBack to top

I don't allow proxied requests on my site.

FreeBee wrote:
And what if i use a US proxy ?
Find all posts by DivotMakerView user's profileSend private message
Evaders99
Site Admin
Site Admin


Joined: Aug 17, 2003
Posts: 12482


PostPosted: Wed Oct 13, 2004 9:27 am Reply with quoteBack to top

I think the ranges are too numerous for you to really do that.

_________________
Helping those that help themselves
Read FIRST or DIE!

"Fighting is terrible, but not as terrible as losing the will to fight."
Star Wars Rebellion Network - Need Help? Evaders Squadron Coding
Find all posts by Evaders99View user's profileSend private messageVisit poster's websiteAIM Address
DivotMaker
Nuke Soldier
Nuke Soldier


Joined: Sep 05, 2004
Posts: 29


PostPosted: Wed Oct 13, 2004 9:34 am Reply with quoteBack to top

Thanks for replying.

Evaders99 wrote:
I think the ranges are too numerous for you to really do that.
Find all posts by DivotMakerView user's profileSend private message
oprime2001
Lieutenant
Lieutenant


Joined: Jul 13, 2003
Posts: 165


PostPosted: Wed Oct 13, 2004 12:12 pm Reply with quoteBack to top

Is the converse possible? That is, only ALLOW IPs from USA? That would definitely be a smaller set of IP/ranges.
Find all posts by oprime2001View user's profileSend private message
clam729
Sergeant
Sergeant


Joined: Aug 18, 2003
Posts: 82


PostPosted: Wed Oct 13, 2004 10:34 pm Reply with quoteBack to top

yes, it is very easy.

1. download and insert a 'ipcountry' csv into your mysql db. the csv file contains all the ip ranges for all the countries.

2. add code like this to your mainfile.php - note, the code below only displays the country code. you will have to write your own checks/bans/blocks/redirects/etc.

Code:
$dbh = mysql_connect( "localhost:3306", "$MYSQL_USERNAME", "$MYSQL_PASSWORD" );
mysql_select_db( "$MYSQL_DBNAME" );
// Query for getting visitor countrycode
$country_query = "SELECT fromip, toip, country FROM ipcountry " . "WHERE fromip<=inet_aton('$REMOTE_ADDR') " . "AND toip>=inet_aton('$REMOTE_ADDR') ";
// Executing above query
$country_exec = mysql_query( $country_query );
// Fetching the record set into an array
$ccode_array = mysql_fetch_array( $country_exec );
// getting the country name from the array
$country_name = $ccode_array['country'];
// Display the Visitor coountry information
echo "$country_name";
// Closing the database connection
mysql_close( $dbh );


hopefully this will get you on the right track. pm me if you want me to email you the csv (if you cant google it), it contains 50,000+ rows of country ranges
Find all posts by clam729View user's profileSend private message
MGCJerry
Elite Nuker
Elite Nuker


Joined: Jun 16, 2003
Posts: 220


PostPosted: Thu Oct 14, 2004 3:32 am Reply with quoteBack to top

Instead of "banning" IPs, it would be much easier to "allow" them via htaccess...

Code:

order deny,allow
deny from all
allow from ***.***.***.***


This will ban ALL IPs first, then you can allow from specific IP ranges.

_________________
Original creator of
* Fetch Mod
* RPG Races Module
* 2 The Xtreme Theme
Find all posts by MGCJerryView user's profileSend private message
DivotMaker
Nuke Soldier
Nuke Soldier


Joined: Sep 05, 2004
Posts: 29


PostPosted: Thu Oct 14, 2004 6:45 am Reply with quoteBack to top

This all makes sense, only I don't know where to find the ip ranges for all the countries...Anyone know where to find that?
Find all posts by DivotMakerView user's profileSend private message
dmolavi
Sergeant
Sergeant


Joined: Mar 14, 2003
Posts: 79


PostPosted: Thu Oct 14, 2004 7:48 am Reply with quoteBack to top

you can grab the following files:

ftp://ftp.apnic.net/pub/stats/arin/latest
ftp://ftp.apnic.net/pub/stats/apnic/delegated-apnic-latest
ftp://ftp.apnic.net/pub/stats/lacnic/delegated-lacnic-latest
ftp://ftp.apnic.net/pub/stats/ripe-ncc/_ripencc.latest

then search for IPv4 entries with US assigned codes. Note that since ranges are not always contiguous, you will have to do alot of file parsing on your own.
i have a db set up for this module:
http://www.nukedgallery.net/modules.php?name=IPBan
that does lookups,etc for what country an IP is in. you've got your work cut out for ya Wink

_________________
Image
Find all posts by dmolaviView user's profileSend private messageVisit poster's website
UndergroundHydro
Lieutenant
Lieutenant


Joined: Nov 08, 2004
Posts: 199

Location: London, England

PostPosted: Fri Nov 19, 2004 11:22 am Reply with quoteBack to top

DivotMaker wrote:
This all makes sense, only I don't know where to find the ip ranges for all the countries...Anyone know where to find that?


I found a very handy utility (eXpress IP Locator (XIPL) v1.2.3) that allows you to select a country, and it will display all ip ranges allocated to that country.

Download it HERE

Now, I know Vietnam is the source of alot of internet fraud/blackmailing via ddos attacks etc, so they're in the bin staightaway, South Korea, China and Indonesia can join em Laughing but if anyone has any comments on other countries that it might be useful to ban entirely, then i'd appreciate your views.

I appreciate that I could potentially be cutting down traffic/customers to my site but the hydroponics shop side of my site ONLY ships to UK.

Traffic, well, obviously I don't want to limit my site too much, but i'm sure I wouldn't miss the traffic from some countries if it meant erasing a potential threat to my site and future revenue.

Also, regarding my Host.Deny file, anyone tell me how to add ranges to it?

Thanks.

Boston Green

_________________
[url=http://grooveclubradio.com]
Image
[/url]
Find all posts by UndergroundHydroView user's profileSend private messageVisit poster's website
MrGunnage
Sergeant
Sergeant


Joined: Aug 28, 2004
Posts: 78


PostPosted: Thu Dec 09, 2004 12:53 am Reply with quoteBack to top

To add ranges you simply use an asterisk, same as HTACCESS Like
12.82.55.3 - One IP
12.82.55.* - 12.82.55.0 - 12.82.55.255
12.82.* - 12.82.0.0 - 12.82.255.255

And so on

_________________
KATO Clan Leader
http://www.kato-clan.com
Creator of Simple CMS:
http://simplecms.kato-clan.com
Find all posts by MrGunnageView user's profileSend private messageVisit poster's website
UndergroundHydro
Lieutenant
Lieutenant


Joined: Nov 08, 2004
Posts: 199

Location: London, England

PostPosted: Thu Dec 09, 2004 2:05 am Reply with quoteBack to top

Sorry, shoulda posted to say i've worked it out, but thanks for your reply MrGunnage.
Find all posts by UndergroundHydroView user's profileSend private messageVisit poster's website
Display posts from previous:      
Post new topic  Reply to topicprinter-friendly view
View previous topic Log in to check your private messages View next topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Powered by phpBB © 2001, 2005 phpBB Group

Ported by Nuke Cops © 2003 www.nukecops.com
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::
Powered by TOGETHER TEAM srl ITALY http://www.togetherteam.it - DONDELEO E-COMMERCE http://www.DonDeLeo.com - TUTTISU E-COMMERCE http://www.tuttisu.it
Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.860 Seconds - 182 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded (www.nukemods.com) ::