A behaviour-compatible Rust reimplementation of the Debian whois client and mkpasswd. The goal is byte-identical output, exit codes and server selection. RDAP is included as an additional mode. Prebuilt binaries are attached to the rolling latest release and to every v* tag: Verify with SHA256SUMS. Homebrew: brew install -y rmoriz/tools/whois-rmoriz alias whois=whois-rmoriz whois nic.google The formula installs whois-rmoriz and mkpasswd-rmoriz, so the commands do not shadow /usr/bin/whois or the mkpasswd shipped with expect. Building Debian/Ubuntu: apt install build-essential pkg-config libidn2-dev libcrypt-dev gettext cargo build --release brew install libidn2 libxcrypt gettext pkg-config cargo build --release FreeBSD: pkg install -y rust pkgconf libidn2 cargo build --release OpenBSD and NetBSD: pkg_add rust libidn2 pkgconf cargo build --release The BSDs must be built natively: each has its own libc, and the client links libidn2, POSIX regex and getopt_long, so there is no usable cross sysroot. Without libxcrypt, mkpasswd builds with pure-Rust fallbacks: auto then maps to SHA-512, and yescrypt/scrypt/sm3/nt are unavailable. With libxcrypt, the method list matches the Debian build. Examples whois münchen.de # German ccTLD, WHOIS (DENIC) whois nic.google # RDAP-only gTLD, automatically uses RDAP whois nic.vermögensberater # IDN gTLD, converted to punycode whois nic.天主教 # CJK IDN gTLD IDN input is normalized to punycode before the lookup; the mode is chosen per TLD (RDAP when a server is known, otherwise WHOIS). cargo test cargo fmt --check cargo clippy --all-targets -- -D warnings The golden tests compare against the C reference build: scripts/build-reference.sh --container # Debian, byte-exact WHOIS_REF_DIR=$PWD/tests/tmp/ref cargo test --test fidelity Locally on macOS: scripts/build-reference.sh WHOIS_REF_DIR=$PWD/tests/tmp/ref cargo test --test fidelity The locale and mkpasswd golden tests run automatically when the reference build supports them. Installing make install PREFIX=/usr DESTDIR=/tmp/stage Installs whois, mkpasswd, the man pages (whois.1, whois.conf.5, mkpasswd.1), the .mo catalogs and the bash completions. CONFIG_FILE (default /etc/whois.conf), LOCALEDIR and BASHCOMPDIR can be overridden. data/ — unmodified upstream lists from which build.rs generates the tables po/ — unmodified translations; embedded into the binary reference/ — C reference (gitignored) src/whois/ — client, query logic, protocol handling src/mkpasswd/ — methods, salt construction, CLI tests/fidelity.rs — golden harness Platforms Linux (x86_64 and aarch64), macOS (x86_64/aarch64) and the amd64 BSDs (FreeBSD, OpenBSD, NetBSD) are built in CI; the BSD jobs are best effort and compile the port natively in a VM. Windows is not supported natively: the port relies on Unix getopt_long, POSIX regex, signals, iconv and Unix socket/errno semantics. Windows via WSL Use the Linux binary inside WSL — it is the same client, not a reduced port: wsl --install -d Ubuntu sudo apt install -y libidn2-0 libcrypt1 curl -fsSLO https://github.com/rmoriz/whois/releases/latest/download/whois-x86_64-unknown-linux-gnu.tar.gz tar xzf whois-x86_64-unknown-linux-gnu.tar.gz mkdir -p ~/.local/bin install -m755 whois-x86_64-unknown-linux-gnu/whois \ whois-x86_64-unknown-linux-gnu/mkpasswd ~/.local/bin/ whois nic.google ~/.local/bin must be on PATH; /etc/whois.conf and ~/.whois.conf work as on Linux. WSL interop runs the binary, but there is no native .exe build. Release binaries are built for Linux x86_64/aarch64, macOS x86_64/aarch64 and FreeBSD/OpenBSD/NetBSD amd64 on tags matching v*. Every push to main that touches source, build files, data or translations also refreshes a rolling latest release. Assets use stable target names (whois-.tar.gz), so /releases/latest/download/whois-x86_64-apple-darwin.tar.gz always points at the newest build, just like a versioned release. SHA256SUMS ships alongside. Dependabot keeps Cargo and GitHub Actions dependencies current. The macOS tarballs are self-contained: libidn2 and libunistring are linked statically, so only the system libiconv and libSystem remain (WHOIS_STATIC_SYSTEM_LIBS=1 enables this when building locally). The Linux tarballs link libidn2 and libcrypt dynamically, like Debian's own package. The BSD tarballs are native VM builds for amd64 and need libidn2 at runtime (pkg install libidn2 / pkg_add libidn2); OpenBSD also needs libiconv (pkg_add libiconv), because its libc has no iconv(3). WHOIS vs RDAP Without an explicit mode, the first matching rule wins: -h/--host, -p/--port, -I or a RIPE flag → WHOIS a match in whois.conf → WHOIS the TLD appears in data/rdap_defaults → RDAP the TLD appears in the embedded IANA bootstrap → RDAP otherwise guess_server() → WHOIS --whois forces WHOIS and --rdap forces RDAP. In RDAP mode -h provides the base URL (scheme optional, default https) and -p is ignored; if no server is known the command fails with exit status 1. --verbose, --no-recursion, -H, -V and --json do not change the mode. Queries are normalized to punycode before the lookup, and there is no automatic fallback to WHOIS when an RDAP request fails. By default, RDAP responses are rendered as WHOIS-style Key: value output, prefixed with % comments stating that the data was interpolated and naming the RDAP source. Common fields are mapped: domain names, registry ID, the port43 WHOIS server, registrar/abuse/registrant entities, events, status, nameservers, DNSSEC with DS/DNSKEY data, links, IDN variants, redactions and notices. Use --json to print the unmodified JSON body instead. HTTP errors go to stderr with status 1, network/TLS errors with status 2. % Registry redaction: … lines come from the registry's RDAP redacted metadata (e.g. GDPR/ICANN redaction); the client does not remove fields itself. The text rendering is a curated view, so use --json to see every field the server actually returned. Updating data lists data/ is the source of truth for the generated tables; reference/ is only the frozen 5.6.6 C reference. The ASN table is generated from three layers: the IANA 16-bit and 32-bit AS number registries, the five RIR delegated-*-extended-latest files (legacy allocations, transfers and reserved ASNs), data/asn_overrides for NIR and military ranges. scripts/update-as-list.sh The script refreshes the IANA CSV snapshots and the compressed RIR ASN extracts (data/sources/asn-*.tsv.gz, together ~280 KB), regenerates data/as_del_list, prints a semantic diff against the previous table and runs cargo test --test tables. The snapshots are committed, so scripts/generate-as-list.py --check verifies offline that the generated list is current; CI runs exactly that. Use --no-rir for an IANA-only run. Ranges are emitted sorted by their upper bound; build.rs rejects unsorted input. Keep NIR/military exceptions in data/asn_overrides, not in the generated file. The IPv6 table is generated separately from the IANA unicast assignments and data/ipv6_overrides (6to4, Teredo, KRNIC): scripts/update-ip6-list.sh It stays C-compatible and only emits prefixes up to /32, because the runtime compares the first 32 bits. A scheduled GitHub Actions workflow runs every Monday at 03:17 UTC, refreshes all three lists, runs the full test suite and commits/pushes the result. If the refresh or tests fail, it opens or comments on an issue instead. The IPv4 table combines the IANA /8 registry, the RIR delegated records (legacy/transfer deviations) and data/ipv4_overrides (NIR and other hosts): scripts/update-ip4-list.sh data/ip_del_recovered.h remains a separate layer that is included first. Private (10/8) and loopback (127/8) space is routed to ARIN, which answers with an explanation; multicast and future-use /8s stay UNKNOWN. 0/8 remains UNKNOWN as before. Emoji domains Emoji are not valid IDNA2008 and the normal client (like the C original) passes them through unchanged. Use --emoji for a conservative conversion: whois --emoji 😉.to # queries xn--n28h.to whois --emoji 🍕.ws # queries xn--vi8h.ws whois --emoji Ⓜ️icrosoft.com # queries microsoft.com IDNA/UTS-46 runs first, so compatibility emoji that map to text (Ⓜ️→m, ℹ️→i, ™️→tm, 🈁→ココ) are not punycoded. Only labels that IDNA rejects and that contain emoji code points are encoded with raw Punycode (🍕→xn--vi8h). Variation selectors and ZWJ sequences are kept verbatim; if a registry used a different sequence, pass the xn-- form directly. Client identification WHOIS sends -V rmoriz/0.1.0 to RIPE-like servers (overridable with -V TAG). RIPE treats an identifier without a comma as client information only; a comma would trigger proxy accounting and is deliberately not included. RDAP sends Accept: application/rdap+json and User-Agent: whois-rmoriz/0.1.0 (+https://github.com/rmoriz/whois). Port of whois 5.6.6. RDAP is available as an additional mode (--rdap is the default as soon as a server is known; --whois forces WHOIS; the IANA bootstrap is embedded). Per-TLD defaults live in data/rdap_defaults and currently hold the .ws override. Details, the bootstrap query and limitations: docs/rdap.md, scripts/rdap-tlds.sh. Acknowledgements This project is a port of Debian's whois, originally written and maintained by Marco d'Itri. Many thanks to him for his long-standing work on the original client, its data lists and its translations. "In 1999 I wrote this Whois client from scratch because the alternatives were obsolete or bloated." — Marco d'Itri
AI NEWS JOURNAL
Hacker News Show HNAI NEWS / JOURNAL
Show HN: Whois Client with RDAP Support
Article URL: https://github.com/rmoriz/whois Comments URL: https://news.ycombinator.com/item?id=50677513 Points: 1 # Comments: 0