Compare commits

..

No commits in common. "next" and "v5.5.18" have entirely different histories.

33 changed files with 631 additions and 744 deletions

View File

@ -1,18 +0,0 @@
name: Publish a Github release
on:
push:
branches:
- master
tags:
- "v*.*"
jobs:
release:
runs-on: debian-latest
permissions:
contents: write
steps:
- name: Release
uses: softprops/action-gh-release@v1

View File

@ -2,7 +2,7 @@
Version 2, June 1991 Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc., Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
<https://fsf.org/> 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed. of this license document, but changing it is not allowed.
@ -304,7 +304,8 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License along You should have received a copy of the GNU General Public License along
with this program; if not, see <https://www.gnu.org/licenses/>. with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail. Also add information on how to contact you by electronic and paper mail.
@ -328,8 +329,8 @@ necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker. `Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Moe Ghoul>, 1 April 1989 <signature of Ty Coon>, 1 April 1989
Moe Ghoul, President of Vice Ty Coon, President of Vice
This General Public License does not permit incorporating your program into This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may proprietary programs. If your program is a subroutine library, you may

View File

@ -94,6 +94,9 @@ version.h: debian/changelog make_version_h.pl
as_del.h: as_del_list make_as_del.pl as_del.h: as_del_list make_as_del.pl
$(PERL) make_as_del.pl < $< > $@ $(PERL) make_as_del.pl < $< > $@
as32_del.h: as32_del_list make_as32_del.pl
$(PERL) make_as32_del.pl < $< > $@
ip_del.h: ip_del_list make_ip_del.pl ip_del.h: ip_del_list make_ip_del.pl
$(PERL) make_ip_del.pl < $< > $@ $(PERL) make_ip_del.pl < $< > $@
@ -149,7 +152,7 @@ distclean: clean
rm -f version.h po/whois.pot rm -f version.h po/whois.pot
clean: clean:
rm -f Makefile.depend as_del.h ip_del.h ip6_del.h \ rm -f Makefile.depend as_del.h as32_del.h ip_del.h ip6_del.h \
nic_handles.h new_gtlds.h tld_serv.h servers_charset.h \ nic_handles.h new_gtlds.h tld_serv.h servers_charset.h \
*.o whois mkpasswd *.o whois mkpasswd
rm -f po/*.mo rm -f po/*.mo

11
README
View File

@ -13,13 +13,14 @@ program, which can be used to encrypt a password with crypt(3).
The canonical distribution point for releases of the program is The canonical distribution point for releases of the program is
https://ftp.debian.org/debian/pool/main/w/whois/ . http://ftp.debian.org/debian/pool/main/w/whois/ .
Useful information sources: Useful information sources:
- https://www.ripe.net/ripe/docs/current-ripe-documents/ripe-database-documents - http://www.ripe.net/ripe/docs/current-ripe-documents/ripe-database-documents
- https://www.iana.org/domains/root/db/ - http://www.iana.org/domains/root/db/
- https://www.icann.org/en/resources/idn/fast-track/string-evaluation-completion - http://www.icann.org/en/resources/idn/fast-track/string-evaluation-completion
- https://www.aftld.org/ - http://www.aftld.org/
Marco d'Itri <md@linux.it> Marco d'Itri <md@linux.it>

19
as32_del_list Normal file
View File

@ -0,0 +1,19 @@
# http://www.iana.org/assignments/as-numbers
# actually I listed here also the unallocated space reserved for each RIR
131077 131086 whois.nic.ad.jp
131092 131101 whois.nic.or.kr
131152 131161 whois.nic.ad.jp
131791 131890 whois.nic.or.kr
131893 131992 whois.nic.ad.jp
2.0 2.65535 apnic
3.0 3.65535 ripe
4.0 4.65535 lacnic
5.0 5.65535 afrinic
6.0 6.65535 arin
# private ASN block
4200000000 4294967294 ripe

View File

@ -1,4 +1,4 @@
# https://www.iana.org/assignments/as-numbers # http://www.iana.org/assignments/as-numbers
248 251 ripe 248 251 ripe
306 371 whois.nic.mil 306 371 whois.nic.mil
@ -95,19 +95,3 @@
# documentation and private ASN block # documentation and private ASN block
64496 65534 ripe 64496 65534 ripe
131077 131086 whois.nic.ad.jp
131092 131101 whois.nic.or.kr
131152 131161 whois.nic.ad.jp
131791 131890 whois.nic.or.kr
131893 131992 whois.nic.ad.jp
# actually I listed here also the unallocated space reserved for each RIR
2.0 2.65535 apnic
3.0 3.65535 ripe
4.0 4.65535 lacnic
5.0 5.65535 afrinic
6.0 6.65535 arin
# private ASN block
4200000000 4294967294 ripe

View File

@ -14,7 +14,7 @@
/* autoconf in cpp macros */ /* autoconf in cpp macros */
#if defined __NetBSD__ || defined __OpenBSD__ #if defined __NetBSD__ || __OpenBSD__
# include <sys/param.h> # include <sys/param.h>
#endif #endif
@ -26,17 +26,12 @@
/* which versions? */ /* which versions? */
# define HAVE_GETOPT_LONG # define HAVE_GETOPT_LONG
# define HAVE_GETADDRINFO # define HAVE_GETADDRINFO
# define HAVE_READPASSPHRASE
# define ENABLE_NLS # define ENABLE_NLS
# ifndef LOCALEDIR # ifndef LOCALEDIR
# define LOCALEDIR "/usr/local/share/locale" # define LOCALEDIR "/usr/local/share/locale"
# endif # endif
#endif #endif
#if defined OpenBSD
# define HAVE_READPASSPHRASE
#endif
/* needs unistd.h */ /* needs unistd.h */
#if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 200112L #if defined _POSIX_C_SOURCE && _POSIX_C_SOURCE >= 200112L
# define HAVE_GETADDRINFO # define HAVE_GETADDRINFO
@ -46,7 +41,6 @@
#if defined __APPLE__ && defined __MACH__ #if defined __APPLE__ && defined __MACH__
# define HAVE_GETOPT_LONG # define HAVE_GETOPT_LONG
# define HAVE_GETADDRINFO # define HAVE_GETADDRINFO
# define HAVE_READPASSPHRASE
# define HAVE_BSDICRYPT # define HAVE_BSDICRYPT
#endif #endif
@ -78,7 +72,6 @@
/* Unknown versions of Solaris */ /* Unknown versions of Solaris */
#if defined __SVR4 && defined __sun #if defined __SVR4 && defined __sun
# define HAVE_GETOPT_LONG
# define HAVE_SHA_CRYPT # define HAVE_SHA_CRYPT
# define HAVE_CRYPT_H # define HAVE_CRYPT_H
# define HAVE_SOLARIS_CRYPT_GENSALT # define HAVE_SOLARIS_CRYPT_GENSALT

36
data.h
View File

@ -1,5 +1,3 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/* /*
* RIPE-like servers. * RIPE-like servers.
* All of them do not understand -V2.0Md with the exception of RA and RIPN. * All of them do not understand -V2.0Md with the exception of RA and RIPN.
@ -17,23 +15,10 @@ const char *ripe_servers[] = {
"whois.ripn.net", "whois.ripn.net",
"whois.register.si", "whois.register.si",
"whois.nic.ir", "whois.nic.ir",
"whois.ra.net",
NULL NULL
}; };
struct server_referral_handler {
const char *name;
void (*handler)(char **referral_server, const char *buf);
};
const struct server_referral_handler server_referral_handlers[] = {
{ "whois.apnic.net", find_referral_server_apnic },
{ "whois.arin.net", find_referral_server_arin },
{ "whois.iana.org", find_referral_server_iana },
{ "\x04", find_referral_server_verisign },
{ "\x08", find_referral_server_recursive },
{ NULL, NULL }
};
const char *hide_strings[] = { const char *hide_strings[] = {
"The data in Networksolutions.com's WHOIS database", NULL, "The data in Networksolutions.com's WHOIS database", NULL,
/* Some registrars like .wang copied the first paragraph of this /* Some registrars like .wang copied the first paragraph of this
@ -48,7 +33,7 @@ const char *hide_strings[] = {
"Please register your domains at; http://www.", NULL, /* key-systems.net */ "Please register your domains at; http://www.", NULL, /* key-systems.net */
"%% NOTICE: Access to this information is provided", NULL, /* bookmyname.com */ "%% NOTICE: Access to this information is provided", NULL, /* bookmyname.com */
"NOTICE: Access to the domain name's information", NULL, /* CORE */ "NOTICE: Access to the domain name's information", NULL, /* CORE */
"The data in MarkMonitor’s WHOIS", NULL, /* MarkMonitor */ "The Data in MarkMonitor.com's", NULL, /* MarkMonitor */
"Corporation Service Company(c) (CSC) The Trusted Partner", "Register your domain name at", /* CSC */ "Corporation Service Company(c) (CSC) The Trusted Partner", "Register your domain name at", /* CSC */
"The data in Networksolutions.com's", NULL, /* Networksolutions */ "The data in Networksolutions.com's", NULL, /* Networksolutions */
"# Welcome to the OVH WHOIS Server", "", /* ovh */ "# Welcome to the OVH WHOIS Server", "", /* ovh */
@ -87,10 +72,8 @@ const char *hide_strings[] = {
"Access to .IN WHOIS information", NULL, /* in */ "Access to .IN WHOIS information", NULL, /* in */
"access to .in whois information", NULL, /* in registar */ "access to .in whois information", NULL, /* in registar */
"% Use of CIRA's WHOIS service is governed by the Terms of Use in its Legal", NULL, /* sx */ "% Use of CIRA's WHOIS service is governed by the Terms of Use in its Legal", NULL, /* sx */
"Terms of Use: Access to WHOIS information", NULL, /* vc */
"The Service is provided so that you may look", "We may discontinue",/*vu*/ "The Service is provided so that you may look", "We may discontinue",/*vu*/
"NeuStar, Inc., the Registry Administrator for .US", NULL, "NeuStar, Inc., the Registry Administrator for .US", NULL,
"; This data is provided ", NULL, /* whois.1api.net */
NULL, NULL NULL, NULL
}; };
@ -135,8 +118,8 @@ const struct ip6_del ip6_assign[] = {
}; };
struct as_del { struct as_del {
const unsigned long first; const unsigned short first;
const unsigned long last; const unsigned short last;
const char *serv; const char *serv;
}; };
@ -145,6 +128,17 @@ const struct as_del as_assign[] = {
{ 0, 0, NULL } { 0, 0, NULL }
}; };
struct as32_del {
const unsigned long first;
const unsigned long last;
const char *serv;
};
const struct as32_del as32_assign[] = {
#include "as32_del.h"
{ 0, 0, NULL }
};
const char *new_gtlds[] = { const char *new_gtlds[] = {
#include "new_gtlds.h" #include "new_gtlds.h"
NULL NULL

119
debian/changelog vendored
View File

@ -1,122 +1,3 @@
whois (5.6.6) unstable; urgency=medium
* Added the .mc TLD server.
* Updated the .ps TLD server.
* Removed the .info, .mobi, .travel and .فلسطين (.xn--ygbi2ammx,
Palestinian Territory) TLD servers.
* Removed 3 new gTLDs which are no longer active.
* mkpasswd: added support the Chinese SM3-based hashing algorithms.
-- Marco d'Itri <md@linux.it> Mon, 16 Feb 2026 02:46:51 +0100
whois (5.6.5) unstable; urgency=medium
* Updated the .co TLD server.
* Added some large KRNIC networks.
* Updated the second level .uk TLD servers.
* Removed the .pro TLD server.
* Removed 1 new gTLD which is no longer active.
-- Marco d'Itri <md@linux.it> Mon, 13 Oct 2025 03:37:20 +0200
whois (5.6.4) unstable; urgency=medium
* Updated the .cm and .to TLD servers.
-- Marco d'Itri <md@linux.it> Sat, 02 Aug 2025 01:13:07 +0200
whois (5.6.3) unstable; urgency=medium
* Added the .sr and .мон (.xn--l1acc, Mongolia) TLD servers.
* Use readpassphrase(3) on OpenBSD and FreeBSD.
-- Marco d'Itri <md@linux.it> Thu, 17 Jul 2025 05:15:53 +0200
whois (5.6.2) unstable; urgency=medium
* Updated the .post and .in (and related IDN TLDs) TLD servers.
* Removed 1 new gTLDs which is no longer active.
* Build-Depend on libcrypt-dev. (Closes: #1106977)
-- Marco d'Itri <md@linux.it> Fri, 06 Jun 2025 18:22:04 +0200
whois (5.6.1) unstable; urgency=medium
* Added the .pg TLD server.
* Updated the .gov, .mu, .中国 (.xn--fiqs8s) and .中國 (.xn--fiqz9s)
TLD servers.
* Removed the .jobs TLD server.
* Added the encodings for whois.afrinic.net and whois.apnic.net.
* Enabled the UTF-8 encoding for whois.ripe.net.
* Use the last ReferralServer returned by the ARIN server instead of
the first, because we want to follow the referral for the most
specific record returned.
* Make sure to avoid trivial referral loops.
-- Marco d'Itri <md@linux.it> Sat, 17 May 2025 01:30:06 +0200
whois (5.6.0) unstable; urgency=medium
* Fixed the mangling of RADB queries with commands.
* Implemented the parsing of more variants of ARIN's ReferralServer
field.
* Implemented following the APNIC pseudo-referrals.
* Added the .ad and .za TLD servers.
* Updated the .ao, .bz, .gi, .gq, .gr, .gw, .lc, .md, .pn, .pr, .uy, .vc,
.info, .mobi, .ελ (.xn--qxam, Greece) and .გე (.xn--node, Georgia) TLD
servers.
* Added 2410::/12.
* Removed 7 new gTLDs which are no longer active.
* Cleaned up the markup of the man pages, courtesy of Bjarni Ingi
Gislason. (Closes: #1036826, #1094208)
-- Marco d'Itri <md@linux.it> Mon, 05 May 2025 02:57:37 +0200
whois (5.5.23) unstable; urgency=medium
* Updated the .sc, .新加坡 (.xn--yfro4i67o, Singapore) and .சிங்கப்பூர்
(.xn--clchc0ea0b2g2a9gcd, Singapore) TLD servers.
-- Marco d'Itri <md@linux.it> Sat, 04 May 2024 03:13:22 +0200
whois (5.5.22) unstable; urgency=medium
* Fixed a segmentation fault with --no-recursion.
* Updated the .bm and .vi TLD servers.
* Removed 4 new gTLDs which are no longer active.
-- Marco d'Itri <md@linux.it> Mon, 01 Apr 2024 20:14:41 +0200
whois (5.5.21) unstable; urgency=medium
* Updated the .cv and .sd TLD servers.
* Remove 4 new gTLDs which are no longer active.
-- Marco d'Itri <md@linux.it> Sat, 24 Feb 2024 17:22:22 +0100
whois (5.5.20) unstable; urgency=medium
* Added the .gn TLD server.
* Removed 6 new gTLDs which are no longer active.
* Enabled getopt_long(3) support on Solaris.
-- Marco d'Itri <md@linux.it> Fri, 10 Nov 2023 15:26:02 +0100
whois (5.5.19) unstable; urgency=medium
* Fixed english support for Japanese queries to not add again the /e
argument if it had already been provided by the user. (Closes: #1050171)
* Added the .ye and .বাংলা (.xn--54b7fta0cc, Bangladesh) TLD servers.
* Updated the .ba, .bb, .dk, .es, .gt, .jo, .ml, .mo, .pa, .pn, .sv,
.uy, .ﺍﻻﺭﺪﻧ (.xn--mgbayh7gpa, Jordan) and .澳門 (.xn--mix891f, Macao)
TLD servers.
* Upgraded the TLD URLs to HTTPS whenever possible.
* Updated the charset for whois.jprs.jp.
* Removed 3 new gTLDs which are no longer active.
* Removed support for the obsolete as32 dot notation.
-- Marco d'Itri <md@linux.it> Sun, 08 Oct 2023 22:58:33 +0200
whois (5.5.18) unstable; urgency=medium whois (5.5.18) unstable; urgency=medium
[ Marco d'Itri ] [ Marco d'Itri ]

11
debian/control vendored
View File

@ -2,14 +2,13 @@ Source: whois
Section: net Section: net
Priority: standard Priority: standard
Maintainer: Marco d'Itri <md@linux.it> Maintainer: Marco d'Itri <md@linux.it>
Standards-Version: 4.7.2.0 Standards-Version: 4.6.2.0
Rules-Requires-Root: no Rules-Requires-Root: no
Build-Depends: debhelper-compat (= 13), gettext, pkgconf, Build-Depends: debhelper-compat (= 13), gettext, pkg-config,
bash-completion, bash-completion,
libcrypt-dev, libidn2-dev (>= 2.0.3),
libidn2-dev, Vcs-Git: https://github.com/rfc1036/whois.git
Vcs-Git: https://salsa.debian.org/md/whois.git Vcs-Browser: https://github.com/rfc1036/whois
Vcs-Browser: https://salsa.debian.org/md/whois
Package: whois Package: whois
Architecture: any Architecture: any

6
debian/salsa-ci.yml vendored
View File

@ -1,6 +0,0 @@
---
include:
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/recipes/debian.yml
variables:
SALSA_CI_IGNORED_BRANCHES: '^next$'

View File

@ -1,4 +1,4 @@
# https://www.iana.org/assignments/ipv6-unicast-address-assignments # http://www.iana.org/assignments/ipv6-unicast-address-assignments
# The parser is very simple-minded and wants the two first components of # The parser is very simple-minded and wants the two first components of
# addresses. It does not deal with networks == 0 or > 24 bit. # addresses. It does not deal with networks == 0 or > 24 bit.
@ -35,12 +35,13 @@
2003:0000::/18 ripe 2003:0000::/18 ripe
2400:0000::/20 whois.nic.or.kr 2400:0000::/20 whois.nic.or.kr
2400:0000::/11 apnic 2400:0000::/12 apnic
2600:0000::/12 arin 2600:0000::/12 arin
2610:0000::/23 arin 2610:0000::/23 arin
2620:0000::/23 arin 2620:0000::/23 arin
2630:0000::/12 arin 2630:0000::/12 arin
2800:0000::/12 lacnic 2800:0000::/12 lacnic
2A00:0000::/11 ripe 2A00:0000::/12 ripe
2A10:0000::/12 ripe
2C00:0000::/12 afrinic 2C00:0000::/12 afrinic

View File

@ -4,26 +4,22 @@
# unless they are very big and contains multiple assignments to different # unless they are very big and contains multiple assignments to different
# customers documented in the whois database. # customers documented in the whois database.
# #
# https://www.iana.org/assignments/ipv4-address-space # http://www.iana.org/assignments/ipv4-address-space
# #
0.0.0.0/8 UNKNOWN 0.0.0.0/8 UNKNOWN
1.0.0.0/8 apnic 1.0.0.0/8 apnic
2.0.0.0/8 ripe 2.0.0.0/8 ripe
5.0.0.0/8 ripe 5.0.0.0/8 ripe
14.64.0.0/11 whois.nic.or.kr
14.0.0.0/8 apnic 14.0.0.0/8 apnic
24.132.0.0/14 ripe 24.132.0.0/14 ripe
27.176.0.0/13 whois.nic.or.kr
27.0.0.0/8 apnic 27.0.0.0/8 apnic
31.0.0.0/8 ripe 31.0.0.0/8 ripe
36.0.0.0/8 apnic 36.0.0.0/8 apnic
37.0.0.0/8 ripe 37.0.0.0/8 ripe
39.0.0.0/8 apnic 39.0.0.0/8 apnic
41.0.0.0/8 afrinic 41.0.0.0/8 afrinic
42.32.0.0/12 whois.nic.or.kr
42.0.0.0/7 apnic 42.0.0.0/7 apnic
46.0.0.0/8 ripe 46.0.0.0/8 ripe
49.8.0.0/14 whois.nic.or.kr
49.0.0.0/8 apnic 49.0.0.0/8 apnic
51.0.0.0/8 ripe 51.0.0.0/8 ripe
# whois -r -K -h whois.apnic.net -i admin-c IM76-AP # whois -r -K -h whois.apnic.net -i admin-c IM76-AP

28
make_as32_del.pl Executable file
View File

@ -0,0 +1,28 @@
#!/usr/bin/perl
# SPDX-License-Identifier: GPL-2.0-or-later
use warnings;
use strict;
while (<>) {
chomp;
s/#.*$//;
s/^\s+//; s/\s+$//;
next if /^$/;
my ($fh, $fl, $lh, $ll, $s, $f, $l);
if (($fh, $fl, $lh, $ll, $s) =
/^(\d+)\.(\d+)\s+(\d+)\.(\d+)\s+([\w\.-]+)$/) {
$f = ($fh << 16) + $fl;
$l = ($lh << 16) + $ll;
my $server = ($s =~ /\./) ? $s : "whois.$s.net";
print qq|{ ${f}u, ${l}u,\t"$server" },\t/* $fh.$fl $lh.$ll */\n|;
} elsif (($f, $l, $s) = /^(\d+)\s+(\d+)\s+([\w\.-]+)$/) {
my $server = ($s =~ /\./) ? $s : "whois.$s.net";
print qq|{ ${f}u, ${l}u,\t"$server" },\n|;
} else {
die "format error: $_";
}
}

View File

@ -12,22 +12,18 @@ while (<>) {
s/^\s+//; s/\s+$//; s/^\s+//; s/\s+$//;
next if /^$/; next if /^$/;
my ($fh, $fl, $lh, $ll, $s, $f, $l); die "format error: $_" if not (/^([\d\.]+)\s+([\d\.]+)\s+([\w\.]+)$/);
my $comment = ''; my $f = $1; my $l = $2; my $s = $3;
if (($fh, $fl, $lh, $ll, $s) =
/^(\d+)\.(\d+)\s+(\d+)\.(\d+)\s+([\w\.-]+)$/) {
$f = ($fh << 16) + $fl;
$l = ($lh << 16) + $ll;
$comment = qq|\t/* $fh.$fl $lh.$ll */|;
} elsif (($f, $l, $s) = /^(\d+)\s+(\d+)\s+([\w\.-]+)$/) {
} else {
die "format error: $_";
}
die "constraint violated: $l < $last_l" if $l < $last_l; die "constraint violated: $l < $last_l" if $l < $last_l;
$last_l = $l; $last_l = $l;
my $server = ($s =~ /\./) ? $s : "whois.$s.net"; print "{ ${f}, ${l}, \"";
print qq|{ ${f}u, ${l}u,\t"$server" },$comment\n|; if ($s =~ /\./) {
print "$s";
} else {
print "whois.$s.net";
}
print qq(" },\n);
} }

View File

@ -18,7 +18,7 @@ while (<>) {
$b = "\\x03" if $b eq 'NONE'; $b = "\\x03" if $b eq 'NONE';
$b =~ s/^RECURSIVE\s+/\\x08" "/; $b =~ s/^RECURSIVE\s+/\\x08" "/;
$b = "\\x08$b" if $b eq 'whois.flexireg.net'; $b = "\\x08$b" if $b eq 'whois.flexireg.net';
$b = "\\x08$b" if $b eq 'whois.nixiregistry.in'; $b = "\\x08$b" if $b eq 'whois.registry.in';
$b = "\\x0C" if $b eq 'ARPA'; $b = "\\x0C" if $b eq 'ARPA';
$b = "\\x0D" if $b eq 'IP6'; $b = "\\x0D" if $b eq 'IP6';
print qq| "$a",\t"$b",\n|; print qq| "$a",\t"$b",\n|;

View File

@ -14,17 +14,12 @@ close($fh);
my ($ver) = $line =~ /^whois \s+ \( ( [^\)]+ ) \) \s+ \S+/x; my ($ver) = $line =~ /^whois \s+ \( ( [^\)]+ ) \) \s+ \S+/x;
die "Version number not found in $changelog!\n" if not $ver; die "Version number not found in $changelog!\n" if not $ver;
$ver =~ s/ ( $ver =~ s/ ( ~bpo\d+\+\d+ | \+b\d+ | ~deb\d+.* | ubuntu\d+ | build\d+ | \+dyson\d+ ) $//x;
build\d+
| ubuntu\d+
| ~\S+
| \+\S+
) $//x;
# The version number must not deviate from this format or the -V option # The version number must not deviate from this format or the -V option
# to RIPE-like servers will break. If needed, update the previous regexp. # to RIPE-like servers will break. If needed, update the previous regexp.
# This may not be true anymore in 2019. # This may not be true anymore in 2019.
die "Invalid version number in $changelog: '$ver'!\n" die "Invalid version number in $changelog!\n"
unless $ver =~ /^ \d+\.\d+ ( \.\d+ )? $/x; unless $ver =~ /^ \d+\.\d+ ( \.\d+ )? $/x;
# This is the version number used in the help messages. # This is the version number used in the help messages.

View File

@ -12,28 +12,28 @@ encrypts the given password with the
libc function, using the given salt. libc function, using the given salt.
.SH OPTIONS .SH OPTIONS
.TP .TP
.BR \-S " STRING\fR, \fP" \-\-salt= \fISTRING\fP .BR \-S ", "\c
.BI \-\-salt= STRING
Use the Use the
.I STRING .I STRING
as salt. as salt. If it begins with
If it begins with
.I $ .I $
then it will be passed straight to then it will be passed straight to
.BR crypt (3) .BR crypt (3)
without any checks. without any checks.
.TP .TP
.BR \-R " NUMBER\fR, \fP" \-\-rounds= \fINUMBER\fP .BR \-R ", "\c
.BI \-\-rounds= NUMBER
Use Use
.I NUMBER .I NUMBER
rounds. rounds. This argument is ignored if the method chosen
This argument is ignored if the method chosen does not support variable rounds. For the OpenBSD Blowfish method this is
does not support variable rounds.
For the OpenBSD Blowfish method this is
the logarithm of the number of rounds. the logarithm of the number of rounds.
The behavior is undefined if this option is used without The behavior is undefined if this option is used without
.IR \-\-method . .IR \-\-method .
.TP .TP
.BR \-m " TYPE\fR, \fP" \-\-method= \fITYPE\fP .BR \-m ", "\c
.BI \-\-method= TYPE
Compute the password using the Compute the password using the
.I TYPE .I TYPE
method. method.
@ -47,18 +47,20 @@ If
begins and end with begins and end with
.I $ .I $
characters then the string is passed to characters then the string is passed to
.BR crypt_gensalt (3) .IR crypt_gensalt (3)
as-is. as-is.
.TP .TP
.B \-5 .B -5
Like Like
.IR \-\-method=md5crypt . .IR \-\-method=md5crypt .
.TP .TP
.BI \-P " NUM\fR, \fP" \-\-password-fd= NUM .B \-P \c
.IR NUM ", "\c
.BI \-\-password-fd= NUM
Read the password from file descriptor Read the password from file descriptor
.I NUM .I NUM
instead of using instead of using
.BR getpass (3). .IR getpass (3).
If the file descriptor is not connected to a tty then no other text If the file descriptor is not connected to a tty then no other text
than the hashed password is printed on stdout. than the hashed password is printed on stdout.
.TP .TP
@ -77,16 +79,16 @@ characters may not be read correctly.
.P .P
This program suffers of a bad case of featuritis. This program suffers of a bad case of featuritis.
.SH "SEE ALSO" .SH "SEE ALSO"
.BR passwd (1), .IR passwd (1),
.BR passwd (5), .IR passwd (5),
.BR crypt (3), .IR crypt (3),
.BR crypt (5), .IR crypt (5),
.BR crypt_gensalt (3), .IR crypt_gensalt (3),
.BR getpass (3). .IR getpass (3).
.SH AUTHOR .SH AUTHOR
.B mkpasswd .B mkpasswd
and this man page were written by Marco d'Itri and this man page were written by Marco d'Itri
.RI < md@linux.it > .RI < md@linux.it >
and are licensed under the terms of the GNU General Public License, and are licensed under the terms of the GNU General Public License,
version 2 or later. version 2 or later.
.\" SPDX-License-Identifier: GPL-2.0-or-later \" SPDX-License-Identifier: GPL-2.0-or-later

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) Marco d'Itri <md@linux.it>. * Copyright (C) 2001-2021 Marco d'Itri <md@linux.it>.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -12,7 +12,8 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License along * You should have received a copy of the GNU General Public License along
* with this program; if not, see <https://www.gnu.org/licenses/>. * with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* *
* SPDX-License-Identifier: GPL-2.0-or-later * SPDX-License-Identifier: GPL-2.0-or-later
*/ */
@ -46,9 +47,6 @@
#ifdef HAVE_GETTIMEOFDAY #ifdef HAVE_GETTIMEOFDAY
#include <sys/time.h> #include <sys/time.h>
#endif #endif
#ifdef HAVE_READPASSPHRASE
#include <readpassphrase.h>
#endif
/* Application-specific */ /* Application-specific */
#include "version.h" #include "version.h"
@ -102,6 +100,9 @@ static const struct crypt_method methods[] = {
{ "md5", "$1$", 8, 8, 0, NULL }, { "md5", "$1$", 8, 8, 0, NULL },
#if defined XCRYPT_VERSION_NUM #if defined XCRYPT_VERSION_NUM
{ "yescrypt", "$y$", 0, 0, 1, "Yescrypt" }, { "yescrypt", "$y$", 0, 0, 1, "Yescrypt" },
#if XCRYPT_VERSION_NUM >= ((4 << 16) | 4)
{ "gost-yescrypt", "$gy$", 0, 0, 1, "GOST Yescrypt" },
#endif
{ "scrypt", "$7$", 0, 0, 1, "scrypt" }, { "scrypt", "$7$", 0, 0, 1, "scrypt" },
#endif #endif
#ifdef HAVE_BCRYPT_OBSOLETE #ifdef HAVE_BCRYPT_OBSOLETE
@ -110,7 +111,7 @@ static const struct crypt_method methods[] = {
#endif #endif
#ifdef HAVE_BCRYPT #ifdef HAVE_BCRYPT
{ "bcrypt", "$2b$", 22, 22, 2, "bcrypt" }, { "bcrypt", "$2b$", 22, 22, 2, "bcrypt" },
{ "bcrypt_a", "$2a$", 22, 22, 2, "bcrypt (obsolete $2a$ version)" }, { "bcrypt-a", "$2a$", 22, 22, 2, "bcrypt (obsolete $2a$ version)" },
#endif #endif
#if defined HAVE_SHA_CRYPT #if defined HAVE_SHA_CRYPT
/* http://people.redhat.com/drepper/SHA-crypt.txt */ /* http://people.redhat.com/drepper/SHA-crypt.txt */
@ -137,13 +138,6 @@ static const struct crypt_method methods[] = {
#endif #endif
{ "descrypt", "", 2, 2, 0, { "descrypt", "", 2, 2, 0,
N_("standard 56 bit DES-based crypt(3)") }, N_("standard 56 bit DES-based crypt(3)") },
#if XCRYPT_VERSION_NUM >= ((4 << 16) | 5)
{ "sm3crypt", "$sm3$", 0, 0, 1, "ShangMi 3" },
{ "sm3_yescrypt", "$sm3y$", 0, 0, 1, "ShangMi 3 Yescrypt" },
#endif
#if XCRYPT_VERSION_NUM >= ((4 << 16) | 4)
{ "gost_yescrypt", "$gy$", 0, 0, 1, "GOST Yescrypt" },
#endif
#if defined FreeBSD || defined XCRYPT_VERSION_NUM #if defined FreeBSD || defined XCRYPT_VERSION_NUM
{ "nt", "$3$", 0, 0, 0, "NT-Hash" }, { "nt", "$3$", 0, 0, 0, "NT-Hash" },
#endif #endif
@ -279,7 +273,6 @@ int main(int argc, char *argv[])
if (!salt_prefix) { if (!salt_prefix) {
/* NULL means that crypt_gensalt will choose one later */ /* NULL means that crypt_gensalt will choose one later */
rounds_str[0] = '\0';
} else if (rounds_support == 2) { } else if (rounds_support == 2) {
/* bcrypt strings always contain the rounds number */ /* bcrypt strings always contain the rounds number */
if (rounds <= 5) if (rounds <= 5)
@ -332,8 +325,6 @@ int main(int argc, char *argv[])
* Build the actual argument to crypt(3) by concatenating the * Build the actual argument to crypt(3) by concatenating the
* method prefix, the rounds metadata (if any) and the salt string. * method prefix, the rounds metadata (if any) and the salt string.
*/ */
if (!salt_prefix)
salt_prefix = "";
salt = NOFAIL(malloc(strlen(salt_prefix) + strlen(rounds_str) salt = NOFAIL(malloc(strlen(salt_prefix) + strlen(rounds_str)
+ strlen(salt_arg) + 1)); + strlen(salt_arg) + 1));
*salt = '\0'; *salt = '\0';
@ -393,21 +384,11 @@ int main(int argc, char *argv[])
exit(2); exit(2);
} }
} else { } else {
#ifdef HAVE_READPASSPHRASE
const size_t size = 128;
password = NOFAIL(malloc(size));
if (!readpassphrase(_("Password: "), password, size, 0)) {
perror("readpassphrase");
exit(2);
}
#else
password = getpass(_("Password: ")); password = getpass(_("Password: "));
if (!password) { if (!password) {
perror("getpass"); perror("getpass");
exit(2); exit(2);
} }
#endif
} }
{ {
@ -440,7 +421,6 @@ int main(int argc, char *argv[])
*/ */
inline void *get_random_bytes(const unsigned int count) inline void *get_random_bytes(const unsigned int count)
{ {
(void)(count); /* suppress the "unused parameter" warning */
return NULL; return NULL;
} }
@ -559,7 +539,7 @@ void NORETURN display_help(int error)
void display_version(void) void display_version(void)
{ {
printf("mkpasswd %s\n\n", VERSION); printf("mkpasswd %s\n\n", VERSION);
puts("Copyright (C) Marco d'Itri\n" puts("Copyright (C) 2001-2021 Marco d'Itri\n"
"This is free software; see the source for copying conditions. There is NO\n" "This is free software; see the source for copying conditions. There is NO\n"
"warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."); "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.");
} }

View File

@ -73,12 +73,14 @@ auspost
author author
auto auto
autos autos
avianca
aws aws
axa axa
azure azure
baby baby
baidu baidu
banamex banamex
bananarepublic
band band
bank bank
bar bar
@ -99,6 +101,7 @@ bcn
beats beats
beauty beauty
beer beer
bentley
berlin berlin
best best
bestbuy bestbuy
@ -173,6 +176,7 @@ catholic
cba cba
cbn cbn
cbre cbre
cbs
center center
ceo ceo
cern cern
@ -195,6 +199,7 @@ citadel
citi citi
citic citic
city city
cityeats
claims claims
cleaning cleaning
click click
@ -209,6 +214,7 @@ codes
coffee coffee
college college
cologne cologne
comcast
commbank commbank
community community
company company
@ -239,6 +245,7 @@ cruises
cuisinella cuisinella
cymru cymru
cyou cyou
dabur
dad dad
dance dance
data data
@ -282,6 +289,7 @@ download
drive drive
dtv dtv
dubai dubai
dunlop
dupont dupont
durban durban
dvag dvag
@ -303,6 +311,7 @@ ericsson
erni erni
esq esq
estate estate
etisalat
eurovision eurovision
eus eus
events events
@ -358,6 +367,7 @@ free
fresenius fresenius
frl frl
frogans frogans
frontdoor
frontier frontier
ftr ftr
fujitsu fujitsu
@ -398,6 +408,7 @@ godaddy
gold gold
goldpoint goldpoint
golf golf
goo
goodyear goodyear
goog goog
google google
@ -410,6 +421,7 @@ green
gripe gripe
grocery grocery
group group
guardian
gucci gucci
guge guge
guide guide
@ -503,11 +515,13 @@ juniper
kaufen kaufen
kddi kddi
kerryhotels kerryhotels
kerrylogistics
kerryproperties kerryproperties
kfh kfh
kia kia
kids kids
kim kim
kinder
kindle kindle
kitchen kitchen
kiwi kiwi
@ -523,6 +537,7 @@ kyoto
lacaixa lacaixa
lamborghini lamborghini
lamer lamer
lancaster
land land
landrover landrover
lanxess lanxess
@ -551,6 +566,7 @@ limited
limo limo
lincoln lincoln
link link
lipsy
live live
living living
llc llc
@ -624,8 +640,10 @@ msd
mtn mtn
mtr mtr
music music
mutual
nab nab
nagoya nagoya
natura
navy navy
nba nba
nec nec
@ -648,6 +666,7 @@ ninja
nissan nissan
nissay nissay
nokia nokia
northwesternmutual
norton norton
now now
nowruz nowruz
@ -662,6 +681,7 @@ office
okinawa okinawa
olayan olayan
olayangroup olayangroup
oldnavy
ollo ollo
omega omega
one one
@ -716,6 +736,7 @@ pohl
poker poker
politie politie
porn porn
pramerica
praxi praxi
press press
prime prime
@ -742,6 +763,7 @@ realtor
realty realty
recipes recipes
red red
redstone
redumbrella redumbrella
rehab rehab
reise reise
@ -765,6 +787,7 @@ ricoh
ril ril
rio rio
rip rip
rocher
rocks rocks
rodeo rodeo
rogers rogers
@ -793,6 +816,7 @@ save
saxo saxo
sbi sbi
sbs sbs
sca
scb scb
schaeffler schaeffler
schmidt schmidt
@ -817,6 +841,7 @@ sexy
sfr sfr
shangrila shangrila
sharp sharp
shaw
shell shell
shia shia
shiksha shiksha
@ -825,6 +850,7 @@ shop
shopping shopping
shouji shouji
show show
showtime
silk silk
sina sina
singles singles
@ -901,6 +927,7 @@ theatre
tiaa tiaa
tickets tickets
tienda tienda
tiffany
tips tips
tires tires
tirol tirol
@ -960,6 +987,7 @@ viva
vivo vivo
vlaanderen vlaanderen
vodka vodka
volkswagen
volvo volvo
vote vote
voting voting
@ -990,6 +1018,7 @@ windows
wine wine
winners winners
wme wme
wolterskluwer
woodside woodside
work work
works works
@ -999,6 +1028,7 @@ wtc
wtf wtf
xbox xbox
xerox xerox
xfinity
xihuan xihuan
xin xin
xn--11b4c3d xn--11b4c3d
@ -1059,6 +1089,7 @@ xn--kcrx77d1x4a
xn--kput3i xn--kput3i
xn--mgba3a3ejt xn--mgba3a3ejt
xn--mgba7c0bbn0a xn--mgba7c0bbn0a
xn--mgbaakc7dvf
xn--mgbab2bd xn--mgbab2bd
xn--mgbca7dzdo xn--mgbca7dzdo
xn--mgbi4ecexp xn--mgbi4ecexp

View File

@ -5,7 +5,7 @@
-afrinic whois.afrinic.net -afrinic whois.afrinic.net
-ap whois.apnic.net -ap whois.apnic.net
-cznic whois.nic.cz -cznic whois.nic.cz
-dk whois.punktum.dk -dk whois.dk-hostmaster.dk
-il whois.isoc.org.il -il whois.isoc.org.il
-is whois.isnic.is -is whois.isnic.is
-kg whois.kg -kg whois.kg

View File

@ -20,13 +20,13 @@
# los siguientes documentos: # los siguientes documentos:
# #
# - El proyecto de traducción de Debian al español # - El proyecto de traducción de Debian al español
# https://www.debian.org/intl/spanish/ # http://www.debian.org/intl/spanish/
# especialmente las notas y normas de traducción en # especialmente las notas y normas de traducción en
# https://www.debian.org/intl/spanish/notas # http://www.debian.org/intl/spanish/notas
# #
# - La guía de traducción de po's de debconf: # - La guía de traducción de po's de debconf:
# /usr/share/doc/po-debconf/README-trans # /usr/share/doc/po-debconf/README-trans
# o https://www.debian.org/intl/l10n/po-debconf/README-trans # o http://www.debian.org/intl/l10n/po-debconf/README-trans
# #
msgid "" msgid ""
msgstr "" msgstr ""

View File

@ -1,14 +1,14 @@
# Polish translation for whois. # Polish translation for whois.
# Michał 'CeFeK' Nazarewicz <cefek@career.pl>, 1999 # Michał 'CeFeK' Nazarewicz <cefek@career.pl>, 1999
# Przemysław Knycz <djrzulf@pld.org.pl>, 2003 # Przemysław Knycz <djrzulf@pld.org.pl>, 2003
# Jakub Bogusz <qboosh@pld-linux.org>, 2003-2023 # Jakub Bogusz <qboosh@pld-linux.org>, 2003-2019
# #
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: whois 5.5.18\n" "Project-Id-Version: whois 5.5.1\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-01-03 17:52+0100\n" "POT-Creation-Date: 2022-01-03 17:52+0100\n"
"PO-Revision-Date: 2023-10-05 21:30+0200\n" "PO-Revision-Date: 2019-08-28 18:02+0200\n"
"Last-Translator: Jakub Bogusz <qboosh@pld-linux.org>\n" "Last-Translator: Jakub Bogusz <qboosh@pld-linux.org>\n"
"Language-Team: Polish <translation-team-pl@lists.sourceforge.net>\n" "Language-Team: Polish <translation-team-pl@lists.sourceforge.net>\n"
"Language: pl\n" "Language: pl\n"
@ -149,7 +149,7 @@ msgstr ""
"-H ukrycie oświadczeń prawnych\n" "-H ukrycie oświadczeń prawnych\n"
#: ../whois.c:1506 #: ../whois.c:1506
#, c-format #, fuzzy, c-format
msgid "" msgid ""
" --verbose explain what is being done\n" " --verbose explain what is being done\n"
" --no-recursion disable recursion from registry to registrar servers\n" " --no-recursion disable recursion from registry to registrar servers\n"
@ -158,7 +158,6 @@ msgid ""
"\n" "\n"
msgstr "" msgstr ""
" --verbose wyjaśnianie, co się dzieje\n" " --verbose wyjaśnianie, co się dzieje\n"
" --no-recursion wyłączenie rekurencji z serwerów rejestru do rejestratorów\n"
" --help wyświetlenie tego opisu i zakończenie działania\n" " --help wyświetlenie tego opisu i zakończenie działania\n"
" --version wyświetlenie informacji o wersji i zakończenie " " --version wyświetlenie informacji o wersji i zakończenie "
"działania\n" "działania\n"

90
ripe-mail Normal file
View File

@ -0,0 +1,90 @@
From ripe-dbm@ripe.net Mon Jan 27 10:09:59 2003
Return-Path: <ripe-dbm@ripe.net>
Delivered-To: md@wonderland.linux.it
Received: from attila.bofh.it (localhost [127.0.0.1])
by wonderland.linux.it (Postfix/Md) with ESMTP id 582BA33CD5
for <md@wonderland.linux.it>; Mon, 27 Jan 2003 10:09:59 +0100 (CET)
Received: from picard.linux.it (picard.linux.it [::ffff:62.177.1.107])
by attila.bofh.it (Postfix) with ESMTP id 46AE15F966
for <md@wonderland.linux.it>; Mon, 27 Jan 2003 09:03:25 +0100 (CET)
Received: from birch.ripe.net (birch.ripe.net [::ffff:193.0.1.96])
by picard.linux.it (Postfix) with ESMTP id 4A76942B2
for <md@Linux.IT>; Mon, 27 Jan 2003 09:05:01 +0100 (CET)
Received: from x24.ripe.net (x24.ripe.net [193.0.1.24])
by birch.ripe.net (8.12.5/8.11.6) with ESMTP id h0R83NAq030231;
Mon, 27 Jan 2003 09:03:23 +0100
Received: (from ripe-dbm@localhost)
by x24.ripe.net (8.12.4/8.12.6) id h0R83M5k002263;
Mon, 27 Jan 2003 09:03:22 +0100
Message-Id: <200301270803.h0R83M5k002263@x24.ripe.net>
From: RIPE Database Administration <ripe-dbm@ripe.net>
Cc: Can Bican <can@ripe.net>
To: md@Linux.IT
FCC: cur
Subject: Re: NCC#2003013332 Re: [db-wg] IPv6 Whois update
Reply-To: ripe-dbm@ripe.net
X-Organization: RIPE Network Coordination Centre
X-Phone: +31 20 535 4444
X-Fax: +31 20 535 4341
X-Mailer: BaT/0.67
Sender: RIPE Database Manager <ripe-dbm@ripe.net>
Date: Mon, 27 Jan 2003 09:03:21 +0100
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Spam-Status: No, hits=0.6 required=5.0
tests=DEAR_SOMEBODY,QUOTED_EMAIL_TEXT,SIGNATURE_SHORT_DENSE,
SPAM_PHRASE_05_08
version=2.43
X-Spam-Level:
Status: RO
Content-Length: 1239
Lines: 46
Dear Marco d'Itri,
For the month October, 2002:
We had 55 milion queries, 4.3 milion done with your client.
This number is probably not the best indicator as some IPs do a lot of
queries so here are also the statistics for different IP addresses using
your client:
31364 (of 853385) different IP addresses used your client.
If you have any more questions, please contact <ripe-dbm@ripe.net>.
Regards,
Tiago Antao
____________________________
RIPE Database Administration.
Original message follows:
------------------------
On Thursday 23 January 2003 18:52, Marco d'Itri wrote:
> On Jan 23, Can Bican <can@ripe.net> wrote:
> >This is a feature we supported, and we'll keep supporting it. It's a
> > mistake on our side that we'll change promptly, so please don't change
> > the behaviour. We'll make the proxy accept -V switches of these types.
>
> Thank you for your prompt reply.
> BTW, is any statistics about -V arguments available? I wonder how many
> queries are made with my client (i.e. the -V argument matches /^Md/).
I have forwarded your request to ripe-dbm@ripe.net. You can contact that
address if you'd like more/less specific requirements about the counts.
Regards,
--
Can Bican
DB Group
RIPE NCC

View File

@ -1,6 +1,4 @@
# server name encoding optional parameters # server name charset optional parameters
whois.afrinic.net utf-8
whois.apnic.net iso-8859-1
whois.cat utf-8 -C UTF-8 whois.cat utf-8 -C UTF-8
whois.conac.cn utf-8 whois.conac.cn utf-8
whois.corenic.net utf-8 -C UTF-8 whois.corenic.net utf-8 -C UTF-8
@ -8,7 +6,7 @@ whois.online.rs.corenic.net utf-8 -C UTF-8
whois.site.rs.corenic.net utf-8 -C UTF-8 whois.site.rs.corenic.net utf-8 -C UTF-8
whois.lacnic.net utf-8 whois.lacnic.net utf-8
whois.museum utf-8 -C UTF-8 whois.museum utf-8 -C UTF-8
whois.ripe.net utf-8 --charset UTF-8 whois.ripe.net iso-8859-1
whois.nic.llyw.cymru utf-8 whois.nic.llyw.cymru utf-8
whois.nic.gov.scot utf-8 whois.nic.gov.scot utf-8
@ -22,11 +20,11 @@ whois.cira.ca utf-8
whois.nic.ch utf-8 whois.nic.ch utf-8
whois.nic.cl utf-8 whois.nic.cl utf-8
whois.cnnic.cn utf-8 whois.cnnic.cn utf-8
cwhois.cnnic.cn utf-8
whois.nic.cz utf-8 whois.nic.cz utf-8
whois.denic.de utf-8 whois.denic.de utf-8
whois.enum.denic.de utf-8 whois.enum.denic.de utf-8
whois.dk-hostmaster.dk utf-8 --charset=utf-8 whois.dk-hostmaster.dk utf-8 --charset=utf-8
whois.punktum.dk utf-8 --charset=utf-8
whois.tld.ee utf-8 whois.tld.ee utf-8
whois.eu utf-8 whois.eu utf-8
whois.fi iso-8859-1 whois.fi iso-8859-1
@ -38,7 +36,7 @@ whois.nic.hu iso-8859-1
whois.nic.ir utf-8 whois.nic.ir utf-8
whois.isnic.is iso-8859-1 whois.isnic.is iso-8859-1
whois.nic.it utf-8 whois.nic.it utf-8
whois.jprs.jp utf-8 whois.jprs.jp iso-2022-jp
whois.nic.ad.jp iso-2022-jp whois.nic.ad.jp iso-2022-jp
whois.kg cp1251 whois.kg cp1251
whois.nic.or.kr utf-8 whois.nic.or.kr utf-8

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (C) by Marco d'Itri <md@linux.it>. * Copyright 2009 by Marco d'Itri <md@linux.it>.
* *
* simple_recode was inspired by a similar function found in Simon * simple_recode was inspired by a similar function found in Simon
* Josefsson's libidn. * Josefsson's libidn.
@ -15,9 +15,8 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License along * You should have received a copy of the GNU General Public License along
* with this program; if not, see <https://www.gnu.org/licenses/>. * with this program; if not, write to the Free Software Foundation, Inc.,
* * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* SPDX-License-Identifier: GPL-2.0-or-later
*/ */
#include <stdlib.h> #include <stdlib.h>

View File

@ -1,4 +1,3 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
#ifndef SIMPLE_RECODE_H #ifndef SIMPLE_RECODE_H
#define SIMPLE_RECODE_H #define SIMPLE_RECODE_H

View File

@ -1,4 +1,4 @@
# https://www.iana.org/domains/root/db/ # http://www.iana.org/domains/root/db/
# #
# Domain names MUST be lowercase and MUST begin with "." or "-". # Domain names MUST be lowercase and MUST begin with "." or "-".
# First match wins. # First match wins.
@ -45,7 +45,7 @@
.gov.wales whois.nic.gov.wales .gov.wales whois.nic.gov.wales
.edu whois.educause.edu .edu whois.educause.edu
.gov whois.nic.gov .gov whois.dotgov.gov
.int whois.iana.org .int whois.iana.org
.mil NONE .mil NONE
@ -59,26 +59,26 @@
.biz whois.nic.biz .biz whois.nic.biz
.cat whois.nic.cat .cat whois.nic.cat
.coop whois.nic.coop .coop whois.nic.coop
.info NONE .info whois.afilias.net
.jobs NONE .jobs whois.nic.jobs
.mobi NONE .mobi whois.afilias.net
.museum whois.nic.museum .museum whois.nic.museum
.name whois.nic.name .name whois.nic.name
.post whois.nic.post .post whois.dotpostregistry.net
.pro NONE .pro whois.nic.pro
.tel whois.nic.tel .tel whois.nic.tel
.travel NONE .travel whois.nic.travel
.xxx whois.nic.xxx .xxx whois.nic.xxx
.ac whois.nic.ac .ac whois.nic.ac
.ad whois.nic.ad .ad NONE # www.nic.ad
.ae whois.aeda.net.ae .ae whois.aeda.net.ae
.af whois.nic.af .af whois.nic.af
.ag whois.nic.ag .ag whois.nic.ag
.ai whois.nic.ai .ai whois.nic.ai
.al NONE # www.akep.al .al NONE # www.akep.al
.am whois.amnic.net .am whois.amnic.net
.ao WEB https://www.dns.ao/ao/whois/ # www.dns.ao .ao WEB https://www.dns.ao/ao/gca/index.php?id=19 # www.dns.ao
.aq NONE # 2day.com .aq NONE # 2day.com
.ar whois.nic.ar .ar whois.nic.ar
.as whois.nic.as .as whois.nic.as
@ -88,9 +88,9 @@
.aw whois.nic.aw .aw whois.nic.aw
.ax whois.ax # www.ax .ax whois.ax # www.ax
.gov.az WEB https://www.gov.az/ .gov.az WEB https://www.gov.az/
.az WEB https://whois.az/ .az WEB http://whois.az/
.ba WEB https://nic.ba/ .ba WEB http://www.nic.ba/stream/whois/
.bb WEB https://whois.telecoms.gov.bb/ .bb WEB http://whois.telecoms.gov.bb/search_domain.php
.bd WEB https://bdia.btcl.com.bd/ .bd WEB https://bdia.btcl.com.bd/
.be whois.dns.be .be whois.dns.be
.bf whois.registre.bf # http://www.arcep.bf/noms-de-domaine/ .bf whois.registre.bf # http://www.arcep.bf/noms-de-domaine/
@ -99,7 +99,7 @@
.bi whois1.nic.bi .bi whois1.nic.bi
.bj whois.nic.bj .bj whois.nic.bj
#.bl #.bl
.bm whois.nic.bm .bm whois.afilias-srs.net
.bn whois.bnnic.bn .bn whois.bnnic.bn
.bo whois.nic.bo .bo whois.nic.bo
#.bq #.bq
@ -109,7 +109,7 @@
.bv NONE # http://www.norid.no/domenenavnbaser/bv-sj.html .bv NONE # http://www.norid.no/domenenavnbaser/bv-sj.html
.by whois.cctld.by .by whois.cctld.by
.bw whois.nic.net.bw .bw whois.nic.net.bw
.bz RECURSIVE whois.identitydigital.services .bz RECURSIVE whois.afilias-grs.info
.co.ca whois.co.ca .co.ca whois.co.ca
.ca whois.cira.ca .ca whois.cira.ca
.cc VERISIGN ccwhois.verisign-grs.com .cc VERISIGN ccwhois.verisign-grs.com
@ -120,30 +120,30 @@
.ci whois.nic.ci .ci whois.nic.ci
.ck NONE .ck NONE
.cl whois.nic.cl .cl whois.nic.cl
.cm whois.nic.cm .cm whois.netcom.cm
.edu.cn whois.edu.cn .edu.cn whois.edu.cn
.cn whois.cnnic.cn .cn whois.cnnic.cn
.uk.co whois.uk.co .uk.co whois.uk.co
.co whois.registry.co .co whois.nic.co
.cr whois.nic.cr .cr whois.nic.cr
.cu WEB https://www.nic.cu/ .cu WEB http://www.nic.cu/
.cv whois.nic.cv .cv WEB http://www.dns.cv/
.cw NONE # https://www.uoc.cw/cw-registry .cw NONE # https://www.uoc.cw/cw-registry
.cx whois.nic.cx .cx whois.nic.cx
.cy WEB https://www.nic.cy/cy-ui/home .cy WEB https://www.nic.cy/cy-ui/home
.cz whois.nic.cz .cz whois.nic.cz
.de whois.denic.de .de whois.denic.de
.dj NONE # http://www.dj/ .dj NONE # http://www.dj/
.dk whois.punktum.dk .dk whois.dk-hostmaster.dk
.dm whois.dmdomains.dm .dm whois.dmdomains.dm
.do whois.nic.do .do whois.nic.do
.dz whois.nic.dz .dz whois.nic.dz
.ec whois.nic.ec .ec whois.nic.ec
.ee whois.tld.ee .ee whois.tld.ee
.eg NONE # https://domain.eg/ .eg NONE # http://lookup.egregistry.eg/english.aspx
#.eh #.eh
.er NONE # http://www.afridns.org/er/tld_er.txt .er NONE # http://www.afridns.org/er/tld_er.txt
.es WEB https://www.dominios.es/en .es WEB https://www.nic.es/
.et NONE # http://www.ethionet.et/ .et NONE # http://www.ethionet.et/
.eu whois.eu .eu whois.eu
.fi whois.fi .fi whois.fi
@ -159,17 +159,17 @@
.gf whois.mediaserv.net .gf whois.mediaserv.net
.gg whois.gg .gg whois.gg
.gh whois.nic.gh .gh whois.nic.gh
.gi whois.identitydigital.services .gi whois2.afilias-grs.net
.gl whois.nic.gl .gl whois.nic.gl
.gm WEB http://www.nic.gm/htmlpages/whois.htm .gm WEB http://www.nic.gm/htmlpages/whois.htm
.gn whois.ande.gov.gn .gn NONE # http://www.psg.com/dns/gn/
.gp whois.nic.gp .gp whois.nic.gp
.gq WEB http://www.dominio.gq/en/whois.html .gq whois.dominio.gq
.gr WEB https://grweb.ics.forth.gr/public/whois?lang=en .gr WEB https://grweb.ics.forth.gr/public/whois
.gs whois.nic.gs .gs whois.nic.gs
.gt WEB https://www.gt/sitio/?lang=en .gt WEB http://www.gt/
.gu NONE .gu NONE
.gw WEB https://registar.nic.gw/en/whois/ .gw WEB http://nic.gw/en/whois/
.gy whois.registry.gy .gy whois.registry.gy
.hk whois.hkirc.hk .hk whois.hkirc.hk
.hm whois.registry.hm .hm whois.registry.hm
@ -181,7 +181,7 @@
.ie whois.weare.ie .ie whois.weare.ie
.il whois.isoc.org.il .il whois.isoc.org.il
.im whois.nic.im .im whois.nic.im
.in whois.nixiregistry.in .in whois.registry.in
.io whois.nic.io .io whois.nic.io
.iq whois.cmc.iq # http://www.cmc.iq/en/iq.html .iq whois.cmc.iq # http://www.cmc.iq/en/iq.html
.ir whois.nic.ir .ir whois.nic.ir
@ -189,7 +189,7 @@
.it whois.nic.it .it whois.nic.it
.je whois.je .je whois.je
.jm NONE # http://myspot.mona.uwi.edu/mits/ .jm NONE # http://myspot.mona.uwi.edu/mits/
.jo WEB https://www.domain.jo/FirstPageen.aspx .jo WEB https://www.dns.jo/en.aspx
.jp whois.jprs.jp .jp whois.jprs.jp
.ke whois.kenic.or.ke .ke whois.kenic.or.ke
.kg whois.kg .kg whois.kg
@ -204,7 +204,7 @@
.kz whois.nic.kz .kz whois.nic.kz
.la whois.nic.la .la whois.nic.la
.lb whois.lbdr.org.lb .lb whois.lbdr.org.lb
.lc RECURSIVE whois.identitydigital.services .lc whois2.afilias-grs.net
.li whois.nic.li .li whois.nic.li
.lk whois.nic.lk .lk whois.nic.lk
.lr NONE # http://www.psg.com/dns/lr/ .lr NONE # http://www.psg.com/dns/lr/
@ -214,23 +214,23 @@
.lv whois.nic.lv .lv whois.nic.lv
.ly whois.nic.ly .ly whois.nic.ly
.ma whois.registre.ma .ma whois.registre.ma
.mc whois.nic.mc .mc NONE # www.nic.mc
.md whois.nic.md .md whois.nic.md
.me RECURSIVE whois.nic.me # whois.identitydigital.services .me whois.nic.me # afilias
#.mf #.mf
.mg whois.nic.mg .mg whois.nic.mg
.mh NONE # www.nic.net.mh .mh NONE # www.nic.net.mh
.mk whois.marnet.mk .mk whois.marnet.mk
.ml whois.nic.ml .ml whois.dot.ml # www.point.ml
.mm whois.registry.gov.mm .mm whois.registry.gov.mm
.mn whois.nic.mn .mn whois.nic.mn
.mo WEB https://www.monic.mo/monic/faces/whois # whois.monic.mo is restricted .mo WEB http://www.monic.mo/ # whois.monic.mo is restricted
.mp NONE # get.mp .mp NONE # get.mp
.mq whois.mediaserv.net .mq whois.mediaserv.net
.mr whois.nic.mr .mr whois.nic.mr
.ms whois.nic.ms .ms whois.nic.ms
.mt whois.nic.org.mt .mt whois.nic.org.mt
.mu whois.tld.mu .mu whois.nic.mu
.mv NONE # NIC? www.dhiraagu.com.mv .mv NONE # NIC? www.dhiraagu.com.mv
.mw whois.nic.mw .mw whois.nic.mw
.mx whois.mx .mx whois.mx
@ -241,28 +241,28 @@
.ne NONE # NIC? http://www.intnet.ne .ne NONE # NIC? http://www.intnet.ne
.nf whois.nic.nf .nf whois.nic.nf
.ng whois.nic.net.ng .ng whois.nic.net.ng
.ni WEB https://www.nic.ni/ .ni WEB http://www.nic.ni/
.nl whois.domain-registry.nl .nl whois.domain-registry.nl
.no whois.norid.no .no whois.norid.no
.np WEB https://register.com.np/whois-lookup .np WEB https://register.com.np/whois-lookup
.nr WEB https://www.cenpac.net.nr/dns/whois.html .nr WEB http://www.cenpac.net.nr/dns/whois.html
.nu whois.iis.nu .nu whois.iis.nu
.nz whois.irs.net.nz .nz whois.irs.net.nz
.om whois.registry.om .om whois.registry.om
.pa WEB http://www.nic.pa/en .pa WEB http://www.nic.pa/
.pe kero.yachay.pe .pe kero.yachay.pe
.pf whois.registry.pf .pf whois.registry.pf
.pg whois.nic.pg # https://www.unitech.ac.pg/icts-dns/ .pg NONE # http://www.unitech.ac.pg/
.edu.ph WEB https://services.ph.net/dnshosting/dnshostingquery.pl .edu.ph WEB http://services.ph.net/dns/query.pl
.gov.ph NONE # http://dns.gov.ph/ .gov.ph NONE # http://dns.gov.ph/
.ph WEB https://whois.dot.ph/ .ph WEB https://whois.dot.ph/
.pk whois.pknic.net.pk .pk whois.pknic.net.pk
.co.pl whois.co.pl # "unofficial" SLD .co.pl whois.co.pl # "unofficial" SLD
.pl whois.dns.pl .pl whois.dns.pl
.pm whois.nic.pm .pm whois.nic.pm
.pn WEB https://www.nic.pn/ .pn WEB http://www.pitcairn.pn/PnRegistry/
.pr RECURSIVE whois.nic.pr # whois.identitydigital.services .pr whois.afilias-srs.net
.ps WEB https://www.pnina.ps/ .ps whois.pnina.ps
.pt whois.dns.pt .pt whois.dns.pt
.pw whois.nic.pw .pw whois.nic.pw
.py WEB https://www.nic.py/consultdompy.php .py WEB https://www.nic.py/consultdompy.php
@ -283,8 +283,8 @@
.rw whois.ricta.org.rw # http://www.ricta.org.rw/ .rw whois.ricta.org.rw # http://www.ricta.org.rw/
.sa whois.nic.net.sa .sa whois.nic.net.sa
.sb whois.nic.net.sb .sb whois.nic.net.sb
.sc whois.nic.sc .sc whois2.afilias-grs.net # www.nic.sc
.sd whois.nic.sd .sd whois.sdnic.sd
.se whois.iis.se .se whois.iis.se
.sg whois.sgnic.sg .sg whois.sgnic.sg
.sh whois.nic.sh .sh whois.nic.sh
@ -295,14 +295,14 @@
.sm whois.nic.sm .sm whois.nic.sm
.sn whois.nic.sn .sn whois.nic.sn
.so whois.nic.so .so whois.nic.so
.sr whois.sr # https://isp.datasur.sr/ .sr NONE # www.register.sr
.ss whois.nic.ss .ss whois.nic.ss
.st whois.nic.st .st whois.nic.st
.msk.su whois.flexireg.net .msk.su whois.flexireg.net
.nov.su whois.flexireg.net .nov.su whois.flexireg.net
.spb.su whois.flexireg.net .spb.su whois.flexireg.net
.su whois.tcinet.ru .su whois.tcinet.ru
.sv WEB https://svnet.sv/ .sv WEB http://www.svnet.org.sv/
.sx whois.sx .sx whois.sx
.sy whois.tld.sy .sy whois.tld.sy
.sz NONE # http://www.sispa.org.sz/ .sz NONE # http://www.sispa.org.sz/
@ -316,9 +316,9 @@
.tl whois.nic.tl .tl whois.nic.tl
.tm whois.nic.tm .tm whois.nic.tm
.tn whois.ati.tn .tn whois.ati.tn
.to whois.tonicregistry.to .to whois.tonic.to
.tr whois.trabis.gov.tr .tr whois.trabis.gov.tr
.tt WEB https://www.nic.tt/cgi-bin/search.pl .tt WEB http://www.nic.tt/cgi-bin/search.pl
.tv RECURSIVE whois.nic.tv .tv RECURSIVE whois.nic.tv
.tw whois.twnic.net.tw .tw whois.twnic.net.tw
.tz whois.tznic.or.tz .tz whois.tznic.or.tz
@ -328,30 +328,33 @@
.ua whois.ua .ua whois.ua
.ug whois.co.ug .ug whois.co.ug
.ac.uk whois.nic.ac.uk .ac.uk whois.nic.ac.uk
.bl.uk NONE
.british-library.uk NONE
.gov.uk whois.gov.uk .gov.uk whois.gov.uk
.mil.uk NONE .icnet.uk NONE
.jet.uk NONE
.mod.uk NONE .mod.uk NONE
.nhs.uk NONE .nhs.uk NONE
.nls.uk NONE
.parliament.uk NONE .parliament.uk NONE
.police.uk NONE
.uk whois.nic.uk .uk whois.nic.uk
#.um #.um
.fed.us whois.nic.gov .fed.us whois.nic.gov
.us whois.nic.us .us whois.nic.us
.com.uy WEB https://nic.com.uy/consulta-whois .com.uy WEB https://nic.com.uy/public/consulta-whois/acceder.action
.gub.uy WEB https://www.dominios.gub.uy/ .uy whois.nic.org.uy
.mil.uy WEB https://www.dominios.gub.uy/
.uy WEB https://www.nic.uy/
.uz whois.cctld.uz .uz whois.cctld.uz
.va NONE .va NONE
.vc RECURSIVE whois.identitydigital.services .vc whois2.afilias-grs.net
.ve whois.nic.ve .ve whois.nic.ve
.vg whois.nic.vg .vg whois.nic.vg
.vi whois.nic.vi .vi WEB https://secure.nic.vi/whois-lookup/
.vn WEB http://www.vnnic.vn/en .vn WEB http://www.vnnic.vn/en
.vu whois.dnrs.vu .vu whois.dnrs.vu
.wf whois.nic.wf .wf whois.nic.wf
.ws whois.website.ws .ws whois.website.ws
.ye whois.y.net.ye .ye NONE # NIC? http://www.y.net.ye/services/domain_name.htm
.yt whois.nic.yt .yt whois.nic.yt
.ac.za whois.ac.za .ac.za whois.ac.za
.alt.za WEB https://whois.alt.za/ .alt.za WEB https://whois.alt.za/
@ -361,70 +364,70 @@
.net.za net-whois.registry.net.za .net.za net-whois.registry.net.za
.org.za org-whois.registry.net.za .org.za org-whois.registry.net.za
.web.za web-whois.registry.net.za .web.za web-whois.registry.net.za
.za whois.nic.za .za NONE # https://www.nic.za/za-domains/
.zm whois.zicta.zm .zm whois.zicta.zm
.zw NONE # http://www.zispa.co.zw/ .zw NONE # http://www.zispa.co.zw/
# AW means that I had to guess the whois server name, but I was not able # AW means that I had to guess the whois server name, but I was not able
# to find any registered subdomains to verify it. # to find any registered subdomains to verify it.
.xn--2scrj9c whois.nixiregistry.in # India .xn--2scrj9c whois.registry.in # India
.xn--3e0b707e whois.kr # Korea, Republic of .xn--3e0b707e whois.kr # Korea, Republic of
.xn--3hcrj9c whois.nixiregistry.in # India .xn--3hcrj9c whois.registry.in # India
.xn--45br5cyl whois.nixiregistry.in # India .xn--45br5cyl whois.registry.in # India
.xn--45brj9c whois.nixiregistry.in # India, Bengali .xn--45brj9c whois.registry.in # India, Bengali
.xn--4dbrk0ce whois.isoc.org.il # Israel .xn--4dbrk0ce whois.isoc.org.il # Israel
.xn--54b7fta0cc WEB https://bdia.btcl.com.bd/ # Bangladesh .xn--54b7fta0cc NONE # Bangladesh
.xn--80ao21a whois.nic.kz # Kazakhstan .xn--80ao21a whois.nic.kz # Kazakhstan
.xn--90a3ac whois.rnids.rs # Serbia .xn--90a3ac whois.rnids.rs # Serbia
.xn--90ae whois.imena.bg # Bulgaria .xn--90ae whois.imena.bg # Bulgaria
.xn--90ais whois.cctld.by # Belarus .xn--90ais whois.cctld.by # Belarus
.xn--clchc0ea0b2g2a9gcd whois.ta.sgnic.sg # Singapore, Tamil .xn--clchc0ea0b2g2a9gcd whois.sgnic.sg # Singapore, Tamil
.xn--d1alf whois.marnet.mk # Macedonia .xn--d1alf whois.marnet.mk # Macedonia
.xn--e1a4c whois.eu # European Union, Cyrillic .xn--e1a4c whois.eu # European Union, Cyrillic
.xn--fiqs8s whois.cnnic.cn # China, Simplified Chinese .xn--fiqs8s cwhois.cnnic.cn # China, Simplified Chinese
.xn--fiqz9s whois.cnnic.cn # China, Traditional Chinese .xn--fiqz9s cwhois.cnnic.cn # China, Traditional Chinese
.xn--fpcrj9c3d whois.nixiregistry.in # India, Telugu .xn--fpcrj9c3d whois.registry.in # India, Telugu
.xn--fzc2c9e2c whois.nic.lk # Sri Lanka, Sinhala .xn--fzc2c9e2c whois.nic.lk # Sri Lanka, Sinhala
.xn--gecrj9c whois.nixiregistry.in # India, Gujarati .xn--gecrj9c whois.registry.in # India, Gujarati
.xn--h2breg3eve whois.nixiregistry.in # India .xn--h2breg3eve whois.registry.in # India
.xn--h2brj9c8c whois.nixiregistry.in # India .xn--h2brj9c8c whois.registry.in # India
.xn--h2brj9c whois.nixiregistry.in # India, Hindi .xn--h2brj9c whois.registry.in # India, Hindi
.xn--j1amh whois.dotukr.com # Ukraine .xn--j1amh whois.dotukr.com # Ukraine
.xn--j6w193g whois.hkirc.hk # Hong Kong .xn--j6w193g whois.hkirc.hk # Hong Kong
.xn--kprw13d whois.twnic.net.tw # Taiwan, Simplified Chinese .xn--kprw13d whois.twnic.net.tw # Taiwan, Simplified Chinese
.xn--kpry57d whois.twnic.net.tw # Taiwan, Traditional Chinese .xn--kpry57d whois.twnic.net.tw # Taiwan, Traditional Chinese
.xn--l1acc whois.mn # Mongolia .xn--l1acc NONE # Mongolia
.xn--lgbbat1ad8j whois.nic.dz # Algeria .xn--lgbbat1ad8j whois.nic.dz # Algeria
.xn--mgb9awbf whois.registry.om # Oman .xn--mgb9awbf whois.registry.om # Oman
.xn--mgba3a4f16a whois.nic.ir # Iran .xn--mgba3a4f16a whois.nic.ir # Iran
.xn--mgbaam7a8h whois.aeda.net.ae # United Arab Emirates .xn--mgbaam7a8h whois.aeda.net.ae # United Arab Emirates
.xn--mgbah1a3hjkrd whois.nic.mr # Mauritania .xn--mgbah1a3hjkrd whois.nic.mr # Mauritania
.xn--mgbai9azgqp6j NONE # Pakistan .xn--mgbai9azgqp6j NONE # Pakistan
.xn--mgbayh7gpa WEB https://www.domain.jo/FirstPageen.aspx # Jordan .xn--mgbayh7gpa WEB https://www.dns.jo/en.aspx # Jordan
.xn--mgbbh1a71e whois.nixiregistry.in # India, Urdu .xn--mgbbh1a71e whois.registry.in # India, Urdu
.xn--mgbbh1a whois.nixiregistry.in # India .xn--mgbbh1a whois.registry.in # India
.xn--mgbc0a9azcg NONE # Morocco .xn--mgbc0a9azcg NONE # Morocco
.xn--mgbcpq6gpa1a NONE # Bahrain .xn--mgbcpq6gpa1a NONE # Bahrain
.xn--mgberp4a5d4ar whois.nic.net.sa # Saudi Arabia .xn--mgberp4a5d4ar whois.nic.net.sa # Saudi Arabia
.xn--mgbgu82a whois.nixiregistry.in # India .xn--mgbgu82a whois.registry.in # India
.xn--mgbpl2fh NONE # Sudan .xn--mgbpl2fh NONE # Sudan
.xn--mgbtx2b whois.cmc.iq # Iraq .xn--mgbtx2b whois.cmc.iq # Iraq
.xn--mgbx4cd0ab whois.mynic.my # Malaysia AW .xn--mgbx4cd0ab whois.mynic.my # Malaysia AW
.xn--mix891f WEB https://www.monic.mo/monic/faces/whois # Macao .xn--mix891f WEB http://www.monic.mo/ # Macao
.xn--node WEB http://რეგისტრაცია.გე/ # Georgia .xn--node whois.itdc.ge # Georgia
.xn--o3cw4h whois.thnic.co.th # Thailand .xn--o3cw4h whois.thnic.co.th # Thailand
.xn--ogbpf8fl whois.tld.sy # Syria .xn--ogbpf8fl whois.tld.sy # Syria
.xn--p1ai whois.tcinet.ru # Russian Federation .xn--p1ai whois.tcinet.ru # Russian Federation
.xn--pgbs0dh whois.ati.tn # Tunisia .xn--pgbs0dh whois.ati.tn # Tunisia
.xn--q7ce6a whois.nic.la # Lao .xn--q7ce6a whois.nic.la # Lao
.xn--qxa6a whois.eu # European Union, Greek .xn--qxa6a whois.eu # European Union, Greek
.xn--qxam WEB https://grweb.ics.forth.gr/public/whois?lang=en # Greece .xn--qxam WEB https://grweb.ics.forth.gr/public/whois # Greece
.xn--rvc1e0am3e whois.nixiregistry.in # India .xn--rvc1e0am3e whois.registry.in # India
.xn--s9brj9c whois.nixiregistry.in # India, Punjabi .xn--s9brj9c whois.registry.in # India, Punjabi
.xn--wgbh1c whois.dotmasr.eg # Egypt .xn--wgbh1c whois.dotmasr.eg # Egypt
.xn--wgbl6a whois.registry.qa # Qatar .xn--wgbl6a whois.registry.qa # Qatar
.xn--xkc2al3hye2a whois.nic.lk # Sri Lanka, Tamil .xn--xkc2al3hye2a whois.nic.lk # Sri Lanka, Tamil
.xn--xkc2dl3a5ee0h whois.nixiregistry.in # India, Tamil .xn--xkc2dl3a5ee0h whois.registry.in # India, Tamil
.xn--y9a3aq whois.amnic.net # Armenia .xn--y9a3aq whois.amnic.net # Armenia
.xn--yfro4i67o whois.zh.sgnic.sg # Singapore, Chinese .xn--yfro4i67o whois.sgnic.sg # Singapore, Chinese
.xn--ygbi2ammx NONE # Palestinian Territory .xn--ygbi2ammx whois.pnina.ps # Palestinian Territory

11
utils.c
View File

@ -1,9 +1,9 @@
/* /*
* Copyright by Marco d'Itri <md@linux.it>. * Copyright 1999-2008 by Marco d'Itri <md@linux.it>.
* *
* do_nofail and merge_args come from the module-init-tools package. * do_nofail and merge_args come from the module-init-tools package.
* Copyright by Rusty Russell. * Copyright 2001 by Rusty Russell.
* Copyright by Rusty Russell, IBM Corporation. * Copyright 2002, 2003 by Rusty Russell, IBM Corporation.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@ -16,9 +16,8 @@
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License along * You should have received a copy of the GNU General Public License along
* with this program; if not, see <https://www.gnu.org/licenses/>. * with this program; if not, write to the Free Software Foundation, Inc.,
* * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
* SPDX-License-Identifier: GPL-2.0-or-later
*/ */
/* for strdup */ /* for strdup */

12
utils.h
View File

@ -17,17 +17,8 @@
/* Portability macros */ /* Portability macros */
#ifdef __GNUC__ #ifdef __GNUC__
# define NORETURN __attribute__((noreturn)) # define NORETURN __attribute__((noreturn))
# define NONNULL __attribute__((returns_nonnull))
# define UNUSED __attribute__((unused))
#else #else
# define NORETURN # define NORETURN
# define NONNULL
# define UNUSED
#endif
#if (defined __GNUC__ && __GNUC__ >= 11) && !defined __clang__
# define MALLOC_FREE __attribute__((malloc(free)))
#else
# define MALLOC_FREE
#endif #endif
#ifndef AI_IDN #ifndef AI_IDN
@ -64,8 +55,7 @@
#endif #endif
/* Prototypes */ /* Prototypes */
void *MALLOC_FREE NONNULL do_nofail(void *ptr, const char *file, const int line) void *do_nofail(void *ptr, const char *file, const int line);
;
char **merge_args(char *args, char *argv[], int *argc); char **merge_args(char *args, char *argv[], int *argc);
void NORETURN err_quit(const char *fmt, ...); void NORETURN err_quit(const char *fmt, ...);

68
whois.1
View File

@ -9,16 +9,18 @@ whois \- client for the whois directory service
] [ ] [
.RB {\~ \-p \~|\~ \-\-port \~} .RB {\~ \-p \~|\~ \-\-port \~}
.I PORT .I PORT
] ] [\~\c
.RB [\~ \-abBcdGHIKlLmMrRx .B \-abBcdGHIKlLmMrRx
] ] [\~\c
.RB [\~ \-g \fI\~SOURCE:FIRST\-LAST\fR .BI \-g \~SOURCE:FIRST\-LAST
] ] [\~\c
.RB [\~ \-i .BR \-i \~
.IR ATTR [, ATTR ]...\~] .IR ATTR [, ATTR ]...\~]
.RB [\~ \-s [\~\c
.BR \-s \~
.IR SOURCE [, SOURCE ]...\~] .IR SOURCE [, SOURCE ]...\~]
.RB [\~ \-T [\~\c
.BR \-T \~
.IR TYPE [, TYPE ]...\~] .IR TYPE [, TYPE ]...\~]
.RB [\~ \-\-verbose \~] .RB [\~ \-\-verbose \~]
.RB [\~ \-\-no\-recursion \~] .RB [\~ \-\-no\-recursion \~]
@ -47,15 +49,14 @@ searches for an object in a
database. database.
.P .P
This version of the whois client tries to guess the right server to This version of the whois client tries to guess the right server to
ask for the specified object. ask for the specified object. If no guess can be made it will connect to
If no guess can be made it will connect to
.I whois.networksolutions.com .I whois.networksolutions.com
for NIC handles or for NIC handles or
.I whois.arin.net .I whois.arin.net
for IPv4 addresses and network names. for IPv4 addresses and network names.
.SH OPTIONS .SH OPTIONS
.TP 8 .TP 8
.B \-h .B \-h \c
.IR HOST , .IR HOST ,
.BI \-\-host= HOST .BI \-\-host= HOST
Connect to Connect to
@ -64,7 +65,7 @@ Connect to
.B \-H .B \-H
Do not display the legal disclaimers that some registries like to show you. Do not display the legal disclaimers that some registries like to show you.
.TP 8 .TP 8
.B \-p .B \-p \c
.IR PORT , .IR PORT ,
.BI \-\-port= PORT .BI \-\-port= PORT
Connect to Connect to
@ -74,8 +75,7 @@ Connect to
First query First query
.I whois.iana.org .I whois.iana.org
and then follow its referral to the and then follow its referral to the
whois server authoritative for that request. whois server authoritative for that request. This works for IP addresses,
This works for IP addresses,
AS numbers and domains. AS numbers and domains.
.BR BEWARE : .BR BEWARE :
this implies that the IANA server will receive your complete query. this implies that the IANA server will receive your complete query.
@ -113,7 +113,7 @@ Return the smallest IP address range with a reference to an irt object.
.B \-d .B \-d
Return the reverse DNS delegation object too. Return the reverse DNS delegation object too.
.TP 8 .TP 8
.B \-g .B \-g \c
.I SOURCE:FIRST\-LAST .I SOURCE:FIRST\-LAST
Search updates from Search updates from
.I SOURCE .I SOURCE
@ -121,13 +121,12 @@ database between
.I FIRST .I FIRST
and and
.I LAST .I LAST
update serial number. update serial number. It is useful to obtain Near Real Time Mirroring stream.
It is useful to obtain Near Real Time Mirroring stream.
.TP 8 .TP 8
.B \-G .B \-G
Disable grouping of associated objects. Disable grouping of associated objects.
.TP 8 .TP 8
.B \-i .B \-i \c
.IR ATTR [, ATTR ]... .IR ATTR [, ATTR ]...
Inverse-search objects having associated attributes. Inverse-search objects having associated attributes.
.I ATTR .I ATTR
@ -136,13 +135,11 @@ is the attribute name, while the positional
argument is the attribute value. argument is the attribute value.
.TP 8 .TP 8
.B \-K .B \-K
Return primary key attributes only. Return primary key attributes only. An exception is the
An exception is the
.I members .I members
attribute of attribute of
.I set .I set
objects, which is always returned. objects, which is always returned. Another exception are all
Another exception are all
attributes of the objects attributes of the objects
.IR organisation , .IR organisation ,
.I person .I person
@ -162,7 +159,7 @@ Return all one level more specific objects.
.B \-M .B \-M
Return all levels of more specific objects. Return all levels of more specific objects.
.TP 8 .TP 8
.B \-q .B \-q \c
.I KEYWORD .I KEYWORD
Return information about the server. Return information about the server.
.I KEYWORD .I KEYWORD
@ -181,7 +178,7 @@ Disable recursive lookups for contact information.
Disable following referrals and force showing the object from the local copy Disable following referrals and force showing the object from the local copy
in the server. in the server.
.TP 8 .TP 8
.B \-s .B \-s \c
.IR SOURCE [, SOURCE ]... .IR SOURCE [, SOURCE ]...
Request the server to search for objects mirrored from Request the server to search for objects mirrored from
.IR SOURCE . .IR SOURCE .
@ -190,18 +187,18 @@ Use the
.I \-q sources .I \-q sources
parameter to obtain a list of valid sources. parameter to obtain a list of valid sources.
.TP 8 .TP 8
.B \-t .B \-t \c
.I TYPE .I TYPE
Return the template for a object of Return the template for a object of
.IR TYPE . .IR TYPE .
.TP 8 .TP 8
.B \-T .B \-T \c
.IR TYPE [, TYPE ]... .IR TYPE [, TYPE ]...
Restrict the search to objects of Restrict the search to objects of
.IR TYPE . .IR TYPE .
Multiple types are separated by a comma. Multiple types are separated by a comma.
.TP 8 .TP 8
.B \-v .B \-v \c
.I TYPE .I TYPE
Return the verbose template for a object of Return the verbose template for a object of
.IR TYPE . .IR TYPE .
@ -209,9 +206,7 @@ Return the verbose template for a object of
.B \-x .B \-x
Search for only exact match on network address prefix. Search for only exact match on network address prefix.
.SH NOTES .SH NOTES
When querying the Verisign gTLDs When querying the Verisign gTLDs (e.g.\& \&.com, \&.net...\&) thin registry servers
(e.g.\& \&.com, \&.net...\&)
thin registry servers
for a domain, the program will automatically prepend the for a domain, the program will automatically prepend the
.I domain .I domain
keyword to only show domain records. The keyword to only show domain records. The
@ -244,8 +239,7 @@ flags have been specified, the program will automatically add the flag
.IR "\-\-show\-handles" . .IR "\-\-show\-handles" .
.P .P
RIPE-specific command line options are ignored when querying non-RIPE RIPE-specific command line options are ignored when querying non-RIPE
servers. servers. This may or may not be the behaviour intended by the user.
This may or may not be the behaviour intended by the user.
When using non-standard query parameters then the command line options When using non-standard query parameters then the command line options
which are not to be interpreted by the client must follow the which are not to be interpreted by the client must follow the
.I \-\- .I \-\-
@ -254,8 +248,7 @@ separator (which marks the beginning of the query string).
If the If the
.I /etc/whois.conf .I /etc/whois.conf
configuration file exists, it will be consulted configuration file exists, it will be consulted
to find a server before applying the normal rules. to find a server before applying the normal rules. Each line of the
Each line of the
file should contain a regular expression to be matched against the query file should contain a regular expression to be matched against the query
text and the whois server to use, separated by white space. text and the whois server to use, separated by white space.
IDN domains must use the ACE format. IDN domains must use the ACE format.
@ -286,8 +279,7 @@ A list of options which will be evaluated before the ones specified on the
command line. command line.
.IP "WHOIS_SERVER" .IP "WHOIS_SERVER"
This server will be queried if the program cannot guess where some kind This server will be queried if the program cannot guess where some kind
of objects are located. of objects are located. If the variable does not exist then
If the variable does not exist then
.I whois.arin.net .I whois.arin.net
will be queried. will be queried.
.SH "SEE ALSO" .SH "SEE ALSO"
@ -297,7 +289,7 @@ will be queried.
WHOIS Protocol Specification. WHOIS Protocol Specification.
.P .P
.IR "RIPE Database Query Reference Manual" : .IR "RIPE Database Query Reference Manual" :
.RI < https://www.ripe.net/\:data\-tools/\:support/\:documentation/\:ripe\-database\-query\-reference\-manual > .RI < http://www.ripe.net/data\-tools/support/documentation/ripe\-database\-query\-reference\-manual >
.SH BUGS .SH BUGS
The program may have buffer overflows in the command line parser: The program may have buffer overflows in the command line parser:
be sure to not pass untrusted data to it. be sure to not pass untrusted data to it.
@ -312,4 +304,4 @@ and this man page were written by Marco d'Itri
.RI < md@linux.it > .RI < md@linux.it >
and are licensed under the terms of the GNU General Public License, and are licensed under the terms of the GNU General Public License,
version 2 or later. version 2 or later.
.\" SPDX-License-Identifier: GPL-2.0-or-later \" SPDX-License-Identifier: GPL-2.0-or-later

530
whois.c
View File

@ -1,19 +1,11 @@
/* /*
* Copyright (C) Marco d'Itri <md@linux.it>. * Copyright (C) 1999-2022 Marco d'Itri <md@linux.it>.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, see <https://www.gnu.org/licenses/>.
*
* SPDX-License-Identifier: GPL-2.0-or-later * SPDX-License-Identifier: GPL-2.0-or-later
*/ */
@ -48,13 +40,6 @@
#include <idna.h> #include <idna.h>
#endif #endif
/* prototypes referenced in data.h */
static void find_referral_server_apnic(char **, const char *);
static void find_referral_server_arin(char **, const char *);
static void find_referral_server_iana(char **, const char *);
static void find_referral_server_recursive(char **, const char *);
static void find_referral_server_verisign(char **, const char *);
/* Application-specific */ /* Application-specific */
#include "version.h" #include "version.h"
#include "data.h" #include "data.h"
@ -326,7 +311,7 @@ int handle_query(const char *hserver, const char *hport,
const char *query, const char *flags) const char *query, const char *flags)
{ {
char *server = NULL, *port = NULL; char *server = NULL, *port = NULL;
char *p, *query_string, *old_server, *new_server; char *p, *query_string;
if (hport) { if (hport) {
server = strdup(hserver); server = strdup(hserver);
@ -359,19 +344,19 @@ int handle_query(const char *hserver, const char *hport,
case 4: case 4:
if (verb) if (verb)
printf(_("Using server %s.\n"), server + 1); printf(_("Using server %s.\n"), server + 1);
old_server = server; sockfd = openconn(server + 1, NULL);
server = query_verisign(server, NULL, query); free(server);
free(old_server); server = query_crsnic(sockfd, query);
if (no_recursion && server) if (no_recursion)
server[0] = '\0'; server[0] = '\0';
break; break;
case 8: case 8:
if (verb) if (verb)
printf(_("Using server %s.\n"), server + 1); printf(_("Using server %s.\n"), server + 1);
old_server = server; sockfd = openconn(server + 1, NULL);
server = query_server(server, NULL, query); free(server);
free(old_server); server = query_afilias(sockfd, query);
if (no_recursion && server) if (no_recursion)
server[0] = '\0'; server[0] = '\0';
break; break;
case 0x0A: case 0x0A:
@ -403,8 +388,9 @@ int handle_query(const char *hserver, const char *hport,
case 0x0E: case 0x0E:
if (verb) if (verb)
printf(_("Using server %s.\n"), "whois.iana.org"); printf(_("Using server %s.\n"), "whois.iana.org");
sockfd = openconn("whois.iana.org", NULL);
free(server); free(server);
server = query_server("whois.iana.org", NULL, query); server = query_iana(sockfd, query);
break; break;
default: default:
break; break;
@ -422,17 +408,15 @@ int handle_query(const char *hserver, const char *hport,
printf(_("Query string: \"%s\"\n\n"), query_string); printf(_("Query string: \"%s\"\n\n"), query_string);
} }
new_server = query_server(server, port, query_string); sockfd = openconn(server, port);
free(server);
if (port) server = do_query(sockfd, query_string);
free(port);
free(query_string); free(query_string);
/* recursion is fun */ /* recursion is fun */
if (!no_recursion && new_server && !strchr(query, ' ')) { if (!no_recursion && server && !strchr(query, ' ')) {
printf(_("\n\nFound a referral to %s.\n\n"), new_server); printf(_("\n\nFound a referral to %s.\n\n"), server);
handle_query(new_server, NULL, query, flags); handle_query(server, NULL, query, flags);
free(new_server);
} }
return 0; return 0;
@ -510,52 +494,12 @@ const char *match_config_file(const char *s)
} }
#endif #endif
/*
* Check if the argument is an autonomous system number in the form "ASnnnn"
* or "AS nnnn".
*/
int is_asn(const char *s, int allow_space, const char *suffix_separators)
{
const char *p;
int max_numbers = 6;
int seen_number = 0;
if (!strncaseeq(s, "as", 2))
return 0; /* does not start with "as" (case insensitive) */
/* skip a single optional space */
p = s + 2;
if (allow_space && *p == ' ')
p++;
/* all numbers, but not too many */
while (*p) {
if (*p < '0' || *p > '9') { /* not a number */
if (!seen_number)
return 0; /* just "as" with no numbers */
if (suffix_separators && strchr(suffix_separators, *p))
return 1; /* has a trailing separator */
return 0; /* has trailing garbage */
}
seen_number = 1;
if (max_numbers-- == 0)
return 0; /* too many numbers */
p++;
}
if (seen_number)
return 1; /* a real ASN */
else
return 0; /* trailing garbage */
}
/* Parses an user-supplied string and tries to guess the right whois server. /* Parses an user-supplied string and tries to guess the right whois server.
* Returns a dynamically allocated buffer. * Returns a dynamically allocated buffer.
*/ */
char *guess_server(const char *s) char *guess_server(const char *s)
{ {
unsigned long ip; unsigned long ip, as32;
unsigned int i; unsigned int i;
const char *colon, *tld; const char *colon, *tld;
@ -564,8 +508,12 @@ char *guess_server(const char *s)
unsigned long v6prefix, v6net; unsigned long v6prefix, v6net;
/* RPSL hierarchical objects */ /* RPSL hierarchical objects */
if (is_asn(s, 0, ":")) if (strncaseeq(s, "as", 2)) {
return strdup(whereas(atol(s + 2))); if (isasciidigit(s[2]))
return strdup(whereas(atol(s + 2)));
else
return strdup("");
}
v6prefix = strtol(s, NULL, 16); v6prefix = strtol(s, NULL, 16);
@ -600,14 +548,19 @@ char *guess_server(const char *s)
/* no dot and no hyphen means it's a NSI NIC handle or ASN (?) */ /* no dot and no hyphen means it's a NSI NIC handle or ASN (?) */
if (!strpbrk(s, ".-")) { if (!strpbrk(s, ".-")) {
if (is_asn(s, 1, NULL)) if (strncaseeq(s, "as", 2) && /* it's an AS */
return strdup(whereas(atol(s + 2))); /* it's an AS */ (isasciidigit(s[2]) || s[2] == ' '))
return strdup(whereas(atol(s + 2)));
if (*s == '!') /* NSI NIC handle */ if (*s == '!') /* NSI NIC handle */
return strdup("whois.networksolutions.com"); return strdup("whois.networksolutions.com");
else else
return strdup("\x05"); /* probably a unknown kind of nic handle */ return strdup("\x05"); /* probably a unknown kind of nic handle */
} }
/* ASN32? */
if (strncaseeq(s, "as", 2) && s[2] && (as32 = asn32_to_long(s + 2)) != 0)
return strdup(whereas32(as32));
/* smells like an IP? */ /* smells like an IP? */
if ((ip = myinet_aton(s))) { if ((ip = myinet_aton(s))) {
for (i = 0; ip_assign[i].serv; i++) for (i = 0; ip_assign[i].serv; i++)
@ -650,10 +603,23 @@ char *guess_server(const char *s)
return strdup("\x05"); return strdup("\x05");
} }
const char *whereas32(const unsigned long asn)
{
int i;
for (i = 0; as32_assign[i].serv; i++)
if (asn >= as32_assign[i].first && asn <= as32_assign[i].last)
return as32_assign[i].serv;
return "\x06";
}
const char *whereas(const unsigned long asn) const char *whereas(const unsigned long asn)
{ {
int i; int i;
if (asn > 65535)
return whereas32(asn);
for (i = 0; as_assign[i].serv; i++) for (i = 0; as_assign[i].serv; i++)
if (asn >= as_assign[i].first && asn <= as_assign[i].last) if (asn >= as_assign[i].first && asn <= as_assign[i].last)
return as_assign[i].serv; return as_assign[i].serv;
@ -722,20 +688,18 @@ char *queryformat(const char *server, const char *flags, const char *query)
else if (strchr(query, ' ') || *flags) { } else if (strchr(query, ' ') || *flags) { }
else if (streq(server, "whois.denic.de") && in_domain(query, "de")) else if (streq(server, "whois.denic.de") && in_domain(query, "de"))
strcat(buf, "-T dn" DENIC_PARAM_ACE DENIC_PARAM_CHARSET " "); strcat(buf, "-T dn" DENIC_PARAM_ACE DENIC_PARAM_CHARSET " ");
else if ((streq(server, "whois.punktum.dk") || else if (streq(server, "whois.dk-hostmaster.dk") && in_domain(query, "dk"))
streq(server, "whois.dk-hostmaster.dk"))
&& in_domain(query, "dk"))
strcat(buf, "--show-handles "); strcat(buf, "--show-handles ");
/* mangle and add the query string */ /* mangle and add the query string */
if (!isripe && streq(server, "whois.nic.ad.jp") && if (!isripe && streq(server, "whois.nic.ad.jp") &&
is_asn(query, 1, NULL)) { strncaseeq(query, "AS", 2) && isasciidigit(query[2])) {
strcat(buf, "AS "); strcat(buf, "AS ");
strcat(buf, query + 2); strcat(buf, query + 2);
} }
else if (!isripe && streq(server, "whois.arin.net") && else if (!isripe && streq(server, "whois.arin.net") &&
!strrchr(query, ' ')) { !strrchr(query, ' ')) {
if (is_asn(query, 0, NULL)) { if (strncaseeq(query, "AS", 2) && isasciidigit(query[2])) {
strcat(buf, "a "); strcat(buf, "a ");
strcat(buf, query + 2); strcat(buf, query + 2);
} else if (myinet_aton(query) || strchr(query, ':')) { } else if (myinet_aton(query) || strchr(query, ':')) {
@ -752,12 +716,8 @@ char *queryformat(const char *server, const char *flags, const char *query)
/* ask for english text */ /* ask for english text */
if (!isripe && (streq(server, "whois.nic.ad.jp") || if (!isripe && (streq(server, "whois.nic.ad.jp") ||
streq(server, "whois.jprs.jp")) && japanese_locale()) { streq(server, "whois.jprs.jp")) && japanese_locale())
/* but not if the user already added the /e flag */ strcat(buf, "/e");
char *flag = buf + strlen(buf) - 2;
if (!streq(flag, "/e"))
strcat(buf, "/e");
}
return buf; return buf;
} }
@ -804,218 +764,55 @@ int hide_line(int *hiding, const char *const line)
return 0; return 0;
} }
static void find_referral_server_apnic(char **referral_server, const char *buf)
{
/* Possible states of this FSM:
* 0: searching for the descr or mnt-by attribute
* 1: searching for the mnt-by attribute (descr found)
* 2: searching for the descr attribute (mnt-by found)
* 3: searching for the end of the object (an empty line)
* 4: done: stop searching
*
* Since the descr attribute is user-provided, consider it only if it
* is in an object actually maintained by APNIC.
*
* If multiple records are returned then it users the referral in the
* first valid object found.
*/
static int state = 0;
static char *rir_name = NULL;
char *p;
if (state == 4)
return;
if (state <= 2) {
if (strneq(buf, "descr:", 6)) {
p = (char *)buf + 6; /* skip until the colon */
for (; *p == ' ' || *p == '\t'; p++); /* skip white space */
if (strneq(p, "Transferred to the ", 19)) {
rir_name = strdup(p + 19);
if ((p = strpbrk(rir_name, " ")))
*p = '\0';
if (state == 0)
state = 1; /* still needs mnt-by */
else
state = 3;
}
} else if (strneq(buf, "mnt-by:", 7)) {
p = (char *)buf + 7; /* skip until the colon */
for (; *p == ' ' || *p == '\t'; p++); /* skip white space */
if (streq(p, "APNIC-STUB")) {
if (state == 0)
state = 2; /* still needs descr */
else
state = 3;
}
} else if (streq(buf, "")) {
if (state == 1)
free(rir_name);
state = 0; /* start again with a new object */
}
return;
}
if (state == 3 && streq(buf, "")) {
int i;
const char *rir_servers[] = {
"AFRINIC", "whois.afrinic.net",
"ARIN", "whois.arin.net",
"LACNIC", "whois.lacnic.net",
"RIPE", "whois.ripe.net",
NULL, NULL,
};
state = 4;
for (i = 0; rir_servers[i]; i += 2)
if (streq(rir_name, rir_servers[i]))
*referral_server = strdup(rir_servers[i + 1]);
free(rir_name);
}
}
static void find_referral_server_arin(char **referral_server, const char *buf)
{
char *p;
/* ARIN referrals:
* ReferralServer: rwhois://rwhois.fuse.net:4321/
* ReferralServer: whois://whois.ripe.net
* ReferralServer: whois.ripe.net
*/
if (!strneq(buf, "ReferralServer:", 15))
return;
/* When whois.arin.net returns multiple NetRange records, they will
* appear from the less specific one to the most specific one.
* Since the range we care about is the most specific one then we
* need to use the last ReferralServer field found.
*/
if (*referral_server) {
free(*referral_server);
*referral_server = NULL;
}
if ((p = strstr(buf, "rwhois://")))
*referral_server = strdup(p + 9);
else if ((p = strstr(buf, "whois://")))
*referral_server = strdup(p + 8);
else
*referral_server = strdup(buf + 17);
if (*referral_server && (p = strpbrk(*referral_server, "/")))
*p = '\0';
}
static void find_referral_server_iana(char **referral_server, const char *buf)
{
const char *p;
if (*referral_server)
return;
/* IANA referrals:
* refer: whois.apnic.net
*/
if (!strneq(buf, "refer:", 6))
return;
p = buf + 6; /* skip until the colon */
for (; *p == ' ' || *p == '\t'; p++); /* skip white space */
*referral_server = strdup(p);
}
static void find_referral_server_recursive(char **referral_server, const char *buf)
{
static int state = 0;
const char *p;
if (*referral_server)
return;
if (state == 0 && strneq(buf, "Domain Name:", 12))
state = 1;
else if (state == 1 && strneq(buf, "Domain Name:", 12))
state = 2;
else if (state == 1 && strneq(buf, "Registrar WHOIS Server:", 23)) {
p = buf + 23; /* skip until the colon */
for (; *p && *p == ' '; p++); /* skip the spaces */
*referral_server = strdup(p);
state = 2;
}
}
static void find_referral_server_verisign(char **referral_server, const char *buf)
{
static int state = 0;
const char *p;
if (*referral_server)
return;
/* If there are multiple matches only the server of the first record
* is queried */
if (state == 0 && strneq(buf, " Domain Name:", 15)) {
state = 1;
} else if (state == 0 && strneq(buf, " Server Name:", 15)) {
*referral_server = strdup("");
state = 2;
} else if (state == 1 && strneq(buf, " Registrar WHOIS Server:", 26)) {
p = buf + 26; /* skip until the colon */
for (; *p && *p == ' '; p++); /* skip the spaces */
*referral_server = strdup(p);
state = 2;
}
}
/* returns a string which should be freed by the caller, or NULL */ /* returns a string which should be freed by the caller, or NULL */
char *query_server(const char *server, const char *port, const char *query) char *do_query(const int sock, const char *query)
{ {
char *temp, *p, buf[2000]; char *temp, *p, buf[2000];
FILE *fi; FILE *fi;
int hide = hide_discl; int hide = hide_discl;
int sock, i;
char *referral_server = NULL; char *referral_server = NULL;
void (*referral_handler)(char **referral_server, const char *buf) = NULL;
temp = malloc(strlen(query) + 2 + 1); temp = malloc(strlen(query) + 2 + 1);
strcpy(temp, query); strcpy(temp, query);
strcat(temp, "\r\n"); strcat(temp, "\r\n");
for (i = 0; server_referral_handlers[i].name; i++) {
/* If the first character is not printable then it represents
* a general category of servers in the list.
*/
if (server[0] < ' ' &&
strneq(server_referral_handlers[i].name, server, 1)) {
server++;
referral_handler = server_referral_handlers[i].handler;
break;
} else if (streq(server_referral_handlers[i].name, server)) {
referral_handler = server_referral_handlers[i].handler;
break;
}
}
sock = openconn(server, port);
fi = fdopen(sock, "r"); fi = fdopen(sock, "r");
if (!fi)
err_sys("fdopen");
if (write(sock, temp, strlen(temp)) < 0) if (write(sock, temp, strlen(temp)) < 0)
err_sys("write"); err_sys("write");
free(temp); free(temp);
while (fgets(buf, sizeof(buf), fi)) { while (fgets(buf, sizeof(buf), fi)) {
alarm(20); /* reset the timeout */ /* 6bone-style referral:
if ((p = strpbrk(buf, "\r\n"))) /* remove the trailing CR/LF */ * % referto: whois -h whois.arin.net -p 43 as 1
*p = '\0'; */
if (!referral_server && strneq(buf, "% referto:", 10)) {
char nh[256], np[16], nq[1024];
if (referral_handler) if (sscanf(buf, REFERTO_FORMAT, nh, np, nq) == 3) {
referral_handler(&referral_server, buf); /* XXX we are ignoring the new query string */
referral_server = malloc(strlen(nh) + 1 + strlen(np) + 1);
sprintf(referral_server, "%s:%s", nh, np);
}
}
/* ARIN referrals:
* ReferralServer: rwhois://rwhois.fuse.net:4321/
* ReferralServer: whois://whois.ripe.net
*/
if (!referral_server && strneq(buf, "ReferralServer:", 15)) {
if ((p = strstr(buf, "rwhois://")))
referral_server = strdup(p + 9);
else if ((p = strstr(buf, "whois://")))
referral_server = strdup(p + 8);
if (referral_server && (p = strpbrk(referral_server, "/\r\n")))
*p = '\0';
}
if (hide_line(&hide, buf)) if (hide_line(&hide, buf))
continue; continue;
if ((p = strpbrk(buf, "\r\n")))
*p = '\0';
recode_fputs(buf, stdout); recode_fputs(buf, stdout);
fputc('\n', stdout); fputc('\n', stdout);
} }
@ -1028,20 +825,16 @@ char *query_server(const char *server, const char *port, const char *query)
err_quit(_("Catastrophic error: disclaimer text has been changed.\n" err_quit(_("Catastrophic error: disclaimer text has been changed.\n"
"Please upgrade this program.\n")); "Please upgrade this program.\n"));
/* defensive programming: make sure to avoid trivial referral loops */
if (referral_server && streq(server, referral_server)) {
free(referral_server);
referral_server = NULL;
}
return referral_server; return referral_server;
} }
char *query_verisign(const char *server, const char *port, const char *query) char *query_crsnic(const int sock, const char *query)
{ {
char *temp, *p; char *temp, *p, buf[2000];
int sock; FILE *fi;
int hide = hide_discl;
char *referral_server = NULL; char *referral_server = NULL;
int state = 0;
int dotscount = 0; int dotscount = 0;
temp = malloc(strlen("domain ") + strlen(query) + 2 + 1); temp = malloc(strlen("domain ") + strlen(query) + 2 + 1);
@ -1055,9 +848,140 @@ char *query_verisign(const char *server, const char *port, const char *query)
if (dotscount == 1 && !strpbrk(query, "=~ ")) if (dotscount == 1 && !strpbrk(query, "=~ "))
strcpy(temp, "domain "); strcpy(temp, "domain ");
strcat(temp, query); strcat(temp, query);
strcat(temp, "\r\n");
referral_server = query_server(server, port, temp); fi = fdopen(sock, "r");
if (write(sock, temp, strlen(temp)) < 0)
err_sys("write");
free(temp); free(temp);
while (fgets(buf, sizeof(buf), fi)) {
/* If there are multiple matches only the server of the first record
is queried */
if (state == 0 && strneq(buf, " Domain Name:", 15))
state = 1;
if (state == 0 && strneq(buf, " Server Name:", 15)) {
referral_server = strdup("");
state = 2;
}
if (state == 1 && strneq(buf, " Registrar WHOIS Server:", 26)) {
for (p = buf; *p != ':'; p++); /* skip until the colon */
for (p++; *p == ' '; p++); /* skip the spaces */
referral_server = strdup(p);
if ((p = strpbrk(referral_server, "\r\n ")))
*p = '\0';
state = 2;
}
/* the output must not be hidden or no data will be shown for
host records and not-existing domains */
if (hide_line(&hide, buf))
continue;
if ((p = strpbrk(buf, "\r\n")))
*p = '\0';
recode_fputs(buf, stdout);
fputc('\n', stdout);
}
if (ferror(fi))
err_sys("fgets");
fclose(fi);
return referral_server;
}
char *query_afilias(const int sock, const char *query)
{
char *temp, *p, buf[2000];
FILE *fi;
int hide = hide_discl;
char *referral_server = NULL;
int state = 0;
temp = malloc(strlen(query) + 2 + 1);
strcpy(temp, query);
strcat(temp, "\r\n");
fi = fdopen(sock, "r");
if (write(sock, temp, strlen(temp)) < 0)
err_sys("write");
free(temp);
while (fgets(buf, sizeof(buf), fi)) {
/* If multiple attributes are returned then use the first result.
This is not supposed to happen. */
if (state == 0 && strneq(buf, "Domain Name:", 12))
state = 1;
if (state == 1 && strneq(buf, "Registrar WHOIS Server:", 23)) {
for (p = buf; *p != ':'; p++); /* skip until colon */
for (p++; *p == ' '; p++); /* skip colon and spaces */
referral_server = strdup(p);
if ((p = strpbrk(referral_server, "\r\n ")))
*p = '\0';
state = 2;
}
/* the output must not be hidden or no data will be shown for
host records and not-existing domains */
if (hide_line(&hide, buf))
continue;
if ((p = strpbrk(buf, "\r\n")))
*p = '\0';
recode_fputs(buf, stdout);
fputc('\n', stdout);
}
if (ferror(fi))
err_sys("fgets");
fclose(fi);
if (hide > HIDE_NOT_STARTED && hide != HIDE_TO_THE_END)
err_quit(_("Catastrophic error: disclaimer text has been changed.\n"
"Please upgrade this program.\n"));
return referral_server;
}
char *query_iana(const int sock, const char *query)
{
char *temp, *p, buf[2000];
FILE *fi;
char *referral_server = NULL;
int state = 0;
temp = malloc(strlen(query) + 2 + 1);
strcpy(temp, query);
strcat(temp, "\r\n");
fi = fdopen(sock, "r");
if (write(sock, temp, strlen(temp)) < 0)
err_sys("write");
free(temp);
while (fgets(buf, sizeof(buf), fi)) {
/* If multiple attributes are returned then use the first result.
This is not supposed to happen. */
if (state == 0 && strneq(buf, "refer:", 6)) {
for (p = buf; *p != ':'; p++); /* skip until colon */
for (p++; *p == ' '; p++); /* skip colon and spaces */
referral_server = strdup(p);
if ((p = strpbrk(referral_server, "\r\n ")))
*p = '\0';
state = 2;
}
if ((p = strpbrk(buf, "\r\n")))
*p = '\0';
recode_fputs(buf, stdout);
fputc('\n', stdout);
}
if (ferror(fi))
err_sys("fgets");
fclose(fi);
return referral_server; return referral_server;
} }
@ -1081,7 +1005,7 @@ int openconn(const char *server, const char *port)
if (AFL_MODE) if (AFL_MODE)
return dup(0); return dup(0);
alarm(20); alarm(60);
#ifdef HAVE_GETADDRINFO #ifdef HAVE_GETADDRINFO
memset(&hints, 0, sizeof(struct addrinfo)); memset(&hints, 0, sizeof(struct addrinfo));
@ -1197,7 +1121,7 @@ int connect_with_timeout(int fd, const struct sockaddr *addr,
return 0; return 0;
} }
void NORETURN alarm_handler(UNUSED int signum) void NORETURN alarm_handler(int signum)
{ {
close(sockfd); close(sockfd);
err_quit(_("Timeout.")); err_quit(_("Timeout."));
@ -1309,12 +1233,6 @@ char *normalize_domain(const char *dom)
} }
#if defined HAVE_LIBIDN || defined HAVE_LIBIDN2 #if defined HAVE_LIBIDN || defined HAVE_LIBIDN2
/* A leading ! means that this probably is a RADB query, so skip IDN
* processing because it would lower-case the command characters.
*/
if (*ret == '!')
return ret;
/* find the start of the last word if there are spaces in the query */ /* find the start of the last word if there are spaces in the query */
for (p = ret; *p; p++) for (p = ret; *p; p++)
if (*p == ' ') if (*p == ' ')
@ -1556,12 +1474,26 @@ unsigned long myinet_aton(const char *s)
return (a << 24) + (b << 16) + (c << 8) + d; return (a << 24) + (b << 16) + (c << 8) + d;
} }
unsigned long asn32_to_long(const char *s)
{
unsigned long a, b;
char junk;
if (!s)
return 0;
if (sscanf(s, "%lu.%lu%c", &a, &b, &junk) != 2)
return 0;
if (a > 65535 || b > 65535)
return 0;
return (a << 16) + b;
}
int isasciidigit(const char c) int isasciidigit(const char c)
{ {
return (c >= '0' && c <= '9') ? 1 : 0; return (c >= '0' && c <= '9') ? 1 : 0;
} }
/* https://www.ripe.net/ripe/docs/databaseref-manual.html */ /* http://www.ripe.net/ripe/docs/databaseref-manual.html */
void NORETURN usage(int error) void NORETURN usage(int error)
{ {

12
whois.h
View File

@ -1,19 +1,24 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */ /* SPDX-License-Identifier: GPL-2.0-or-later */
#include "utils.h" #include "utils.h"
/* 6bone referto: extension */
#define REFERTO_FORMAT "%% referto: whois -h %255s -p %15s %1021[^\n\r]"
#define HIDE_TO_THE_END -3 #define HIDE_TO_THE_END -3
#define HIDE_DISABLED -2 #define HIDE_DISABLED -2
#define HIDE_NOT_STARTED -1 #define HIDE_NOT_STARTED -1
/* prototypes */ /* prototypes */
int is_asn(const char *, int, const char *);
char *guess_server(const char *); char *guess_server(const char *);
const char *match_config_file(const char *); const char *match_config_file(const char *);
const char *whereas(const unsigned long); const char *whereas(const unsigned long);
const char *whereas32(const unsigned long);
char *queryformat(const char *, const char *, const char *); char *queryformat(const char *, const char *, const char *);
int hide_line(int *hiding, const char *const line); int hide_line(int *hiding, const char *const line);
char *query_server(const char *, const char *, const char *); char *do_query(const int, const char *);
char *query_verisign(const char *, const char *, const char *); char *query_crsnic(const int, const char *);
char *query_afilias(const int, const char *);
char *query_iana(const int, const char *);
int openconn(const char *, const char *); int openconn(const char *, const char *);
int connect_with_timeout(int, const struct sockaddr *, socklen_t, int); int connect_with_timeout(int, const struct sockaddr *, socklen_t, int);
void NORETURN usage(int error); void NORETURN usage(int error);
@ -21,6 +26,7 @@ void NORETURN alarm_handler(int);
void NORETURN sighandler(int); void NORETURN sighandler(int);
int japanese_locale(void); int japanese_locale(void);
unsigned long myinet_aton(const char *); unsigned long myinet_aton(const char *);
unsigned long asn32_to_long(const char *);
int isasciidigit(const char); int isasciidigit(const char);
int endstrcaseeq(const char *, const char *); int endstrcaseeq(const char *, const char *);
int in_domain(const char *, const char *); int in_domain(const char *, const char *);