wildcarder

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package wildcarder provides a subdomain wildcard detection algorithm. It operates on the DNS records of the target domains. It can use the result file produced by "massdns -o Snl" to optimize the process and lower the number of DNS queries made.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnswerHash

type AnswerHash struct {
	Type resolvermt.RRtype
	Hash uint64
}

AnswerHash is the type of an answer stored in the cache.

func HashAnswer

func HashAnswer(answer DNSAnswer) AnswerHash

HashAnswer hashes a DNSAnswer and returns a AnswerHash.

type ClientDNS

type ClientDNS struct {
	// contains filtered or unexported fields
}

ClientDNS is a DNS client that implements the Resolver interface.

func NewClientDNS

func NewClientDNS(resolvers []string, retryCount int, qps int, concurrency int) *ClientDNS

NewClientDNS creates a new ResolverDNS object to use with a Wildcarder object.

func (*ClientDNS) QueryCount

func (r *ClientDNS) QueryCount() int

QueryCount returns the number of DNS queries really performed.

func (*ClientDNS) Resolve

func (r *ClientDNS) Resolve(domains []string) []DNSAnswer

Resolve resolves A records from a list of domain names and returns the answers.

type DNSAnswer

type DNSAnswer struct {
	Type   resolvermt.RRtype
	Answer string
}

DNSAnswer represents a DNS answer without the question.

type DNSCache

type DNSCache struct {
	// contains filtered or unexported fields
}

DNSCache represents a cache of DNS queries and answers.

func NewDNSCache

func NewDNSCache() *DNSCache

NewDNSCache creates an empty cache.

func (*DNSCache) Add

func (c *DNSCache) Add(question string, answers []DNSAnswer)

Add adds an answer to the DNS cache. The answer will be appended to the list of existing answers for a question if they already exist.

func (*DNSCache) Find

func (c *DNSCache) Find(question string) []AnswerHash

Find returns the answers for a given DNS query from the cache. The list of answers returned can be empty if the question is in the cache but no results were found, or nil if the question is not in the cache.

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option configures a wildcarder.

func WithPreCache

func WithPreCache(cache *DNSCache) Option

WithPreCache returns an option that provides a pre-populated DNS cache used to optimize the number of DNS queries made during the wildcard detection phase. This DNS cache is not trusted, and the results will be validated as needed using trusted resolvers.

func WithResolver

func WithResolver(resolver Resolver) Option

WithResolver returns an option that provides a custom resolver to use while performing wildcard detection.

type QuestionHash

type QuestionHash uint64

QuestionHash is the type of the question stored in the cache.

func HashQuestion

func HashQuestion(question string) QuestionHash

HashQuestion hashes a question and returns a QuestionHash.

type Resolver

type Resolver interface {
	Resolve(domains []string) []DNSAnswer
	QueryCount() int
}

Resolver resolves domain names A and AAAA records and returns the DNS answers found.

type Wildcarder

type Wildcarder struct {
	// contains filtered or unexported fields
}

Wildcarder filters out wildcard subdomains from a list.

func New

func New(threadCount int, testCount int, options ...Option) *Wildcarder

New returns a Wildcarder object used to filter out wildcards.

func (*Wildcarder) Current

func (wc *Wildcarder) Current() int

Current returns the current number of domains that have been processed.

func (*Wildcarder) Filter

func (wc *Wildcarder) Filter(r io.Reader) (domains, roots []string)

Filter reads subdomains from a reader and returns a list of domains that are not wildcards, along with the wildcard subdomain roots found.

func (*Wildcarder) QueryCount

func (wc *Wildcarder) QueryCount() int

QueryCount returns the total number of DNS queries made so far to detect wildcards.

func (*Wildcarder) SetPreCache

func (wc *Wildcarder) SetPreCache(precache *DNSCache)

SetPreCache sets the precache after the Wildcarder object has been created.

Jump to

Keyboard shortcuts

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