Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

whoiser

LayeredStudio49.7kMIT2.0.0-beta.6TypeScript support: included

Whois info for domains, TLDs, IPs, and ASN

whois, domain, tld, ip

readme

🌍 Whoiser

whoiser is a WHOIS client for Node.js that helps with querying WHOIS servers for TLDs, domain names, AS numbers and IPs.

Has support for auto-discovery WHOIS servers for TLDs and IPs allocators, making it easy to get WHOIS info with a single call like whoiser('google.com') or whoiser('1.1.1.1'). Applies minimal parsing to results, returning same data format from different WHOIS servers.

[!CAUTION] v2 is under active development! The code in main branch is for v2. Breaking changes:

  • ESM only
  • removed whoiser() method, use individual whoisDomain, whoisTld, whoisIp, whoisAsn
  • removed allTlds()

Until v2 dev is complete, install latest v1. The docs below are for v1

Highlights

  • Returns WHOIS info for any internet address
  • Requires zero config, but configurable when needed
  • Recognises queries and routes the request to correct server
  • Minimal parsing to provide consistent results across WHOIS servers
  • Uses WHOIS servers from IANA, if not provided
  • Discover all available TLDs

→ See it in action here https://dmns.app

Getting Started

Installation

npm i whoiser

Usage

The library has a simple API. Use whoiser(query) with any query you would want OR use specific functions with options like whoiser.domain(domain, {options}), whoiser.ip(ip, {options})

Example

const whoiser = require('whoiser')

const domainWhois = whoiser('google.com')
const tldWhois = whoiser('.net')
const ipWhois = whoiser('1.1.1.1')

See all examples

Client API

Domain whois

Get WHOIS info for domains.

whoiser.domain(domain, options): Promise<Object<whoisServer>>

  • domain - Domain name, excluding any subdomain. Ex: 'google.com'
  • options - Object of options to use, all optional:
    • host - WHOIS server to query. Default: WHOIS server from IANA
    • timeout - WHOIS server request timeout in ms. Default: 1500
    • follow - How many WHOIS server to query. 1 = registry server (faster), 2 = registry + registrar (more domain details). Default: 2
    • raw - Return the raw WHOIS result in response. Added to __raw
    • ignorePrivacy - Show or hide the WHOIS protected data from response, accepts boolean. Default: true
const whoiser = require('whoiser');

(async () => {

    // WHOIS info from Registry (Verisign) AND Registrar (MarkMonitor) whois servers
    let domainInfo = await whoiser('google.com')

    // OR with options for whois server and how many WHOIS servers to query
    let domainInfo2 = await whoiser.domain('blog.google', {host: 'whois.nic.google', follow: 1})

    console.log(domainInfo, domainInfo2)
})();

Returns a promise which resolves with an Object of WHOIS servers checked:

{
        "whois.verisign-grs.com": {
                "Domain Name": "GOOGLE.COM",
                "Registrar WHOIS Server": "whois.markmonitor.com",
                ...
        },
        "whois.markmonitor.com": {
                "Domain Name": "google.com",
                "Creation Date": "1997-09-15T00:00:00-0700",
                "Expiry Date": "2020-09-13T21:00:00-0700",
                "Registrar": "MarkMonitor, Inc.",
                "Domain Status": [
                        "clientUpdateProhibited",
                        "clientTransferProhibited"
                ],
                ...
                "Name Server": [
                        "ns1.google.com",
                        "ns2.google.com"
                ],
                "text": [
                        "For more information on WHOIS status codes, please visit:",
                        ...
                ]
        }
}

IP whois

Get WHOIS info for IPs

whoiser.ip(ip, options): Promise<Object>

  • ip - IP. Ex: '1.1.1.1'
  • options - Object of options to use, all optional:
    • host - WHOIS server to query. Default: WHOIS server from IANA
    • timeout - WHOIS server request timeout in ms. Default: 1500
    • raw - Return the raw WHOIS result in response. Added to __raw
const whoiser = require('whoiser');

(async () => {

    // WHOIS info with auto-discovering for WHOIS server
    let ipInfo = await whoiser('1.1.1.1')

    // OR with options for whois server
    let ipInfo2 = await whoiser.ip('8.8.8.8', {host: 'whois.arin.net'})

    console.log(ipInfo, ipInfo2)
})();

Returns a promise which resolves with an Array of WHOIS info lines:

{
    range: '2606:4700:: - 2606:4700:FFFF:FFFF:FFFF:FFFF:FFFF:FFFF',
    route: '2606:4700::/32',
    NetName: 'CLOUDFLARENET',
    NetHandle: 'NET6-2606-4700-1',
    Parent: 'NET6-2600 (NET6-2600-1)',
    NetType: 'Direct Allocation',
    asn: 'AS13335',
    Organization: 'Cloudflare, Inc. (CLOUD14)',
    RegDate: '2011-11-01',
    Updated: '2017-02-17',
    Comment: 'All Cloudflare abuse reporting can be done via  https://www.cloudflare.com/abuse',
}

AS Number whois

Get WHOIS info for an AS number

whoiser.asn(asn, options): Promise<Object>

  • asn - ASN. Ex: 'AS15169' or 15169
  • options - Object of options to use, all optional:
    • host - WHOIS server to query. Default: WHOIS server from IANA
    • timeout - WHOIS server request timeout in ms. Default: 1500
    • raw - Return the raw WHOIS result in response. Added to __raw
const whoiser = require('whoiser');

(async () => {

        // WHOIS info for ASN15169
        let whois = await whoiser.asn(15169)

        console.log(whois)
})();

Returns a promise which resolves with an Object of WHOIS info:

{
    ASNumber: '15169',
    ASName: 'GOOGLE',
    ASHandle: 'AS15169',
    RegDate: '2000-03-30',
    Updated: '2012-02-24',
    Ref: 'https://rdap.arin.net/registry/autnum/15169',
}

Roadmap

Aiming to have these features:

  • <input checked="" disabled="" type="checkbox"> helper function to query WHOIS servers -> whoiser.query()
  • <input checked="" disabled="" type="checkbox"> query whois for TLDs with parsed result -> whoiser.tld()
  • <input checked="" disabled="" type="checkbox"> query whois for domains with parsed result -> whoiser.domain()
  • <input checked="" disabled="" type="checkbox"> query whois for IPs and return parsed result -> whoiser.ip()
  • <input checked="" disabled="" type="checkbox"> query whois for ASN with parsed result -> whoiser.asn()
  • <input checked="" disabled="" type="checkbox"> Punycode support
  • <input disabled="" type="checkbox"> Normalize Domain WHOIS field names, removing inconsistencies between WHOIS servers
  • <input disabled="" type="checkbox"> Test more IPs and ASNs to deliver consistent WHOIS results

Unsupported TLDs

More

Please report any issues here on GitHub. Any contributions are welcome

License

MIT

Copyright (c) Andrei Igna, Layered

changelog

Whoiser change log

1.18.0 - 4 August 2024

  • Added - Parse & normalize WHOIS data for .fr
  • Added - Parse & normalize WHOIS data for .tr #111 (thanks to @popeeyy)

1.17.2 - 5 February 2024

  • Fixed - Properly parse WHOIS data on multi lines for .eu TLD

1.17.0 - 21 April 2023

  • Fixed - Code syntax to allow strict #99
  • Updated - Detect more redacted data in domain WHOIS

1.16.0 - 6 February 2023

  • Added - Option to show/hide domain WHOIS protected data #96
  • Fixed - Include punycode from userland lib a2ee6f9
  • Fixed - Query WHOIS for .de with umlaut in both ASCII/Unicode 5a7ffd1

1.15.0 - 4 February 2023

  • Updated - Improved .it parsing, preserve date structure and more #92
  • Updated - Merge/normalize more WHOIS domain labels
  • Fixed - Uses raw domain for .de TLD in whoisDomain #95
  • Fixed - Query more sources for TLD whois server #86

1.14.0 - 14 January 2023

  • Added - Support for third level domains #80
  • Added - Additional support for TLDs not in the IANA database #80
  • Fixed - Follow RIPE referrals #80
  • Fixed - Parse .gg, .je, and .as whois data correctly #80
  • Fixed - Improved parser for .it whois data #84

1.13.2 - 28 November 2022

  • Updated - Include more WHOIS servers in lib, speeds-up domain WHOIS queries
  • Updated - Detect & remove more redacted WHOIS text

1.13.1 - 5 December 2021

  • Added - Included WHOIS server for .us & .xyz

1.13.0 - 25 June 2021

  • Updated - TypeScript Types #41
  • Updated - Cache more TLD WHOIS servers (.ai, .app, .io, .nyc)
  • Updated - Detect & remove more redacted whois text

1.12.0 - 9 June 2021

  • Added - Utility function whoiser.firstResult() to extract first WHOIS result
  • Updated - TypeScript Types #36 (thanks to @AKorezin)
  • Removed - Automated tests for NodeJS 12

1.11.0 - 12 April 2021

  • Added - TypeScript Types #34 (thanks to @AlexXanderGrib)
  • Updated - Parse WHOIS for .jp domains #35 (thanks to @kuriyama)

1.10.0 - 3 April 2021

  • Updated - Parse WHOIS for co.ua/biz.ua domains; improve parsing for other .ua domains #32 (thanks to @EPolishchuk)
  • Updated - Detect & remove more redacted whois text
  • Fixed - Trim whitespace from whois value when appending data

1.9.2 - 7 Dec 2020

  • Updated - Parse WHOIS for .mx domains

1.9.1 - 10 Nov 2020

  • Added - Cache IP of WHOIS servers (experiment to see if faster)
  • Updated - Detect & remove more redacted whois text

1.9.0 - 11 Sep 2020

  • Removed - Node.js 10 support, removed array-flat polyfill
  • Updated - Detect & remove more redacted whois text

1.8.1 - 13 July 2020

  • Updated - Improved parsing for .ly domains WHOIS
  • Updated - Detect & remove more redacted whois text

1.8.0 - 9 July 2020

  • Updated - Improved parsing for .nl, .ax domain WHOIS #18
  • Updated - Detect & remove more redacted whois text

1.7.4 - 2 July 2020

  • Updated - Detect & remove more redacted whois text

1.7.3 - 16 May 2020

  • Updated - WHOIS date fields for .uk domains are now converted to common format

1.7.2 - 16 May 2020

  • Fixed - Enable WHOIS multi line parser for .uk TLD

1.7.1 - 16 May 2020

  • Fixed - Apply multi lines fix only for TLDs that need it

1.7.0 - 16 May 2020

  • Updated - Improved WHOIS parsing for multi line info (for .be, .eu domains and hopefully others)
  • Updated - Detect & remove more redacted whois text

1.6.6 - 8 April 2020

  • Updated - detect more redacted whois text
  • Fixed - Parse WHOIS lines with double colon #6

1.6.2 - 19 Nov 2019

  • Updated - Merge more WHOIS domain labels
  • Fixed - Return contact info for TLD WHOIS

1.6.1 - 13 Nov 2019

  • Updated - Merge more WHOIS domain labels

1.6.0 - 10 Nov 2019

  • Added - Option to return raw WHOIS data #2
  • Updated - Merge more domain WHOIS labels
  • Updated - Moved JS code to src dir

1.5.0 - 1 Nov 2019

  • Updated - Renamed domain WHOIS labels to make them consistent across WHOIS servers
  • Fixed - Misspelled WHOIS servers

1.4.0 - 25 Jul 2019

  • Updated - Unified code for IP & ASN query, as it's the same
  • Updated - Parse raw whois info for IP & ASN, returns object with same labels across whois servers

1.3.0 - 23 Feb 2019

  • Updated - TLD & domain validator functions
  • Updated - More ignored keywords for domain whois labels

1.2.0 - 12 Feb 2019

  • Added - Support for IDN with Punycode