3 In 2003, as a programming exercise for learning Python, I wrote a
4 simple rwhois server (described in RFC 2167). It uses in-memory data
5 structures, and it intuits the schema based on the data it sees. The
6 server takes as input a schema file, which for now just describes
7 which attributes should be indexed (and how), and data files which
8 look much like the C rwhoisd's data files.
10 This version supports a sort of extended query syntax: IP or CIDR
11 queries ending in "**" will result in a "subnet" search, where all of
12 the found subnets at or below the specified network will be returned.
13 Ending a IP or CIDR query with a single "*" will result in a
14 "supernet" search, returning all the networks enclosing the queried
15 network. (A plain network query will return the closest enclosing
16 network, including matching networks).
18 It supports (as of v0.4) IPv6 CIDR networks and network blocks, and
19 supports indexing network-block type values. That is, you can index
20 values like "10.131.10.0 - 10.131.11.255" and "3ffe:4:5::0 -
29 This can be run from it's source directory, which is a fine way to do
32 However, if you wish to install it, as root:
34 % python setup.py install
36 This is just using the standard Python distutils, so there is actually
37 a great deal of flexibility here. Try
39 % python setup.py install --help
41 to see some of the options available.
45 This is assuming that you are running it from the distribution
48 % tar zxvf python-rwhoisd-0.4.tar.gz
50 % cd python-rwhoisd-0.4
52 % ./bin/pyrwhoisd sample_data/example_schema \
53 sample_data/example_data &
55 Voila! You should now have some sort of rwhois server running on port
58 You can also give it multiple data files:
60 % ./bin/pyrwhoisd sample_data/example_schema sample_data/*_data &
64 Edit rwhoisd/config.py.
66 This file has comments describing options that you can change.
70 See the example_schema and example_data files in the sample_data
73 The format of the data files is very similar to the format used by the
74 C rwhois server (rwhoisd-1.5.x from www.rwhois.net). It has the
75 following differences, however:
77 * These files may have records separated by blank lines instead of
80 * They are not sensitive to trailing separators (whitespace or dashes)
82 * They do not have to be arranged in any special manner. That is, the
83 C rwhoisd forces (or at least encourages) you to arrange your data
84 files into different directories per authority-area. These can be
87 * This server does not support attribute "aliases".
89 It should be noted that this server in small ways violates the
90 description put forth by RFC 2167. In particular, it does not
91 establish independent schemas for each authority area. There may be
92 other violations as well.