npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

whoiser-json

v1.0.0

Published

Whois info for TLDs, domains and IPs

Downloads

12

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.

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:

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

Unsupported TLDs

  • .ch - WHOIS server for .ch doesn't return WHOIS info, works only in browser https://www.nic.ch/whois/. This library can be used only to check .ch domain availability, example here https://runkit.com/andreiigna/5efdeaa8e4f2d8001a00312d

More

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

License

MIT

Copyright (c) Andrei Igna, Layered