Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

distributed-dig

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

distributed-dig

A utility which makes DNS lookup requests across multiple DNS resolvers and collates the results.

  • 1.5.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
45
increased by542.86%
Maintainers
1
Weekly downloads
 
Created
Source

distributed-dig

Version npm bundle size Codacy Badge GitHub issues Known Vulnerabilities Libraries.io dependency status for latest release Downloads Licence

Quick Start

Installation

Install globally:

npm install -g distributed-dig

Usage

Lookup a single domain:

ddig domain

ddig [domain]


Overview

A utility which makes DNS lookup requests across multiple DNS resolvers and collates the results.

Useful for checking if a DNS record has been fully propagated, or for querying the origins behind an AWS Route 53 / Azure Traffic Manager record (or any other DNS-based load balancing solution).


Installation

Installing globally is recommended:

npm install -g distributed-dig

Usage

ddig domain [domain [domain] ...] [options]

Options

The following options are available:

--port <number>                  Specify the DNS port [53]
--protocol <upd|tcp>             Specify the DNS protocol [udp]
--timeout <number>               Specify the DNS timeout in milliseconds [2500]
--edns <true|false>              Enable or disable EDNS(0) [false]
--config <filename>              Specify an alternative configuration file
--list-resolvers                 List resolvers configured in config file
--list-options                   List DNS request options configured in config file
--list-defaults                  Print json of default config file settings
--verbose                        Outputs more information
--no-color                       Switches off colour output
--version                        Display version number
--help                           Display this help

port

Specify the TCP/UDP port tro use when connecting to the DNS resolver. Default: 53

protocol

Specify whether to use UDP or TCP when connecting to the DNS resolver. Default: udp

timeout

Specifies the timeout in milliseconds to wait for a response from each DNS resolver. Default: 2500 (2.5 seconds)

edns

Enables EDNS(0) Default: false (disabled)

With EDNS(0) enabled, if an upstream resolver doesn't support it then the standard DNS will be used as a fallback. Even though EDNS is support by ~90% of resolvers on the internet 1, it is disabled by default in ddig as it may cause the resolver to return the IP address it considers closest to you, which is counter-productive to the purpose of querying many geographically distributed DNS resolvers.

config

Specifies an alternative configuration file.

To create a custom config you can:

  1. pipe --list-defaults to a new file: ddig --list-defaults > custom.json
  2. Edit custom.json
  3. Use the new configuration file: ddig --config [path]custom.json example.com

list-resolvers

Lists the resolvers configured in the distributed-dig.json config file:

ddig --list-resolvers

list-options

Lists the options configured in the distributed-dig.json config file:

ddig --list-options

list-defaults

Prints out a sample default config file in raw json. Pipe it to a file for an initial customised configuration file.

verbose

Switches on verbose mode which outputs the following additional fields:

  • Full recursive answer (i.e. nested cname records)
  • Resolver IP Address
  • Response time

ddig www.asos.com --verbose

--verbose also modifies the --list-resolvers and --list-options switches.

no-color

If your terminal has problems rendering the colour output then you can switch it off by using --no-color.

version

Prints out distributed-dig's version number.

help

Displays the help screen:

ddig --help


Examples

Lookup a single domain

  • List the IP address returned for www.asos.com from each of the configured resolver:
ddig www.asos.com

ddig www.asos.com

Lookup a single domain with verbose enabled

  • List the IP address and full recursive path returned for www.asos.com from each of the configured resolver:
ddig www.asos.com --verbose

ddig www.asos.com --verbose

Lookup multiple domains with an increased timeout

  • List the IP addresses returned for both www.asos.com & secure.asos.com from each of the configured resolver with a 5 second timeout:
ddig www.asos.com my.asos.com secure.asos.com --timeout 5000

ddig www.asos.com my.asos.com secure.asos.com


Features

Unique IP Address Identifier

The first occurrence of each unique IP address is marked by a bullet point:

ddig unique IP Address Identifier

Unicode Support

The bullet point character used is U+2022 • BULLET (HTML &#8226;). If it is detected that the output is being piped (to a file or to more | cat) then the ascii character 42 * Asterisk (HTML &ast;)

Column Width Warning

If you use the --verbose switch and have a terminal window that's narrower than 130 columns you'll see a warning:

ddig column width warning


Configuration File

All Options and Resolvers are configured in distributed-dig.json file. This file can exist in any of the following locations:

  • The current working directory - node -p process.cwd()
  • The home directory - node -p require('os').homedir()
  • The application's root directory (i.e. the same directory as distributed-dig.js)

Request Options

The default options are:

"options": {
    "request": {
      "port": 53,
      "type": "udp",
      "timeout": 2500,
      "try_edns": false,
      "cache": false
    },
    "question": {
      "type": "A"
    }
}

DNS Resolvers

Resolvers are configured in an array with each resolver having a nameServer element which should be the IPv4 or IPv6 address, and a provider element which is just a free-form text label:

"resolvers": [
    {
      "nameServer": "208.67.222.222",
      "provider": "OpenDNS (Primary)"
    },
    {
      "nameServer": "208.67.220.220",
      "provider": "OpenDNS (Secondary)"
    },
    {
      "nameServer": "217.199.173.113",
      "provider": "United Kingdom"
    }
]

You can find a list of public DNS servers here and tailor the configured list for your own requirements.


Debugging

distributed-dig uses the npm package debug. If you set the environment variable debug to ddig you'll see full debug output.

Windows

set debug=ddig

Linux

DEBUG=ddig

Powershell

$env:debug="ddig"

Changelog

[1.5.1] - June 19th 2020

Changed
  • Improved the detection and reporting of invalid domains and switches

[1.5.0] - June 19th 2020

Added
  • If you tried to lookup a domain that was invalid, according to the DNS RFC, it was ignored. You'll now see a warning message when ddig ignores an input.
  • Appended a unit suffix to the TTL value.
Changed
  • Removed moment as a dependency and refactored time difference calculations to be handled natively.
  • Increased the recommended columns width to 140 when using the --verbose switch, allowing for the new 'TTL' and record type columns.

[1.4.2] - June 14th 2020

Changed
  • Fixed a bug causing the Record Type to be Unknown due to erroneously locating the json lookup file when install globally.

[1.4.1] - June 14th 2020

Added
  • Added Snyk security checks, and badge to README.
Changed
  • Updated Dependencies.
  • Fixed a bug causing Record Type and TTL column values being undefined.
  • Increased TTL column width and made it right-aligned.

[1.4.0] - March 14th 2020

Added
  • Standard output now includes record type.
Changed
  • Updated dependencies.

[1.3.1] - February 14th 2020

Fixed
  • Fixed a nested array bounds check which resulted in valid domains being reported as non-existent.

[1.3.0] - February 14th 2020

Changed
  • Updated default DNS resolvers list.
  • Updated dependencies.
Fixed
  • Better handling of nxdomain. Non-existent domains aren't DNS errors, just an empty answer - so now handling those more sensibly.

[1.2.2] - November 27th 2019

Changed
  • Fixed npm-shrinkwrap.json problem that prevented npm update succeeding.

[1.2.0] - November 27th 2019

Changed
  • Switched to using chalk instead of colors.
  • Updated dependencies.
  • --list-defaults now pretty-prints the raw json output.

[1.1.4] - November 20th 2019

Changed
  • Use * instead of unicode character • to signify unique IP address when process.stdout.isTTY is false 1.
  • Updated Dependencies.
  • Shrink-wrapped npm dependencies.

[1.1.3] - November 13th 2019

Changed
  • Added --verbose support tp --help to display more information.
  • Dabbled with using chalk instead of colors (on --help output).
  • Updated dependency yargs to version 14.2.0
  • Fixed a cross-platform file path separator bug.

[1.1.2] - September 25th 2019

Changed
  • Removed unneeded dependency valid-filename.
  • Updated dependency colors to version 1.4.0
  • Improved reporting on configuration file location when directory is ..
  • Improved debug logging.
  • Improved reporting on an empty answer (i.e. no error, but no IP address returned).

[1.1.1] - September 21st 2019

Changed
  • Fixed a problem when specifying a full path with the --config option.
  • Fixed erroneous warnings when using --config.

[1.1.0] - September 20th 2019

Added
  • New --config option to specify an alternative configuration file.
  • New --list-defaults option which prints a default config json file to the console; useful as an initial custom configuration file.
Changed
  • Improved input validation for --timeout & --protocol.
  • Improved the Warning logic for ignored domains to remove erroneous warnings with valid switches and options.

[1.0.4] - September 17th 2019

  • Fixed file system path separator problem when attempting to locate a config file on Linux systems.

[1.0.0] - September 17th 2019

  • Initial Release.

FAQ

Question: What terminal/console are you using in the screen shots?

Answer: A pre-release of Microsoft's new tabbed Windows Terminal which has many excellent features, and the ability to configure a background image.

Footnotes

  1. Internet Systems Consortium - Partial EDNS Compliance Hampers Deployment of New DNS Features 2

Keywords

FAQs

Package last updated on 19 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc