Categorygithub.com/attackercan/resolve
modulepackage
0.1.1
Repository: https://github.com/attackercan/resolve.git
Documentation: pkg.go.dev

# README

GitHub Test Status GoDoc License Go Report CodeFactor Maintainability codecov

Leverage Many Recursive DNS Servers

Designed to support DNS brute-forcing with minimal system resources:

  • Easy to send a large number of queries concurrently
  • Hundreds of DNS nameservers can easily be leveraged
  • A minimal number of goroutines are employed by the package
  • Provides features like DNS wildcard detection and NSEC traversal

Installation Go Version

go get -v -u github.com/owasp-amass/resolve@master

Usage

qps := 15
var nameservers = []string{
	"8.8.8.8",        // Google
	"1.1.1.1",        // Cloudflare
	"9.9.9.9",        // Quad9
	"208.67.222.222", // Cisco OpenDNS
	"84.200.69.80",   // DNS.WATCH
	"64.6.64.6",      // Neustar DNS
	"8.26.56.26",     // Comodo Secure DNS
	"205.171.3.65",   // Level3
	"134.195.4.2",    // OpenNIC
	"185.228.168.9",  // CleanBrowsing
	"76.76.19.19",    // Alternate DNS
	"37.235.1.177",   // FreeDNS
	"77.88.8.1",      // Yandex.DNS
	"94.140.14.140",  // AdGuard
	"38.132.106.139", // CyberGhost
	"74.82.42.42",    // Hurricane Electric
	"76.76.2.0",      // ControlD
}
r := resolve.NewResolvers()
_ = r.AddResolvers(qps, nameservers...)
defer r.Stop()

ctx, cancel := context.WithTimeout(context.Background(), 30 * time.Second)
defer cancel()

ch := make(chan *dns.Msg, 100)
go func() {
	for _, name := range names {
		r.Query(ctx, resolve.QueryMsg(name, 1), ch)
	}
}()

for {
	select {
	case <-ctx.Done():
		return
	case resp := <-ch:
		if resp.Rcode == dns.RcodeSuccess && len(resp.Answer) > 0 {
			ans := ExtractAnswers(resp)
			domain, err := publicsuffix.EffectiveTLDPlusOne(ans[0].Name)

			if err == nil && !r.WildcardDetected(ctx, resp, domain) {
				fmt.Printf("%s resolved to %s\n", ans[0].Name, ans[0].Data)
			}
		}
	}
}

Licensing License

This program is free software: you can redistribute it and/or modify it under the terms of the Apache license.

# Packages

No description provided by the author

# Functions

AnswersByType returns only the answers from the DNS Answer section matching the provided type.
BackoffJitter returns a random Duration between the provided min and max parameters.
ExponentialBackoff returns a Duration equal to 2^events multiplied by the provided delay and jitter added equal to [0,delay).
ExtractAnswers returns information from the DNS Answer section of the provided Msg in ExtractedAnswer type.
FirstProperSubdomain returns the first subdomain name using the provided name and Resolver that responds successfully to a DNS query for the NS record type.
FQDNToRegistered executes the provided callback routine for domain names, starting with the FQDN to the registered domain name, removing one label with each execution.
NewRateTracker returns an active RateTracker that tracks and rate limits per name server.
NewResolvers initializes a Resolvers.
QueryMsg generates a message used for a forward DNS query.
RegisteredToFQDN executes the provided callback routine for domain names, starting with the registered domain name to the FQDN, adding one label with each execution.
RemoveLastDot removes the '.' at the end of the provided FQDN.
ReverseMsg generates a message used for a reverse DNS query.
SetupOptions returns the EDNS0_SUBNET option for hiding our location.
TruncatedExponentialBackoff returns a Duration equal to ExponentialBackoff with a provided maximum Duration used to truncate the result.
UnlikelyName takes a subdomain name and returns an unlikely DNS name within that subdomain.
WalkMsg generates a message used for a NSEC walk query.

# Constants

DefaultTimeout is the duration waited until a DNS query expires.
Constants related to DNS labels.
Constants related to DNS labels.
Constants related to DNS labels.
Constants related to DNS labels.
Constants related to DNS labels.
RcodeNoResponse is a special status code used to indicate no response or package error.

# Structs

ExtractedAnswer contains information from the DNS response Answer section.
No description provided by the author
Resolvers is a pool of DNS resolvers managed for brute forcing using random selection.
No description provided by the author