Last modified: 2006-09-09. Latest version of this document is: http://www.iki.fi/karvinen/wheretero.html

Wheretero - detect country from network information

Wheretero determines the country where the local computer is. This allows automatic keyboard layout configuration for live-CDs.

Network information is collected from DNS, DHCP, traceroute, GeoIpLookup and web IP address service. Information is scored and scaled. Wheretero prints final decission as a two letter ISO country code, such as fi, de, fr or us. Secondary choices are printed also with probabilty estimations.

Contents

News

2006-09-09: Wheretero 0.4: Major feature enhancements: Geoiplookup, web ip service. More readable output. Up to 10x faster than 0.2. Code cleanup.

Screenshots

Where am I?

$ wheretero
[...]
fi

Automatically configure keyboard layout:

$ setxkbmap $(wheretero |tail -1)

$ wheretero
address         fqdn    suffix  geo     # Wheretero 0.4
=== /etc/resolv.conf ===
(search)        systemsomething.fi     fi (fi+10=10)
124.23.172.172  ns.systemsomething.fi  fi (fi+10=20)   fi (fi+10=30)
124.23.174.174  ns2.systemsomething.fi fi (fi+10=40)   fi (fi+10=50)
=== /var/lib/dhcp3/dhclient.eth0.leases ===
124.23.172.172  ns.systemsomething.fi  fi (fi+1=51)    fi (fi+1=52)
124.23.174.174  ns2.systemsomething.fi fi (fi+1=53)    fi (fi+1=54)
=== /var/lib/dhcp3/dhclient.eth1.leases ===
=== /var/lib/dhcp3/dhclient.leases ===
=== ip addr| ===
=== wget www.iki.fi/karvinen/whereteroip.php --output-document - -q|grep h1| ===
82.13.225.82    johto102.dsl.systemsomething.fi fi (fi+30=140)  fi (fi+30=170)
=== whereterotest ===
=== Country Score ===
fi      170
=== Wheretero Guess ===
fi

Download

Download Wheretero 0.4 (wheretero-0.4.tar.gz 2.5 kB)

Browse download directory

Installation and Usage

Install prequisites. You will need perl, Net::IP, Geo::IPfree and Socket perl libraries, wget, timeout and traceroute. On Ubuntu, packages are from main and universe:

$ sudo apt-get install perl traceroute timeout wget grep libgeo-ipfree-perl libnet-ip-perl

Unpack and run Wheretero

$ tar -zxvf wheretero-*.tar.gz
$ cd wheretero-*/
$ ./wheretero

To only print the current country

$ wheretero |tail -1
fi

To automatically set keyboard layout

$ setxkbmap $(wheretero |tail -1)

FAQ

Why would I want to determine my location automatically?

If you boot a live-CD such as Knoppix, the keyboard layout is not detected automatically. Using Wheretero removes the only manual step on live-CD usage.

Is Wheretero unique?

As far as I know, at the time of publishing Wheretero, there are no other programs to configure keyboard layout automatically, without user intervention.

Because many national keyboards only differ by having different characters taped on top of keys, it has been considered difficult or impossible to detect keyboard layout automatically. However, because each country usually has just a single keyboard layout, the location based guess works very well. It definitely beats hard coded layout.

Can I use Wheretero for other purposes than keyboard layout detection?

Yes. For example, you can use it to make an advanced guess on

Is it Free software?

Yes, WhereTero is Free, open source software. It is published under the GNU General Public License, version 2. License allows you to use, copy, modify and examine Wheretero.

Why not just geoiplookup $MYIP?

Does not work with NAT. Most of the environments where I need wheretero have NAT:ted, non-public IP addresses.

Why not just traceroute?

New tunneling routing protocols prevent traceroute from working. For example, in one of the networks I use, traceroute to www.google.com shows just three hosts. All but google are on private subnets, thus not usefull for location purposes.

Why not just read DHCP information?

In some networks, all information provided by DHCP are in private subnets and private namespaces. In one of the networks I use, this is indeed the case: DNS servers and DHCP server are in private subnets, name search suffix is a private local top level domain.

Why not just look at a "show my ip" php web page?

Even though it is possible to do this automatically, it’s not very reliable. Web sites come and go, and it would require a lot of maintenance effort to guarantee such a service for the (unknown) lifetime of multiple live-CD:s. Also, many such services deny robots using robot exclusion standard.

To reliably determine location, such a web service needs an up to date and complete IP address to country database. Such database is not available, at least not free. Even though GeoIpLookup is very good, it is not complete.

How can Wheretero find out physical location then?

It combines many of these methods. Different methods give points that are scaled to create a final decision of the current location.

Can I contribute?

Yes, please:

Can I send you feedback?

Please do! It is not possible for me to travel to 192 countries of the world to try out Wheretero in each network on the face of planet Earth.

I’d like to know:

Leave your feedback using the quick feedback form.

Last modified: 2006-09-09. Permanent url: http://www.iki.fi/karvinen/wheretero.html

Tero Karvinen www.iki.fi/karvinen - Top - Validate HTML - Validate CSS