whois interface to domainz database
Hi, I have just knocked up a quick-and-dirty whois interface to the domainz nz-tld registration database, since + I live in a command-line world + the internet was much better before the web + etc, etc, foam-at-mouth The data is pulled on-demand from the CGI interface at Waikato, and is presented in a ripe-181-alike format. The whole thing will undoubtedly fall apart as soon as someone at Waikato lets a web monkey near cgi-bin. $ whois -h whois.patho.gen.nz patho.gen.nz % This data was harvested from a public CGI interface hosted % at http://domainz.waikato.ac.nz/cgi-bin/DNZ-REGISTER % No responsibility is taken nor warrenty made for the accuracy % of the information presented here. domain: patho.gen.nz admin-c: Joe Abley tech-c: Joe Abley nserver: tardis.patho.gen.nz nserver: ns1.waikato.ac.nz nserver: dns1.clear.net.nz nserver: dns2.clear.net.nz remarks: registration-date 30-Jun-1997 remarks: modification-date 10-Sep-1997 changed: root(a)patho.gen.nz 19990426 source: PATHOGEN person: Joe Abley address: 3/60 Grange Road, Mt Eden address: Auckland, New Zealand phone: +64 9 623 1399 fax-no: by arrangement e-mail: jabley(a)patho.gen.nz changed: root(a)patho.gen.nz 19990426 source: PATHOGEN person: Joe Abley address: 3/60 Grange Road, Mt Eden address: Auckland, New Zealand phone: +64 9 623 1399 fax-no: by arrangement e-mail: jabley(a)patho.gen.nz changed: root(a)patho.gen.nz 19990426 source: PATHOGEN There is no magic in this - just a big lump of awk. Script follows, in case anybody is interested -- fetch is a FreeBSD-ism; other platforms may have more luck with the myriad of ability instilled in modern ftp clients[2]. Note to any housebreakers reading nznog: that address is two years old, and I don't live there any more :) Joe [1] Like this one. I'm surprised it can't send mail. NAME ftp, pftp, gate-ftp - ARPANET file transfer program SYNOPSIS ftp [-a] [-d] [-e] [-g] [-i] [-n] [-U] [-p] [-P port] [-t] [-v] [-V] [host [port]] ftp ftp://[user:password@]host[:port]/file[/] ftp http://host[:port]/file ftp host:[/path/]file[/] ------large-nasty-script-including-unwholesome-lump-of-awk-follows-------- #!/bin/sh # # Call from inetd, using an entry in inetd.conf like this: # # # DOMAINZ whois service # whois stream tcp nowait nobody /usr/local/bin/whois-domainz.sh whois-domainz.sh read domain /usr/bin/fetch -o - "http://domainz.waikato.ac.nz/cgi-bin/DNZ-REGISTER?domain_name=${domain}" 2>/dev/null | /usr/bin/awk ' BEGIN \ { printf "%% This data was harvested from a public CGI interface hosted\n"; printf "%% at http://domainz.waikato.ac.nz/cgi-bin/DNZ-REGISTER\n\n"; printf "%% No responsibility is taken nor warrenty made for the accuracy\n"; printf "%% of the information presented here.\n\n"; } /Domain name:/ \ { sub(/^.*<\/STRONG>[[:space:]]*/, ""); domain_name=$0; next; } /Registration:/ \ { sub(/^.*<\/STRONG>[[:space:]]*/, ""); registration=$0; next; } /Modification:/ \ { sub(/^.*<\/STRONG>[[:space:]]*/, ""); modification=$0; next; } /representative contact name:/ \ { sub(/^.*<\/STRONG>[[:space:]]*/, ""); holder_name=$0; next; } /Holder phone:/ \ { sub(/^.*<\/STRONG>[[:space:]]*/, ""); holder_phone=$0; next; } /Holder fax:/ \ { sub(/^.*<\/STRONG>[[:space:]]*/, ""); holder_fax=$0; next; } /Holder e-mail:/ \ { sub(/^.*<\/STRONG>[[:space:]]*/, ""); holder_email=$0; next; } /Holder address part 1:/ \ { sub(/^.*<\/STRONG>[[:space:]]*/, ""); holder_address_1=$0; next; } /Holder address part 2:/ \ { sub(/^.*<\/STRONG>[[:space:]]*/, ""); holder_address_2=$0; next; } /Technical contact name:/ \ { sub(/^.*<\/STRONG>[[:space:]]*/, ""); tech_name=$0; next; } /Technical phone:/ \ { sub(/^.*<\/STRONG>[[:space:]]*/, ""); tech_phone=$0; next; } /Technical fax:/ \ { sub(/^.*<\/STRONG>[[:space:]]*/, ""); tech_fax=$0; next; } /Technical e-mail:/ \ { sub(/^.*<\/STRONG>[[:space:]]*/, ""); tech_email=$0; next; } /Technical address part 1:/ \ { sub(/^.*<\/STRONG>[[:space:]]*/, ""); tech_address_1=$0; next; } /Technical address part 2:/ \ { sub(/^.*<\/STRONG>[[:space:]]*/, ""); tech_address_2=$0; next; } /Name server primary:/ \ { sub(/^.*<\/STRONG>[[:space:]]*/, ""); ns_name_1=$0; next; } /Name server secondary:/ \ { sub(/^.*<\/STRONG>[[:space:]]*/, ""); ns_name_2=$0; next; } /Name server third:/ \ { sub(/^.*<\/STRONG>[[:space:]]*/, ""); ns_name_3=$0; next; } /Name server fourth:/ \ { sub(/^.*<\/STRONG>[[:space:]]*/, ""); ns_name_4=$0; next; } END \ { if (domain_name == "") printf"% no useful data returned by query\n"; else { printf "domain: %s\n", domain_name; if (holder_name != "") printf "admin-c: %s\n", holder_name; if (tech_name != "") printf "tech-c: %s\n", tech_name; if (ns_name_1 != "") printf "nserver: %s\n", ns_name_1; if (ns_name_2 != "") printf "nserver: %s\n", ns_name_2; if (ns_name_3 != "") printf "nserver: %s\n", ns_name_3; if (ns_name_4 != "") printf "nserver: %s\n", ns_name_4; if (registration != "") printf "remarks: registration-date %s\n", \ registration; if (modification != "") printf "remarks: modification-date %s\n", \ modification; printf "changed: root(a)patho.gen.nz %s\nsource: PATHOGEN\n\n", \ strftime("%Y%m%d"); if (holder_name != "") { printf "person: %s\n", holder_name; if (holder_address_1 != "") printf "address: %s\n", holder_address_1; if (holder_address_2 != "") printf "address: %s\n", holder_address_2; if (holder_phone != "") printf "phone: %s\n", holder_phone; if (holder_fax != "") printf "fax-no: %s\n", holder_fax; if (holder_email != "") printf "e-mail: %s\n", holder_email; printf "changed: root(a)patho.gen.nz %s\nsource: PATHOGEN\n\n", \ strftime("%Y%m%d"); } if (tech_name != "") { printf "person: %s\n", tech_name; if (tech_address_1 != "") printf "address: %s\n", tech_address_1; if (tech_address_2 != "") printf "address: %s\n", tech_address_2; if (tech_phone != "") printf "phone: %s\n", tech_phone; if (tech_fax != "") printf "fax-no: %s\n", tech_fax; if (tech_email != "") printf "e-mail: %s\n", tech_email; printf "changed: root(a)patho.gen.nz %s\nsource: PATHOGEN\n\n", \ strftime("%Y%m%d"); } } } ' --------- To unsubscribe from nznog, send email to majordomo(a)list.waikato.ac.nz where the body of your message reads: unsubscribe nznog
participants (1)
-
Joe Abley