dns

package
v3.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: MIT Imports: 36 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DNSRequestTypeMapping = map[DNSRequestType]string{
	A:     "A",
	NS:    "NS",
	DS:    "DS",
	CNAME: "CNAME",
	SOA:   "SOA",
	PTR:   "PTR",
	MX:    "MX",
	TXT:   "TXT",
	AAAA:  "AAAA",
	CAA:   "CAA",
	TLSA:  "TLSA",
	ANY:   "ANY",
	SRV:   "SRV",
}

DNSRequestTypeMapping is a table for conversion of method from string.

View Source
var RequestPartDefinitions = map[string]string{
	"template-id":   "ID of the template executed",
	"template-info": "Info Block of the template executed",
	"template-path": "Path of the template executed",
	"host":          "Host is the input to the template",
	"matched":       "Matched is the input which was matched upon",
	"request":       "Request contains the DNS request in text format",
	"type":          "Type is the type of request made",
	"rcode":         "Rcode field returned for the DNS request",
	"question":      "Question contains the DNS question field",
	"extra":         "Extra contains the DNS response extra field",
	"answer":        "Answer contains the DNS response answer field",
	"ns":            "NS contains the DNS response NS field",
	"raw,body,all":  "Raw contains the raw DNS response (default)",
	"trace":         "Trace contains trace data for DNS request if enabled",
}

RequestPartDefinitions contains a mapping of request part definitions and their description. Multiple definitions are separated by commas. Definitions not having a name (generated on runtime) are prefixed & suffixed by <>.

Functions

This section is empty.

Types

type DNSRequestType

type DNSRequestType int

DNSRequestType is the type of the method specified

const (
	// name:A
	A DNSRequestType = iota + 1
	// name:NS
	NS
	// name:DS
	DS
	// name:CNAME
	CNAME
	// name:SOA
	SOA
	// name:PTR
	PTR
	// name:MX
	MX
	// name:TXT
	TXT
	// name:AAAA
	AAAA
	// name:CAA
	CAA
	// name:TLSA
	TLSA
	// name:ANY
	ANY
	// name:SRV
	SRV
)

name:DNSRequestType

func GetSupportedDNSRequestTypes

func GetSupportedDNSRequestTypes() []DNSRequestType

GetSupportedDNSRequestTypes returns list of supported types

func (DNSRequestType) String

func (t DNSRequestType) String() string

type DNSRequestTypeHolder

type DNSRequestTypeHolder struct {
	DNSRequestType DNSRequestType `mapping:"true"`
}

DNSRequestTypeHolder is used to hold internal type of the DNS type

func (DNSRequestTypeHolder) JSONSchema added in v3.2.4

func (holder DNSRequestTypeHolder) JSONSchema() *jsonschema.Schema

func (*DNSRequestTypeHolder) MarshalJSON

func (holder *DNSRequestTypeHolder) MarshalJSON() ([]byte, error)

func (DNSRequestTypeHolder) MarshalYAML

func (holder DNSRequestTypeHolder) MarshalYAML() (interface{}, error)

func (DNSRequestTypeHolder) String

func (holder DNSRequestTypeHolder) String() string

func (*DNSRequestTypeHolder) UnmarshalJSON

func (holder *DNSRequestTypeHolder) UnmarshalJSON(data []byte) error

func (*DNSRequestTypeHolder) UnmarshalYAML

func (holder *DNSRequestTypeHolder) UnmarshalYAML(unmarshal func(interface{}) error) error

type Request

type Request struct {
	// Operators for the current request go here.
	operators.Operators `yaml:",inline"`

	// ID is the optional id of the request
	ID string `` /* 133-byte string literal not displayed */

	// description: |
	//   Name is the Hostname to make DNS request for.
	//
	//   Generally, it is set to {{FQDN}} which is the domain we get from input.
	// examples:
	//   - value: "\"{{FQDN}}\""
	Name string `` /* 152-byte string literal not displayed */
	// description: |
	//   RequestType is the type of DNS request to make.
	RequestType DNSRequestTypeHolder `` /* 221-byte string literal not displayed */
	// description: |
	//   Class is the class of the DNS request.
	//
	//   Usually it's enough to just leave it as INET.
	// values:
	//   - "inet"
	//   - "csnet"
	//   - "chaos"
	//   - "hesiod"
	//   - "none"
	//   - "any"
	Class string `` /* 198-byte string literal not displayed */
	// description: |
	//   Retries is the number of retries for the DNS request
	// examples:
	//   - name: Use a retry of 3 to 5 generally
	//     value: 5
	Retries int `` /* 157-byte string literal not displayed */
	// description: |
	//   Trace performs a trace operation for the target.
	Trace bool `` /* 141-byte string literal not displayed */
	// description: |
	//   TraceMaxRecursion is the number of max recursion allowed for trace operations
	// examples:
	//   - name: Use a retry of 100 to 150 generally
	//     value: 100
	TraceMaxRecursion int `` /* 225-byte string literal not displayed */

	// description: |
	//   Attack is the type of payload combinations to perform.
	//
	//   Batteringram is inserts the same payload into all defined payload positions at once, pitchfork combines multiple payload sets and clusterbomb generates
	//   permutations and combinations for all payloads.
	AttackType generators.AttackTypeHolder `` /* 216-byte string literal not displayed */
	// description: |
	//   Payloads contains any payloads for the current request.
	//
	//   Payloads support both key-values combinations where a list
	//   of payloads is provided, or optionally a single file can also
	//   be provided as payload which will be read on run-time.
	Payloads map[string]interface{} `` /* 170-byte string literal not displayed */
	// description: |
	//    Threads to use when sending iterating over payloads
	// examples:
	//   - name: Send requests using 10 concurrent threads
	//     value: 10
	Threads int `` /* 202-byte string literal not displayed */

	CompiledOperators *operators.Operators `yaml:"-" json:"-"`

	// description: |
	//   Recursion determines if resolver should recurse all records to get fresh results.
	Recursion *bool `` /* 185-byte string literal not displayed */
	// Resolvers to use for the dns requests
	Resolvers []string `` /* 138-byte string literal not displayed */
	// contains filtered or unexported fields
}

Request contains a DNS protocol request to be made from a template

func (*Request) Compile

func (request *Request) Compile(options *protocols.ExecutorOptions) error

Compile compiles the protocol request for further execution.

func (*Request) ExecuteWithResults

func (request *Request) ExecuteWithResults(input *contextargs.Context, metadata, previous output.InternalEvent, callback protocols.OutputEventCallback) error

ExecuteWithResults executes the protocol requests and returns results instead of writing them.

func (*Request) Extract

func (request *Request) Extract(data map[string]interface{}, extractor *extractors.Extractor) map[string]struct{}

Extract performs extracting operation for an extractor on model and returns true or false.

func (*Request) GetCompiledOperators

func (request *Request) GetCompiledOperators() []*operators.Operators

func (*Request) GetID

func (request *Request) GetID() string

GetID returns the unique ID of the request if any.

func (*Request) IsClusterable added in v3.3.0

func (request *Request) IsClusterable() bool

IsClusterable returns true if the request is eligible to be clustered.

func (*Request) Make

func (request *Request) Make(host string, vars map[string]interface{}) (*dns.Msg, error)

Make returns the request to be sent for the protocol

func (*Request) MakeResultEvent

func (request *Request) MakeResultEvent(wrapped *output.InternalWrappedEvent) []*output.ResultEvent

MakeResultEvent creates a result event from internal wrapped event

func (*Request) MakeResultEventItem

func (request *Request) MakeResultEventItem(wrapped *output.InternalWrappedEvent) *output.ResultEvent

func (*Request) Match

func (request *Request) Match(data map[string]interface{}, matcher *matchers.Matcher) (bool, []string)

Match matches a generic data response against a given matcher

func (*Request) Options

func (r *Request) Options() *protocols.ExecutorOptions

Options returns executer options for http request

func (*Request) Requests

func (request *Request) Requests() int

Requests returns the total number of requests the YAML rule will perform

func (*Request) TmplClusterKey added in v3.3.0

func (request *Request) TmplClusterKey() uint64

TmplClusterKey generates a unique key for the request to be used in the clustering process.

func (*Request) Type

func (request *Request) Type() templateTypes.ProtocolType

Type returns the type of the protocol request

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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