My favorites | Sign in
Project Logo
                
Feeds:
People details
Project owners:
  horton.nz

Usage

 

Usage: ./geoipgen [OPTION]... [COUNTRYCODE]...
IPv4 network tool for generating geotargeted IP addresses.

Features: Random or sorted order, unique or repeating ips, skips
broadcast addresses, uses MaxMind GeoLite Country database.

Target:
        COUNTRYCODE     One or more country codes, delimited by spaces
                        Use 'all' to target all country codes
                        Use -l to see the list
        -n NUM          Exits after NUM IPs

Unique or repeating:
        -u, --unique    Return each IP in the countries once only (default)
        --repeat        IPs can repeat with random order

Order:
        -s, --sorted    Order is sorted, ascending
        --random        Order is random (default)
        --less-random   Order is random seeming, returns each IP only
                        Provides significant performance gain when used with 'all'
                        countrycodes

Other:
        -h Help         This message
        -l, --list-countries  List countries and their country codes
        -c DIRECTORY    Location of GeoIPCountryWhois.csv database
                        Default locations: ./, /home/dc/.geoipgen/, /usr/local/share/
        -V, --version   Print version information. This version is 0.3
`
Examples: 
geoipgen nz             Each IP in New Zealand in a random order without repeating
geoipgen nz au          Each IP in New Zealand and Australia in a random order without
                        repeating

geoipgen --repeat -n 100 cn hk mn tw mo jp kr kp
                        100 random IPv4 addresses in Far East Asia.
                        It's faster to produce non-unique IPs with --repeat

geoipgen all            Produce each IP in the world, once only, in a random order.
                        Defaults to use less-random for lower memory overhead.

Notes

Uses the Max-Mind Free Open Source Geo-Lite Country database (www.maxmind.com).

It's slower the first time you generate a set of countries, the countrycode map files are created and saved in #{$OURDIR}. After the first time, the countrycode map is reused.

It's faster to use --repeat than to make a Bitfield to store whether each IP has been produced.

There is another geoIP database here http://software77.net/cgi-bin/ip-country/geo-ip.pl

How to dns resolve a country

This can aid in testing the accuracy of the Max-Mind location data by finding the presence of ip blocks that are potentially allocated to the wrong country. For example, if hostnames ending in .sk are found in a specific IP range belonging to New Zealand then that indicates the IP range allocation is incorrect.

For faster dns resolving, use an asynchronous resolver like adns.

Install GNU adns

Download and follow instructions from http://www.chiark.greenend.org.uk/~ian/adns/
or
sudo apt-get install libadns1-bin

Pipe IPs to adnsresfilter and only output resolved IPs

./geoipgen nz | adnsresfilter -w -a | egrep "\[.*\]"

Example Output

	125-238-151-47.broadband-telecom.global-gateway.net.nz[125.238.151.47]
	161-65-114-241.ip.fx.net.nz[161.65.114.241]
	c0.d0.33.static.xlhost.com[209.51.208.192]
	203-114-177-78.dsl.sta.inspire.net.nz[203.114.177.78]
	ds7a04.cc.waikato.ac.nz[130.217.64.150]

Credits

Authored by Andrew Horton (urbanadventurer) horton.nz at-nospam gmail.com

Thanks to Max-Mind for making their Geo-Lite Country database freely available.

Thanks to Peter Cooper for the use Bit Field Bitfield is MIT Licensed, (c) 2007 Peter Cooper (http://www.petercooper.co.uk/).









Hosted by Google Code