miekg

package
v1.0.0-RC3FIX Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseAnswer

func ParseAnswer(ans dns.RR) interface{}

func TranslateMiekgErrorCode

func TranslateMiekgErrorCode(err int) zdns.Status

Types

type Answer

type Answer struct {
	Ttl  uint32 `json:"ttl" groups:"ttl,normal,long,trace"`
	Type string `json:"type,omitempty" groups:"short,normal,long,trace"`

	Class string `json:"class,omitempty" groups:"short,normal,long,trace"`

	Name   string `json:"name,omitempty" groups:"short,normal,long,trace"`
	Answer string `json:"answer,omitempty" groups:"short,normal,long,trace"`
	// contains filtered or unexported fields
}

type CAAAnswer

type CAAAnswer struct {
	Answer
	Tag   string `json:"tag" groups:"short,normal,long,trace"`
	Value string `json:"value" groups:"short,normal,long,trace"`
	Flag  uint8  `json:"flag" groups:"short,normal,long,trace"`
}

type CachedResult

type CachedResult struct {
	Answers map[interface{}]TimedAnswer
}

type DNSFlags

type DNSFlags struct {
	Response           bool `json:"response" groups:"flags,long,trace"`
	Opcode             int  `json:"opcode" groups:"flags,long,trace"`
	Authoritative      bool `json:"authoritative" groups:"flags,long,trace"`
	Truncated          bool `json:"truncated" groups:"flags,long,trace"`
	RecursionDesired   bool `json:"recursion_desired" groups:"flags,long,trace"`
	RecursionAvailable bool `json:"recursion_available" groups:"flags,long,trace"`
	Authenticated      bool `json:"authenticated" groups:"flags,long,trace"`
	CheckingDisabled   bool `json:"checking_disabled" groups:"flags,long,trace"`
	ErrorCode          int  `json:"error_code" groups:"flags,long,trace"`
}

type DNSKEYAnswer

type DNSKEYAnswer struct {
	Answer
	Flags     uint16 `json:"flags" groups:"short,normal,long,trace"`
	Protocol  uint8  `json:"protocol" groups:"short,normal,long,trace"`
	Algorithm uint8  `json:"algorithm" groups:"short,normal,long,trace"`
	PublicKey string `json:"public_key" groups:"short,normal,long,trace"`
}

type DSAnswer

type DSAnswer struct {
	Answer
	KeyTag     uint16 `json:"key_tag" groups:"short,normal,long,trace"`
	Algorithm  uint8  `json:"algorithm" groups:"short,normal,long,trace"`
	DigestType uint8  `json:"digest_type" groups:"short,normal,long,trace"`
	Digest     string `json:"digest" groups:"short,normal,long,trace"`
}

type GlobalLookupFactory

type GlobalLookupFactory struct {
	zdns.BaseGlobalLookupFactory
	IterativeCache cachehash.ShardedCacheHash
	DNSType        uint16
	DNSClass       uint16
	BlacklistPath  string
	Blacklist      *blacklist.Blacklist
	BlMu           sync.Mutex
}

func (*GlobalLookupFactory) AddCachedAnswer

func (s *GlobalLookupFactory) AddCachedAnswer(answer interface{}, name string, dnsType uint16, ttl uint32, depth int, threadID int)

func (*GlobalLookupFactory) AddFlags

func (s *GlobalLookupFactory) AddFlags(f *flag.FlagSet)

func (*GlobalLookupFactory) BlacklistInit

func (s *GlobalLookupFactory) BlacklistInit() error

func (*GlobalLookupFactory) GetCachedResult

func (s *GlobalLookupFactory) GetCachedResult(name string, dnsType uint16, isAuthCheck bool, depth int, threadID int) (Result, bool)

func (*GlobalLookupFactory) Help

func (s *GlobalLookupFactory) Help() string

func (*GlobalLookupFactory) Initialize

func (s *GlobalLookupFactory) Initialize(c *zdns.GlobalConf) error

func (*GlobalLookupFactory) MakeRoutineFactory

func (s *GlobalLookupFactory) MakeRoutineFactory(threadID int) (zdns.RoutineLookupFactory, error)

func (*GlobalLookupFactory) SetDNSClass

func (s *GlobalLookupFactory) SetDNSClass(dnsClass uint16)

func (*GlobalLookupFactory) SetDNSType

func (s *GlobalLookupFactory) SetDNSType(dnsType uint16)

func (*GlobalLookupFactory) VerboseGlobalLog

func (s *GlobalLookupFactory) VerboseGlobalLog(depth int, threadID int, args ...interface{})

type IsCached

type IsCached bool

type Lookup

type Lookup struct {
	zdns.BaseLookup

	Factory       *RoutineLookupFactory
	DNSType       uint16
	DNSClass      uint16
	Prefix        string
	NameServer    string
	IterativeStop time.Time
}

func (*Lookup) DoLookup

func (s *Lookup) DoLookup(name string) (interface{}, []interface{}, zdns.Status, error)

allow miekg to be used as a ZDNS module

func (*Lookup) DoMiekgLookup

func (s *Lookup) DoMiekgLookup(name string) (interface{}, []interface{}, zdns.Status, error)

func (*Lookup) DoMiekgLookupForClass

func (s *Lookup) DoMiekgLookupForClass(name string, dnsClass uint16) (interface{}, []interface{}, zdns.Status, error)

func (*Lookup) DoTxtLookup

func (s *Lookup) DoTxtLookup(name string) (string, []interface{}, zdns.Status, error)

func (*Lookup) DoTypedMiekgLookup

func (s *Lookup) DoTypedMiekgLookup(name string, dnsType uint16) (interface{}, []interface{}, zdns.Status, error)

func (*Lookup) DoTypedMiekgLookupInClass

func (s *Lookup) DoTypedMiekgLookupInClass(name string, dnsType uint16, dnsClass uint16) (interface{}, []interface{}, zdns.Status, error)

func (*Lookup) Initialize

func (s *Lookup) Initialize(nameServer string, dnsType uint16, dnsClass uint16, factory *RoutineLookupFactory) error

func (*Lookup) SafeAddCachedAnswer

func (s *Lookup) SafeAddCachedAnswer(a interface{}, layer string, debugType string, depth int)

func (*Lookup) VerboseLog

func (s *Lookup) VerboseLog(depth int, args ...interface{})

type MXAnswer

type MXAnswer struct {
	Answer
	Preference uint16 `json:"preference" groups:"short,normal,long,trace"`
}

type NAPTRAnswer

type NAPTRAnswer struct {
	Answer
	Order       uint16 `json:"order" groups:"short,normal,long,trace"`
	Preference  uint16 `json:"preference" groups:"short,normal,long,trace"`
	Flags       string `json:"flags" groups:"short,normal,long,trace"`
	Service     string `json:"service" groups:"short,normal,long,trace"`
	Regexp      string `json:"regexp" groups:"short,normal,long,trace"`
	Replacement string `json:"replacement" groups:"short,normal,long,trace"`
}

type NSEC3Answer

type NSEC3Answer struct {
	Answer
	HashAlgorithm uint8  `json:"hash_algorithm" groups:"short,normal,long,trace"`
	Flags         uint8  `json:"flags" groups:"short,normal,long,trace"`
	Iterations    uint16 `json:"iterations" groups:"short,normal,long,trace"`
	Salt          string `json:"salt" groups:"short,normal,long,trace"`
}

type NSEC3ParamAnswer

type NSEC3ParamAnswer struct {
	Answer
	HashAlgorithm uint8  `json:"hash_algorithm" groups:"short,normal,long,trace"`
	Flags         uint8  `json:"flags" groups:"short,normal,long,trace"`
	Iterations    uint16 `json:"iterations" groups:"short,normal,long,trace"`
	Salt          string `json:"salt" groups:"short,normal,long,trace"`
}

type NSECAnswer

type NSECAnswer struct {
	Answer
}

type RRSIGAnswer

type RRSIGAnswer struct {
	Answer
	TypeCovered uint16 `json:"type_covered" groups:"short,normal,long,trace"`
	Algorithm   uint8  `json:"algorithm" groups:"short,normal,long,trace"`
	Labels      uint8  `json:"labels" groups:"short,normal,long,trace"`
	OriginalTtl uint32 `json:"original_ttl" groups:"short,normal,long,trace"`
	Expiration  uint32 `json:"expiration" groups:"short,normal,long,trace"`
	Inception   uint32 `json:"inception" groups:"short,normal,long,trace"`
	KeyTag      uint16 `json:"keytag" groups:"short,normal,long,trace"`
	SignerName  string `json:"signer_name" groups:"short,normal,long,trace"`
	Signature   string `json:"signature" groups:"short,normal,long,trace"`
}

type Result

type Result struct {
	Answers     []interface{} `json:"answers" groups:"short,normal,long,trace"`
	Additional  []interface{} `json:"additionals" groups:"short,normal,long,trace"`
	Authorities []interface{} `json:"authorities" groups:"short,normal,long,trace"`
	Protocol    string        `json:"protocol" groups:"protocol,normal,long,trace"`
	Resolver    string        `json:"resolver" groups:"resolver,normal,long,trace"`
	Flags       DNSFlags      `json:"flags" groups:"flags,long,trace"`
}

result to be returned by scan of host

func DoLookupWorker

func DoLookupWorker(udp *dns.Client, tcp *dns.Client, dnsType uint16, dnsClass uint16, name string, nameServer string, recursive bool) (Result, zdns.Status, error)

Expose the inner logic so other tools can use it

type RoutineLookupFactory

type RoutineLookupFactory struct {
	Factory             *GlobalLookupFactory
	Client              *dns.Client
	TCPClient           *dns.Client
	Retries             int
	MaxDepth            int
	Timeout             time.Duration
	IterativeTimeout    time.Duration
	IterativeResolution bool
	Trace               bool
	DNSType             uint16
	DNSClass            uint16
	ThreadID            int
}

func (*RoutineLookupFactory) Initialize

func (s *RoutineLookupFactory) Initialize(c *zdns.GlobalConf)

func (*RoutineLookupFactory) MakeLookup

func (s *RoutineLookupFactory) MakeLookup() (zdns.Lookup, error)

type SOAAnswer

type SOAAnswer struct {
	Answer
	Ns      string `json:"ns" groups:"short,normal,long,trace"`
	Mbox    string `json:"mbox" groups:"short,normal,long,trace"`
	Serial  uint32 `json:"serial" groups:"short,normal,long,trace"`
	Refresh uint32 `json:"refresh" groups:"short,normal,long,trace"`
	Retry   uint32 `json:"retry" groups:"short,normal,long,trace"`
	Expire  uint32 `json:"expire" groups:"short,normal,long,trace"`
	Minttl  uint32 `json:"min_ttl" groups:"short,normal,long,trace"`
}

type SRVAnswer

type SRVAnswer struct {
	Answer
	Priority uint16 `json:"priority" groups:"short,normal,long,trace"`
	Weight   uint16 `json:"weight" groups:"short,normal,long,trace"`
	Port     uint16 `json:"port" groups:"short,normal,long,trace"`
	Target   string `json:"target" groups:"short,normal,long,trace"`
}

type TLSAAnswer

type TLSAAnswer struct {
	Answer
	CertUsage    uint8  `json:"cert_usage" groups:"short,normal,long,trace"`
	Selector     uint8  `json:"selector" groups:"short,normal,long,trace"`
	MatchingType uint8  `json:"matching_type" groups:"short,normal,long,trace"`
	Certificate  string `json:"certificate" groups:"short,normal,long,trace"`
}

type TimedAnswer

type TimedAnswer struct {
	Answer    interface{}
	ExpiresAt time.Time
}

type TraceStep

type TraceStep struct {
	Result     Result   `json:"results" groups:"trace"`
	DnsType    uint16   `json:"type" groups:"trace"`
	DnsClass   uint16   `json:"class" groups:"trace"`
	Name       string   `json:"name" groups:"trace"`
	NameServer string   `json:"name_server" groups:"trace"`
	Depth      int      `json:"depth" groups:"trace"`
	Layer      string   `json:"layer" groups:"trace"`
	Cached     IsCached `json:"cached" groups:"trace"`
}

Jump to

Keyboard shortcuts

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