Documentation
¶
Index ¶
- Constants
- Variables
- func ClientSubnetCheck(resolver string) error
- func FirstProperSubdomain(ctx context.Context, r Resolver, name string, priority int) string
- func NsecTraversal(ctx context.Context, r Resolver, domain string, priority int) ([]string, bool, error)
- func PoolRetryPolicy(times, priority int, msg *dns.Msg) bool
- func QueryMsg(name string, qtype uint16) *dns.Msg
- func RemoveLastDot(name string) string
- func RetryPolicy(times, priority int, msg *dns.Msg) bool
- func ReverseMsg(addr string) *dns.Msg
- func SetupOptions() *dns.OPT
- func UnlikelyName(sub string) string
- func WalkMsg(name string, qtype uint16) *dns.Msg
- func ZoneTransfer(sub, domain, server string) ([]*requests.DNSRequest, error)
- type ExtractedAnswer
- type ResolveError
- type Resolver
- type Retry
Constants ¶
const ( PriorityLow int = iota PriorityNormal PriorityHigh PriorityCritical )
The priority levels for Resolver DNS queries.
const ( MaxDNSNameLen = 253 MaxDNSLabelLen = 63 MinLabelLen = 6 MaxLabelLen = 24 LDHChars = "abcdefghijklmnopqrstuvwxyz0123456789-" )
Constants related to DNS labels.
const ( WildcardTypeNone = iota WildcardTypeStatic WildcardTypeDynamic )
Names for the different types of wildcards that can be detected.
const ResolverErrRcode = 100
ResolverErrRcode is our made up rcode to indicate an interface error.
const TimeoutRcode = 101
TimeoutRcode is our made up rcode to indicate that a query timed out.
Variables ¶
var PoolRetryCodes = []int{ TimeoutRcode, ResolverErrRcode, dns.RcodeRefused, dns.RcodeServerFailure, dns.RcodeNotImplemented, }
PoolRetryCodes are the rcodes that cause the pool to suggest trying again.
var QueryTimeout = 2 * time.Second
QueryTimeout is the duration until a Resolver query expires.
var RetryCodes = []int{ TimeoutRcode, ResolverErrRcode, }
RetryCodes are the rcodes that cause the resolver to suggest trying again.
Functions ¶
func ClientSubnetCheck ¶ added in v3.11.6
ClientSubnetCheck ensures that the provided resolver does not send the EDNS client subnet information. The function returns the DNS reply size limit in number of bytes.
func FirstProperSubdomain ¶ added in v3.11.0
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
PoolRetryPolicy is the default policy used by the resolver pool to determine if a DNS query should be performed again.
func RemoveLastDot ¶
RemoveLastDot removes the '.' at the end of the provided FQDN.
func RetryPolicy ¶ added in v3.10.4
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
ReverseMsg generates a message used for a reverse DNS query.
func SetupOptions ¶ added in v3.11.0
SetupOptions returns the EDNS0_SUBNET option for hiding our location.
func UnlikelyName ¶
UnlikelyName takes a subdomain name and returns an unlikely DNS name within that subdomain.
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
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 ¶
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() // 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 ¶
NewBaseResolver initializes a Resolver that send DNS queries to the provided IP address.