• Stars
    star
    1,708
  • Rank 27,320 (Top 0.6 %)
  • Language
    Go
  • License
    MIT License
  • Created about 4 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

dnsx is a fast and multi-purpose DNS toolkit allow to run multiple DNS queries of your choice with a list of user-supplied resolvers.

dnsx

A fast and multi-purpose DNS toolkit designed for running DNS queries

Features • Installation • Usage • Running `dnsx` • Wildcard • Notes • Join Discord


dnsx is a fast and multi-purpose DNS toolkit designed for running various probes through the retryabledns library. It supports multiple DNS queries, user supplied resolvers, DNS wildcard filtering like shuffledns etc.

Features

dnsx

  • Simple and Handy utility to query DNS records.
  • A, AAAA, CNAME, PTR, NS, MX, TXT, SRV, SOA query support
  • DNS Resolution / Brute-force support
  • Custom resolver input support
  • Multiple resolver format (TCP/UDP/DOH/DOT) support
  • stdin and stdout support
  • Automatic wildcard handling support

Installation Instructions

dnsx requires go1.19 to install successfully. Run the following command to install the latest version:

go install -v github.com/projectdiscovery/dnsx/cmd/dnsx@latest

Usage

dnsx -h

This will display help for the tool. Here are all the switches it supports.

INPUT:
   -l, -list string      list of sub(domains)/hosts to resolve (file or stdin)
   -d, -domain string    list of domain to bruteforce (file or comma separated or stdin)
   -w, -wordlist string  list of words to bruteforce (file or comma separated or stdin)

QUERY:
   -a      query A record (default)
   -aaaa   query AAAA record
   -cname  query CNAME record
   -ns     query NS record
   -txt    query TXT record
   -srv    query SRV record
   -ptr    query PTR record
   -mx     query MX record
   -soa    query SOA record
   -axfr   query AXFR
   -caa    query CAA record

FILTER:
   -re, -resp          display dns response
   -ro, -resp-only     display dns response only
   -rc, -rcode string  filter result by dns status code (eg. -rcode noerror,servfail,refused)

PROBE:
   -cdn  display cdn name
   -asn  display host asn information

RATE-LIMIT:
   -t, -threads int      number of concurrent threads to use (default 100)
   -rl, -rate-limit int  number of dns request/second to make (disabled as default) (default -1)

UPDATE:
   -up, -update                 update dnsx to latest version
   -duc, -disable-update-check  disable automatic dnsx update check

OUTPUT:
   -o, -output string  file to write output
   -json               write output in JSONL(ines) format

DEBUG:
   -hc, -health-check  run diagnostic check up
   -silent             display only results in the output
   -v, -verbose        display verbose output
   -raw, -debug        display raw dns response
   -stats              display stats of the running scan
   -version            display version of dnsx

OPTIMIZATION:
   -retry int                number of dns attempts to make (must be at least 1) (default 2)
   -hf, -hostsfile           use system host file
   -trace                    perform dns tracing
   -trace-max-recursion int  Max recursion for dns trace (default 32767)
   -resume                   resume existing scan
   -stream                   stream mode (wordlist, wildcard, stats and stop/resume will be disabled)

CONFIGURATIONS:
   -r, -resolver string          list of resolvers to use (file or comma separated)
   -wt, -wildcard-threshold int  wildcard filter threshold (default 5)
   -wd, -wildcard-domain string  domain name for wildcard filtering (other flags will be ignored)

Running dnsx

DNS Resolving

Filter active hostnames from the list of passive subdomains, obtained from various sources:

subfinder -silent -d hackerone.com | dnsx -silent

a.ns.hackerone.com
www.hackerone.com
api.hackerone.com
docs.hackerone.com
mta-sts.managed.hackerone.com
mta-sts.hackerone.com
resources.hackerone.com
b.ns.hackerone.com
mta-sts.forwarding.hackerone.com
events.hackerone.com
support.hackerone.com

Print A records for the given list of subdomains:

subfinder -silent -d hackerone.com | dnsx -silent -a -resp

www.hackerone.com [104.16.100.52]
www.hackerone.com [104.16.99.52]
hackerone.com [104.16.99.52]
hackerone.com [104.16.100.52]
api.hackerone.com [104.16.99.52]
api.hackerone.com [104.16.100.52]
mta-sts.forwarding.hackerone.com [185.199.108.153]
mta-sts.forwarding.hackerone.com [185.199.109.153]
mta-sts.forwarding.hackerone.com [185.199.110.153]
mta-sts.forwarding.hackerone.com [185.199.111.153]
a.ns.hackerone.com [162.159.0.31]
resources.hackerone.com [52.60.160.16]
resources.hackerone.com [3.98.63.202]
resources.hackerone.com [52.60.165.183]
resources.hackerone.com [read.uberflip.com]
mta-sts.hackerone.com [185.199.110.153]
mta-sts.hackerone.com [185.199.111.153]
mta-sts.hackerone.com [185.199.109.153]
mta-sts.hackerone.com [185.199.108.153]
gslink.hackerone.com [13.35.210.17]
gslink.hackerone.com [13.35.210.38]
gslink.hackerone.com [13.35.210.83]
gslink.hackerone.com [13.35.210.19]
b.ns.hackerone.com [162.159.1.31]
docs.hackerone.com [185.199.109.153]
docs.hackerone.com [185.199.110.153]
docs.hackerone.com [185.199.111.153]
docs.hackerone.com [185.199.108.153]
support.hackerone.com [104.16.51.111]
support.hackerone.com [104.16.53.111]
mta-sts.managed.hackerone.com [185.199.108.153]
mta-sts.managed.hackerone.com [185.199.109.153]
mta-sts.managed.hackerone.com [185.199.110.153]
mta-sts.managed.hackerone.com [185.199.111.153]

Extract A records for the given list of subdomains:

subfinder -silent -d hackerone.com | dnsx -silent -a -resp-only

104.16.99.52
104.16.100.52
162.159.1.31
104.16.99.52
104.16.100.52
185.199.110.153
185.199.111.153
185.199.108.153
185.199.109.153
104.16.99.52
104.16.100.52
104.16.51.111
104.16.53.111
185.199.108.153
185.199.111.153
185.199.110.153
185.199.111.153

Extract CNAME records for the given list of subdomains:

subfinder -silent -d hackerone.com | dnsx -silent -cname -resp

support.hackerone.com [hackerone.zendesk.com]
resources.hackerone.com [read.uberflip.com]
mta-sts.hackerone.com [hacker0x01.github.io]
mta-sts.forwarding.hackerone.com [hacker0x01.github.io]
events.hackerone.com [whitelabel.bigmarker.com]

Extract ASN records for the given list of subdomains:

subfinder -silent -d hackerone.com | dnsx -silent  -asn

b.ns.hackerone.com [AS13335, CLOUDFLARENET, US]
a.ns.hackerone.com [AS13335, CLOUDFLARENET, US]
hackerone.com [AS13335, CLOUDFLARENET, US]
www.hackerone.com [AS13335, CLOUDFLARENET, US]
api.hackerone.com [AS13335, CLOUDFLARENET, US]
support.hackerone.com [AS13335, CLOUDFLARENET, US]

Probe using dns status code on given list of (sub)domains:

subfinder -silent -d hackerone.com | dnsx -silent -rcode noerror,servfail,refused

ns.hackerone.com [NOERROR]
a.ns.hackerone.com [NOERROR]
b.ns.hackerone.com [NOERROR]
support.hackerone.com [NOERROR]
resources.hackerone.com [NOERROR]
mta-sts.hackerone.com [NOERROR]
www.hackerone.com [NOERROR]
mta-sts.forwarding.hackerone.com [NOERROR]
docs.hackerone.com [NOERROR]

Extract subdomains from given network range using PTR query:

echo 173.0.84.0/24 | dnsx -silent -resp-only -ptr

cors.api.paypal.com
trinityadminauth.paypal.com
cld-edge-origin-api.paypal.com
appmanagement.paypal.com
svcs.paypal.com
trinitypie-serv.paypal.com
ppn.paypal.com
pointofsale-new.paypal.com
pointofsale.paypal.com
slc-a-origin-pointofsale.paypal.com
fpdbs.paypal.com

Extract subdomains from given ASN using PTR query:

echo AS17012 | dnsx -silent -resp-only -ptr 

apiagw-a.paypal.com
notify.paypal.com
adnormserv-slc-a.paypal.com
a.sandbox.paypal.com
apps2.paypal-labs.com
pilot-payflowpro.paypal.com
www.paypallabs.com
paypal-portal.com
micropayments.paypal-labs.com
minicart.paypal-labs.com

DNS Bruteforce

Bruteforce subdomains for given domain or list of domains using d and w flag:

dnsx -silent -d facebook.com -w dns_worldlist.txt

blog.facebook.com
booking.facebook.com
api.facebook.com
analytics.facebook.com
beta.facebook.com
apollo.facebook.com
ads.facebook.com
box.facebook.com
alpha.facebook.com
apps.facebook.com
connect.facebook.com
c.facebook.com
careers.facebook.com
code.facebook.com

Bruteforce targeted subdomain using single or multiple keyword input, as d or w flag supports file or comma separated keyword inputs:

dnsx -silent -d domains.txt -w jira,grafana,jenkins

grafana.1688.com
grafana.8x8.vc
grafana.airmap.com
grafana.aerius.nl
jenkins.1688.com
jenkins.airbnb.app
jenkins.airmap.com
jenkins.ahn.nl
jenkins.achmea.nl
jira.amocrm.com
jira.amexgbt.com
jira.amitree.com
jira.arrival.com
jira.atlassian.net
jira.atlassian.com

Values are accepted from stdin for all the input types (-list, -domain, -wordlist). The -list flag defaults to stdin, but the same can be achieved for other input types by adding a - (dash) as parameter:

cat domains.txt | dnsx -silent -w jira,grafana,jenkins -d -

grafana.1688.com
grafana.8x8.vc
grafana.airmap.com
grafana.aerius.nl
jenkins.1688.com
jenkins.airbnb.app
jenkins.airmap.com
jenkins.ahn.nl
jenkins.achmea.nl
jira.amocrm.com
jira.amexgbt.com
jira.amitree.com
jira.arrival.com
jira.atlassian.net
jira.atlassian.com

DNS Bruteforce with Placeholder based wordlist

$ cat tld.txt

com
by
de
be
al
bi
cg
dj
bs
dnsx -d google.FUZZ -w tld.txt -resp

      _             __  __
   __| | _ __   ___ \ \/ /
  / _' || '_ \ / __| \  / 
 | (_| || | | |\__ \ /  \ 
  \__,_||_| |_||___//_/\_\ v1.1.2

      projectdiscovery.io

google.de [142.250.194.99] 
google.com [142.250.76.206] 
google.be [172.217.27.163] 
google.bs [142.251.42.35] 
google.bi [216.58.196.67] 
google.al [216.58.196.68] 
google.by [142.250.195.4] 
google.cg [142.250.183.131] 
google.dj [142.250.192.3] 

Wildcard filtering

A special feature of dnsx is its ability to handle multi-level DNS based wildcards, and do it so with a very reduced number of DNS requests. Sometimes all the subdomains will resolve, which leads to lots of garbage in the output. The way dnsx handles this is by keeping track of how many subdomains point to an IP and if the count of the subdomains increase beyond a certain threshold, it will check for wildcards on all the levels of the hosts for that IP iteratively.

dnsx -l subdomain_list.txt -wd airbnb.com -o output.txt

Dnsx as a library

It's possible to use the library directly in your golang programs. The following code snippets is an example of use in golang programs. Please refer to here for detailed package configuration and usage.

package main

import (
	"fmt"

	"github.com/projectdiscovery/dnsx/libs/dnsx"
)

func main() {
	// Create DNS Resolver with default options
	dnsClient, err := dnsx.New(dnsx.DefaultOptions)
	if err != nil {
		fmt.Printf("err: %v\n", err)
		return
	}

	// DNS A question and returns corresponding IPs
	result, err := dnsClient.Lookup("hackerone.com")
	if err != nil {
		fmt.Printf("err: %v\n", err)
		return
	}
	for idx, msg := range result {
		fmt.Printf("%d: %s\n", idx+1, msg)
	}

	// Query
	rawResp, err := dnsClient.QueryOne("hackerone.com")
	if err != nil {
		fmt.Printf("err: %v\n", err)
		return
	}
	fmt.Printf("rawResp: %v\n", rawResp)

	jsonStr, err := rawResp.JSON()
	if err != nil {
		fmt.Printf("err: %v\n", err)
		return
	}
	fmt.Println(jsonStr)

	return
}

📋 Notes

  • As default, dnsx checks for A record.
  • As default dnsx uses Google, Cloudflare, Quad9 resolver.
  • Custom resolver list can be loaded using the r flag.
  • Domain name (wd) input is mandatory for wildcard elimination.
  • DNS record flag can not be used when using wildcard filtering.
  • DNS resolution (l) and DNS brute-forcing (w) can't be used together.
  • VPN operators tend to filter high DNS/UDP traffic, therefore the tool might experience packets loss (eg. Mullvad VPN)

dnsx is made with 🖤 by the projectdiscovery team.

More Repositories

1

nuclei

Fast and customizable vulnerability scanner based on simple YAML based DSL.
Go
14,482
star
2

katana

A next-generation crawling and spidering framework.
Go
10,861
star
3

subfinder

Fast passive subdomain enumeration tool.
Go
9,888
star
4

nuclei-templates

Community curated list of templates for the nuclei engine to find security vulnerabilities.
6,913
star
5

httpx

httpx is a fast and multi-purpose HTTP toolkit that allows running multiple probes using the retryablehttp library.
Go
5,706
star
6

naabu

A fast port scanner written in go with a focus on reliability and simplicity. Designed to be used in combination with other tools for attack surface discovery in bug bounties and pentests
Go
3,657
star
7

interactsh

An OOB interaction gathering server and client library
Go
2,818
star
8

proxify

A versatile and portable proxy for capturing, manipulating, and replaying HTTP/HTTPS traffic on the go.
Go
2,362
star
9

uncover

Quickly discover exposed hosts on the internet using multiple search engines.
Go
2,026
star
10

nuclei-burp-plugin

Nuclei plugin for BurpSuite
Java
1,133
star
11

shuffledns

MassDNS wrapper written in go that allows you to enumerate valid subdomains using active bruteforce as well as resolve subdomains with wildcard handling and easy input-output support.
Go
1,119
star
12

notify

Notify is a Go-based assistance package that enables you to stream the output of several tools (or read from a file) and publish it to a variety of supported platforms.
Go
951
star
13

public-bugbounty-programs

Community curated list of public bug bounty and responsible disclosure programs.
Go
876
star
14

mapcidr

Small utility program to perform multiple operations for a given subnet/CIDR ranges.
Go
811
star
15

cloudlist

Cloudlist is a tool for listing Assets from multiple Cloud Providers.
Go
691
star
16

tlsx

Fast and configurable TLS grabber focused on TLS based data collection.
Go
654
star
17

pdtm

ProjectDiscovery's Open Source Tool Manager
Go
521
star
18

asnmap

Go CLI and Library for quickly mapping organization network ranges using ASN information.
Go
516
star
19

wappalyzergo

A high performance go implementation of Wappalyzer Technology Detection Library
Go
498
star
20

chaos-client

Go client to communicate with Chaos DB API.
Go
498
star
21

alterx

Fast and customizable subdomain wordlist generator using DSL
Go
480
star
22

cdncheck

A utility to detect various technology for a given IP address.
Go
463
star
23

nuclei-ai-extension

Nuclei AI - Browser Extension for Rapid Nuclei Template Generation
JavaScript
422
star
24

simplehttpserver

Go alternative of python SimpleHTTPServer
Go
418
star
25

dnsprobe

DNSProb is a tool built on top of retryabledns that allows you to perform multiple dns queries of your choice with a list of user supplied resolvers.
Go
269
star
26

aix

AIx is a cli tool to interact with Large Language Models (LLM) APIs.
Go
200
star
27

nuclei-action

Vulnerability Scan with Nuclei
JavaScript
199
star
28

interactsh-web

Web dashboard for Interactsh client
TypeScript
162
star
29

openrisk

openrisk is a tool that generates a risk score based on the results of a Nuclei scan.
Go
160
star
30

rawhttp

Raw HTTP client in Go for complete request control and customization.
Go
120
star
31

retryabledns

Retryable DNS client in Go
Go
103
star
32

retryablehttp-go

Package retryablehttp provides a familiar HTTP client interface with automatic retries and exponential backoff
Go
92
star
33

nuclei-docs

Nuclei documentation
HTML
84
star
34

gologger

A simple layer for leveled logging in go
Go
66
star
35

utils

Helper Libraries
Go
65
star
36

network-fingerprint

A fingerprint generation helper for nuclei network templates
Go
61
star
37

goflags

A go flag wrapper with convenience helpers
Go
59
star
38

awesome-search-queries

Community curated list of search queries for various products across multiple search engines.
46
star
39

fastdialer

Dialer with DNS Cache + Dial History
Go
45
star
40

ipranger

IP/FQDN data structure helper with randomization of hosts and ports based on masscan internal logic
Go
43
star
41

dsl

DSL engine
Go
38
star
42

fuzzing-templates

Community curated list of nuclei templates for finding "unknown" security vulnerabilities.
36
star
43

hmap

Hybrid memory/disk map
Go
35
star
44

useragent

Curated list of categorized User Agents
Go
30
star
45

wallpapers

Collection of ProjectDiscovery wallpapers
26
star
46

collaborator

BurpSuite Standard/Private Collaborator Library
Go
22
star
47

tinydns

Tiny embeddable dns server
Go
22
star
48

blackrock

blackrock cipher based on masscan
Go
21
star
49

fdmax

Small Helper Library to increase automatically the file descriptors limits for the current process
Go
21
star
50

ratelimit

A Golang blocking rate limit implementation
Go
20
star
51

php-app-race-condition

Vulnerable demo application for the race condition
PHP
17
star
52

yamldoc-go

A documentation generator for YAML as code
Go
16
star
53

freeport

Free listening port from the OS
Go
16
star
54

clistats

A command based package for simple display of statistics
Go
15
star
55

fileutil

File helpers - Moved at https://github.com/projectdiscovery/utils
Go
12
star
56

notify-action

Notify is a helper utility written in Go that allows you to post output to multiple platforms.
12
star
57

naabu-action

A fast port scanner written in go with a focus on reliability and simplicity.
12
star
58

sqlc-go-builder

sqlc-go-builder
Go
12
star
59

subfinder-action

Fast and passive subdomain enumeration.
12
star
60

roundrobin

roundrobin with configurable rotating strategies
Go
11
star
61

executil

Exec helpers - Moved at https://github.com/projectdiscovery/utils
Go
11
star
62

networkpolicy

Network Policy Helper
Go
10
star
63

resolvercache-go

A DNS response caching library in go
Go
10
star
64

gozero

gozero: the wannabe zero dependency [language-here] runtime for Go developers - Experimental
Go
9
star
65

iputil

ip helpers - Moved at https://github.com/projectdiscovery/utils
Go
8
star
66

dnsx-action

Fast and multi-purpose DNS toolkit allow to run multiple DNS queries.
8
star
67

expirablelru

A TTL expiring LRU cache in go
Go
7
star
68

sslcert

Reworked version of https://golang.org/src/crypto/tls/generate_cert.go
Go
7
star
69

tailwindcss

Design system config file
JavaScript
7
star
70

goconfig

Helper library to save/restore internal values across multiple runs
Go
7
star
71

httpx-action

HTTP Web Server probing
7
star
72

cryptoutil

Library containing various crypto helpers
Go
7
star
73

stringsutil

Strings helper - Moved at https://github.com/projectdiscovery/utils
Go
6
star
74

nuclei-updatecheck-api

Nuclei UpdateChecking API caching github releases for update check
Go
5
star
75

filekv

File based kv store
Go
5
star
76

sarif

Sarif exporter
Go
5
star
77

sliceutil

sliceutils helpers - Moved at https://github.com/projectdiscovery/utils
Go
5
star
78

cloudlist-action

Cloudlist is a tool for listing Assets from multiple Cloud Providers.
5
star
79

mapsutil

Go maps helper functions - Moved at https://github.com/projectdiscovery/utils
Go
4
star
80

gostruct

Python like library to Interpret bytes as packed binary data
Go
4
star
81

folderutil

Package containing various folder helpers
Go
3
star
82

httputil

Http helper library
Go
3
star
83

templates-stats

A utility for extracting various meta data from nuclei-templates.
Go
3
star
84

docs

Centralized docs of ProjectDiscovery
MDX
3
star
85

reflectutil

Library containing reflection helpers
Go
2
star
86

urlutil

Helper library handling edge cases URLs - Moved at https://github.com/projectdiscovery/utils
Go
2
star
87

.github

Community health files for the @projectdiscovery organization
2
star
88

eslint-config

ESLint Configurations
JavaScript
1
star