1 world -- Print mappings between country names and DNS country codes.
4 Email: bwarsaw@python.org
6 This script will take a list of Internet addresses and print out where in the
7 world those addresses originate from, based on the top-level domain country
8 code found in the address. Addresses can be in any of the following forms:
10 xx -- just the country code or top-level domain identifier
11 host.domain.xx -- any Internet host or network name
12 somebody@where.xx -- an Internet email address
14 If no match is found, the address is interpreted as a regular expression [*]
15 and a reverse lookup is attempted. This script will search the country names
16 and print a list of matching entries. You can force reverse mappings with the
17 `-r' flag (see below).
22 tz originated from Tanzania, United Republic of
23 us originated from United States
26 united matches 6 countries:
27 ae: United Arab Emirates
28 uk: United Kingdom (common practice)
29 um: United States Minor Outlying Islands
31 tz: Tanzania, United Republic of
35 [*] Note that regular expressions must conform to Python 1.5's re.py module
36 syntax. The comparison is done with the search() method.
38 Country codes are maintained by the RIPE Network Coordination Centre,
39 in coordination with the ISO 3166 Maintenance Agency at DIN Berlin. The
40 authoritative source of counry code mappings is:
42 <url:ftp://info.ripe.net/iso3166-countrycodes>
44 The latest known change to this information was:
46 Thu Aug 7 17:59:51 MET DST 1997
48 This script also knows about non-geographic top-level domains.
50 Usage: world [-d] [-p file] [-o] [-h] addr [addr ...]
54 Print mapping of all top-level domains.
58 Parse an iso3166-countrycodes file extracting the two letter country
59 code followed by the country name. Note that the three letter country
60 codes and numbers, which are also provided in the standard format
65 When used in conjunction with the `-p' option, output is in the form
66 of a Python dictionary, and country names are normalized
67 w.r.t. capitalization. This makes it appropriate for cutting and
68 pasting back into this file.
72 Force reverse lookup. In this mode the address can be any Python
73 regular expression; this is matched against all country names and a
74 list of matching mappings is printed. In normal mode (e.g. without
75 this flag), reverse lookup is performed on addresses if no matching
76 country code is found.