resolvers

package
v3.11.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 13, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PriorityLow int = iota
	PriorityNormal
	PriorityHigh
	PriorityCritical
)

The priority levels for Resolver DNS queries.

View Source
const (
	MaxDNSNameLen  = 253
	MaxDNSLabelLen = 63
	MinLabelLen    = 6
	MaxLabelLen    = 24
	LDHChars       = "abcdefghijklmnopqrstuvwxyz0123456789-"
)

Constants related to DNS labels.

View Source
const (
	WildcardTypeNone = iota
	WildcardTypeStatic
	WildcardTypeDynamic
)

Names for the different types of wildcards that can be detected.

View Source
const ResolverErrRcode = 100

ResolverErrRcode is our made up rcode to indicate an interface error.

View Source
const TimeoutRcode = 101

TimeoutRcode is our made up rcode to indicate that a query timed out.

Variables

PoolRetryCodes are the rcodes that cause the pool to suggest trying again.

View Source
var QueryTimeout = 2 * time.Second

QueryTimeout is the duration until a Resolver query expires.

View Source
var RetryCodes = []int{
	TimeoutRcode,
	ResolverErrRcode,
}

RetryCodes are the rcodes that cause the resolver to suggest trying again.

Functions

func FirstProperSubdomain added in v3.11.0

func FirstProperSubdomain(ctx context.Context, r Resolver, name string, priority int) string

FirstProperSubdomain returns the first subdomain name using the provided name and Resolver that responds successfully to a DNS query for the NS record type.

func NsecTraversal

func NsecTraversal(ctx context.Context, r Resolver, domain string, priority int) ([]string, bool, error)

NsecTraversal attempts to retrieve a DNS zone using NSEC-walking.

func PoolRetryPolicy added in v3.10.4

func PoolRetryPolicy(times, priority int, msg *dns.Msg) bool

PoolRetryPolicy is the default policy used by the resolver pool to determine if a DNS query should be performed again.

func QueryMsg added in v3.11.0

func QueryMsg(name string, qtype uint16) *dns.Msg

QueryMsg generates a message used for a forward DNS query.

func RemoveLastDot

func RemoveLastDot(name string) string

RemoveLastDot removes the '.' at the end of the provided FQDN.

func RetryPolicy added in v3.10.4

func RetryPolicy(times, priority int, msg *dns.Msg) bool

RetryPolicy is the default policy used throughout Amass to determine if a DNS query should be performed again.

func ReverseMsg added in v3.11.0

func ReverseMsg(addr string) *dns.Msg

ReverseMsg generates a message used for a reverse DNS query.

func SetupOptions added in v3.11.0

func SetupOptions() *dns.OPT

SetupOptions returns the EDNS0_SUBNET option for hiding our location.

func UnlikelyName

func UnlikelyName(sub string) string

UnlikelyName takes a subdomain name and returns an unlikely DNS name within that subdomain.

func WalkMsg added in v3.11.0

func WalkMsg(name string, qtype uint16) *dns.Msg

WalkMsg generates a message used for a NSEC walk query.

func ZoneTransfer

func ZoneTransfer(sub, domain, server string) ([]*requests.DNSRequest, error)

ZoneTransfer attempts a DNS zone transfer using the provided server. The returned slice contains all the records discovered from the zone transfer.

Types

type ExtractedAnswer added in v3.11.0

type ExtractedAnswer struct {
	Name string
	Type uint16
	Data string
}

ExtractedAnswer contains information from the DNS response Answer section.

func AnswersByType added in v3.11.0

func AnswersByType(answers []*ExtractedAnswer, qtype uint16) []*ExtractedAnswer

AnswersByType returns only the answers from the DNS Answer section matching the provided type.

func ExtractAnswers added in v3.11.0

func ExtractAnswers(msg *dns.Msg) []*ExtractedAnswer

ExtractAnswers returns information from the DNS Answer section of the provided Msg in ExtractedAnswer type.

type ResolveError

type ResolveError struct {
	Err   string
	Rcode int
}

ResolveError contains the Rcode returned during the DNS query.

func (*ResolveError) Error

func (e *ResolveError) Error() string

type Resolver

type Resolver interface {
	fmt.Stringer

	// Stop will stop the Resolver.
	Stop() error

	// Stopped returns true if the Resolver is already stopped.
	Stopped() bool

	// Query performs a DNS query for the provided name and message type.
	Query(ctx context.Context, msg *dns.Msg, priority int, retry Retry) (*dns.Msg, error)

	// WildcardType returns the DNS wildcard type for the FQDN in the provided message.
	WildcardType(ctx context.Context, msg *dns.Msg, domain string) int
}

Resolver performs DNS resolutions.

func NewBaseResolver

func NewBaseResolver(addr string, perSec int, logger *log.Logger) Resolver

NewBaseResolver initializes a Resolver that send DNS queries to the provided IP address.

func NewResolverPool

func NewResolverPool(resolvers []Resolver, delay time.Duration, baseline Resolver, logger *log.Logger) Resolver

NewResolverPool initializes a ResolverPool that uses the provided Resolvers.

type Retry added in v3.10.4

type Retry func(times int, priority int, msg *dns.Msg) bool

Retry is the definition for the callbacks used in the Resolver interface.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL