dnsx

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package dnsx leverages the dnsx utility and other opensource dns projects to run dns queries for varies records including dmarc, dkim, and other technology oriented analysis related to domains

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PrintDNSRecordsReportTable

func PrintDNSRecordsReportTable(report DNSRecordsReport)

PrintDNSRecordsReportTable prints the DNS records report in a table format with colorized output and fixed-width columns

Types

type DNSRecord

type DNSRecord struct {
	Name  string     `json:"name"`
	TTL   int        `json:"ttl"`
	Type  string     `json:"type"`
	Value string     `json:"value"`
	IP    *IPAddress `json:"ip,omitempty"`
	CDN   string     `json:"cdn,omitempty"`
}

DNSRecord represents a DNS record with its associated properties

type DNSRecords

type DNSRecords struct {
	A     []*DNSRecord `json:"a,omitempty"`
	AAAA  []*DNSRecord `json:"aaaa,omitempty"`
	MX    []*DNSRecord `json:"mx,omitempty"`
	Txt   []*DNSRecord `json:"txt,omitempty"`
	NS    []*DNSRecord `json:"ns,omitempty"`
	CNAME []*DNSRecord `json:"cname,omitempty"`
	SPF   []*DNSRecord `json:"spf,omitempty"`
	DMARC []*DNSRecord `json:"dmarc,omitempty"`
	CAA   []*DNSRecord `json:"caa,omitempty"`
	SSHFP []*DNSRecord `json:"sshfp,omitempty"`
	DS    []*DNSRecord `json:"ds,omitempty"`
	URI   []*DNSRecord `json:"uri,omitempty"`
	HTTPS []*DNSRecord `json:"https,omitempty"`
	SMIME []*DNSRecord `json:"smime,omitempty"`
	SPKI  []*DNSRecord `json:"spki,omitempty"`
	ALIAS []*DNSRecord `json:"alias,omitempty"`
	PTR   []*DNSRecord `json:"ptr,omitempty"`
}

DNSRecords represents a collection of DNS records of various types

type DNSRecordsReport

type DNSRecordsReport struct {
	Domain          string      `json:"domain"`
	DNSRecords      *DNSRecords `json:"dnsRecords,omitempty"`
	DMARCDomain     *string     `json:"dmarcDomain,omitempty"`
	DMARCDNSRecords *DNSRecords `json:"dmarcDNSRecords,omitempty"`
	DKIMDomain      *string     `json:"dkimDomain,omitempty"`
	DKIMDNSRecords  *DNSRecords `json:"dkimDNSRecords,omitempty"`
	CDNName         *string     `json:"cdnName,omitempty"`
	Errors          []string    `json:"errors,omitempty"`
}

DNSRecordsReport represents a report of DNS records for a specific domain

type DNSSubenumReport

type DNSSubenumReport struct {
	Domain          string         `json:"domain"`
	EnumerationType DNSSubenumType `json:"enumerationType"`
	Subdomains      []string       `json:"subdomains,omitempty"`
	Errors          []string       `json:"errors,omitempty"`
}

DNSSubenumReport represents a report of DNS subdomain enumeration for a specific domain

type DNSSubenumType

type DNSSubenumType string

DNSSubenumType represents the type of DNS subdomain enumeration

const (
	DNSSubenumTypeBrute   DNSSubenumType = "BRUTE"
	DNSSubenumTypePassive DNSSubenumType = "PASSIVE"
)

type DNSX

type DNSX struct {
	// Client is the dnsx client
	Client *pddnsx.DNSX
	// Options are the dnsx options
	Options *Options
	// Records are the DNS records
	Records DNSRecordsReport
	// CDNCheck is the CDN check client
	CDNCheck *cdncheck.Client
}

DNSX is a wrapper around the dnsx library for client initialization and functional options settings

func NewDNSX

func NewDNSX(opts ...Option) (*DNSX, error)

NewDNSX creates a new DNSX client

func (*DNSX) GetDomainDNSRecords

func (d *DNSX) GetDomainDNSRecords(ctx context.Context, domain string) (DNSRecordsReport, error)

GetDomainDNSRecords queries DNS for all records for a given domain

func (*DNSX) Lookup

func (d *DNSX) Lookup(host string) ([]net.IP, error)

Lookup performs a DNS lookup for the given host and returns the IP addresses

func (*DNSX) LookupCDN

func (d *DNSX) LookupCDN(domain string) (value, cdnType string, err error)

LookupCDN checks if the given domain is a CDN and returns the CDN name and type

type DomainTakeover

type DomainTakeover struct {
	Target       string     `json:"target"`
	StatusCode   int        `json:"statusCode"`
	ResponseBody string     `json:"responseBody"`
	Domain       string     `json:"domain"`
	CNAME        string     `json:"cname"`
	Services     []*Service `json:"services,omitempty"`
}

DomainTakeover represents a potential domain takeover vulnerability

type DomainTakeoverReport

type DomainTakeoverReport struct {
	DomainTakeovers []*DomainTakeover `json:"domainTakeovers,omitempty"`
	Errors          []string          `json:"errors,omitempty"`
}

DomainTakeoverReport represents a report of potential domain takeover vulnerabilities

type Fingerprint

type Fingerprint struct {
	CICDPass      bool     `json:"cicdPass"`
	CNAME         []string `json:"cname,omitempty"`
	Discussion    string   `json:"discussion"`
	Documentation string   `json:"documentation"`
	Fingerprint   string   `json:"fingerprint"`
	HTTPStatus    *int     `json:"httpStatus,omitempty"`
	NXDomain      bool     `json:"nxDomain"`
	Service       string   `json:"service"`
	Status        string   `json:"status"`
	Vulnerable    bool     `json:"vulnerable"`
}

Fingerprint represents a system fingerprint to detect domain takeovers

type IPAddress

type IPAddress struct {
	IP        string `json:"ip"`
	RDNS      string `json:"rdns"`
	Dedicated bool   `json:"dedicated"`
}

IPAddress represents an IP address with its associated properties

type Option

type Option func(*Options)

Option is a functional option for the DNSX client

func WithBaseResolvers

func WithBaseResolvers(resolvers []string) Option

WithBaseResolvers sets the base resolvers for the DNSX client

func WithHostsfile

func WithHostsfile(hostsfile bool) Option

WithHostsfile sets the hostsfile option for the DNSX client

func WithMaxRetries

func WithMaxRetries(retries int) Option

WithMaxRetries sets the max retries for the DNSX client

func WithOutputCDN

func WithOutputCDN(outputCDN bool) Option

WithOutputCDN sets the output CDN option for the DNSX client

func WithQueryAll

func WithQueryAll(queryAll bool) Option

WithQueryAll sets the query all option for the DNSX client

func WithQuestionTypes

func WithQuestionTypes(types []uint16) Option

WithQuestionTypes sets the question types for the DNSX client

func WithTrace

func WithTrace(trace bool) Option

WithTrace sets the trace option for the DNSX client

func WithTraceMaxRecursion

func WithTraceMaxRecursion(max int) Option

WithTraceMaxRecursion sets the max recursion for the trace option

type Options

type Options struct {
	// BaseResolvers are the base resolvers to use
	BaseResolvers []string
	// MaxRetries is the max number of retries to use
	MaxRetries int
	// QuestionTypes are the question types to use
	QuestionTypes []uint16
	// Trace is the trace option
	Trace bool
	// TraceMaxRecursion is the max recursion for the trace option
	TraceMaxRecursion int
	// Hostsfile is the hostsfile option
	Hostsfile bool
	// OutputCDN is the output CDN option
	OutputCDN bool
	// QueryAll is the query all option
	QueryAll bool
	// Proxy is the proxy option
	Proxy string
}

Options are the options for the DNSX client

func NewOptions

func NewOptions(opts ...Option) *Options

NewOptions creates a new Options struct with default values and allows overrides

type Service

type Service struct {
	Name        string `json:"name"`
	Fingerprint string `json:"fingerprint"`
	Vulnerable  bool   `json:"vulnerable"`
}

Service represents a service associated with a potential domain takeover vulnerability

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳