blob: f7bb61021e25913caa6747c711118a322806b1a9 [file] [log] [blame]
Barry Warsaw08833f21998-12-05 22:19:06 +00001world -- Print mappings between country names and DNS country codes.
2
Barry Warsaw88604051998-12-14 21:36:40 +00003Contact: Barry Warsaw
Barry Warsaw08833f21998-12-05 22:19:06 +00004Email: bwarsaw@python.org
5
6This script will take a list of Internet addresses and print out where in the
7world those addresses originate from, based on the top-level domain country
8code found in the address. Addresses can be in any of the following forms:
9
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
13
14If no match is found, the address is interpreted as a regular expression [*]
15and a reverse lookup is attempted. This script will search the country names
16and print a list of matching entries. You can force reverse mappings with the
17`-r' flag (see below).
18
19For example:
20
21 %% world tz us
22 tz originated from Tanzania, United Republic of
23 us originated from United States
24
25 %% world united
26 united matches 6 countries:
27 ae: United Arab Emirates
28 uk: United Kingdom (common practice)
29 um: United States Minor Outlying Islands
30 us: United States
31 tz: Tanzania, United Republic of
32 gb: United Kingdom
33
34
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.
37
38Country codes are maintained by the RIPE Network Coordination Centre,
39in coordination with the ISO 3166 Maintenance Agency at DIN Berlin. The
40authoritative source of counry code mappings is:
41
42 <url:ftp://info.ripe.net/iso3166-countrycodes>
43
44The latest known change to this information was:
45
46 Thu Aug 7 17:59:51 MET DST 1997
47
48This script also knows about non-geographic top-level domains.
49
50Usage: world [-d] [-p file] [-o] [-h] addr [addr ...]
51
52 --dump
53 -d
54 Print mapping of all top-level domains.
55
56 --parse file
57 -p file
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
61 file, are ignored.
62
63 --outputdict
64 -o
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.
69
70 --reverse
71 -r
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.
77
78 -h
79 --help
80 Print this message.
81
82
83Local Variables:
84indent-tabs-mode: nil
85End: