requests

package
v3.10.0 Latest Latest
Warning

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

Go to latest
Published: Aug 30, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NONE     = "none"
	ALT      = "alt"
	GUESS    = "guess"
	ARCHIVE  = "archive"
	API      = "api"
	AXFR     = "axfr"
	BRUTE    = "brute"
	CERT     = "cert"
	DNS      = "dns"
	RIR      = "rir"
	EXTERNAL = "ext"
	SCRAPE   = "scrape"
)

Request tag types.

View Source
const (
	NameRequestTopic   = "amass:namereq"
	NewNameTopic       = "amass:newname"
	AddrRequestTopic   = "amass:addrreq"
	NewAddrTopic       = "amass:newaddr"
	SubDiscoveredTopic = "amass:newsub"
	ResolveNameTopic   = "amass:resolve"
	NameResolvedTopic  = "amass:resolved"
	ASNRequestTopic    = "amass:asnreq"
	NewASNTopic        = "amass:newasn"
	WhoisRequestTopic  = "amass:whoisreq"
	NewWhoisTopic      = "amass:whoisinfo"
	LogTopic           = "amass:log"
	OutputTopic        = "amass:output"
	SetActiveTopic     = "amass:setactive"
	ResolveCompleted   = "amass:resolvecomp"
)

Request Pub/Sub topics used across Amass.

View Source
const (
	APIKeyRequired int = iota
	APIKeyNotRequired
	APIkeyOptional
)

Possible values for the AmassService.APIKeyRequired field.

Variables

This section is empty.

Functions

func SanitizeDNSRequest added in v3.5.2

func SanitizeDNSRequest(req *DNSRequest)

SanitizeDNSRequest cleans the Name and Domain elements of the receiver.

func TrustedTag

func TrustedTag(tag string) bool

TrustedTag returns true when the tag parameter is of a type that should be trusted even facing DNS wildcards.

Types

type ASNRequest

type ASNRequest struct {
	Address        string
	ASN            int
	Prefix         string
	CC             string
	Registry       string
	AllocationDate time.Time
	Description    string
	Netblocks      stringset.Set
	Tag            string
	Source         string
}

ASNRequest handles all autonomous system information needed by Amass.

type AddrRequest

type AddrRequest struct {
	Address string
	Domain  string
	Tag     string
	Source  string
}

AddrRequest handles data needed throughout Service processing of a network address.

type AddressInfo

type AddressInfo struct {
	Address     net.IP     `json:"ip"`
	Netblock    *net.IPNet `json:"-"`
	CIDRStr     string     `json:"cidr"`
	ASN         int        `json:"asn"`
	Description string     `json:"desc"`
}

AddressInfo stores all network addressing info for the Output type.

type BaseService added in v3.6.0

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

BaseService provides common mechanisms to all Amass services in the enumeration architecture. It is used to compose a type that completely meets the Service interface.

func NewBaseService added in v3.6.0

func NewBaseService(srv Service, name string) *BaseService

NewBaseService returns an initialized BaseService object.

func (*BaseService) ASNRequest added in v3.6.0

func (bas *BaseService) ASNRequest(ctx context.Context, req *ASNRequest)

ASNRequest adds the request provided by the parameter to the service request channel.

func (*BaseService) AddrRequest added in v3.6.0

func (bas *BaseService) AddrRequest(ctx context.Context, req *AddrRequest)

AddrRequest adds the request provided by the parameter to the service request channel.

func (*BaseService) CheckConfig added in v3.9.0

func (bas *BaseService) CheckConfig() error

CheckConfig checks if the service configuration allows for operation.

func (*BaseService) CheckRateLimit added in v3.6.0

func (bas *BaseService) CheckRateLimit()

CheckRateLimit blocks until the minimum wait since the last call.

func (*BaseService) ClearLast added in v3.8.0

func (bas *BaseService) ClearLast()

ClearLast resets the last value so the service can be utilized immediately.

func (*BaseService) DNSRequest added in v3.6.0

func (bas *BaseService) DNSRequest(ctx context.Context, req *DNSRequest)

DNSRequest adds the request provided by the parameter to the service request channel.

func (*BaseService) OnASNRequest added in v3.6.0

func (bas *BaseService) OnASNRequest(ctx context.Context, req *ASNRequest)

OnASNRequest is called for a request that was queued via ASNRequest.

func (*BaseService) OnAddrRequest added in v3.6.0

func (bas *BaseService) OnAddrRequest(ctx context.Context, req *AddrRequest)

OnAddrRequest is called for a request that was queued via AddrRequest.

func (*BaseService) OnDNSRequest added in v3.6.0

func (bas *BaseService) OnDNSRequest(ctx context.Context, req *DNSRequest)

OnDNSRequest is called for a request that was queued via DNSRequest.

func (*BaseService) OnResolved added in v3.7.0

func (bas *BaseService) OnResolved(ctx context.Context, req *DNSRequest)

OnResolved is called for a request that was queued via Resolved.

func (*BaseService) OnStart added in v3.6.0

func (bas *BaseService) OnStart() error

OnStart is a placeholder that should be implemented by an Service that has code to execute during service start.

func (*BaseService) OnStop added in v3.6.0

func (bas *BaseService) OnStop() error

OnStop is a placeholder that should be implemented by a Service that has code to execute during service stop.

func (*BaseService) OnSubdomainDiscovered added in v3.6.0

func (bas *BaseService) OnSubdomainDiscovered(ctx context.Context, req *DNSRequest, times int)

OnSubdomainDiscovered is called for a request that was queued via DNSRequest.

func (*BaseService) OnWhoisRequest added in v3.6.0

func (bas *BaseService) OnWhoisRequest(ctx context.Context, req *WhoisRequest)

OnWhoisRequest is called for a request that was queued via WhoisRequest.

func (*BaseService) Quit added in v3.6.0

func (bas *BaseService) Quit() <-chan struct{}

Quit return the quit channel for the service.

func (*BaseService) RequestLen added in v3.6.0

func (bas *BaseService) RequestLen() int

RequestLen returns the current length of the request queue.

func (*BaseService) Resolved added in v3.7.0

func (bas *BaseService) Resolved(ctx context.Context, req *DNSRequest)

Resolved adds the request provided by the parameter to the service request channel.

func (*BaseService) SetRateLimit added in v3.6.0

func (bas *BaseService) SetRateLimit(min time.Duration)

SetRateLimit sets the minimum wait between checks.

func (*BaseService) Start added in v3.6.0

func (bas *BaseService) Start() error

Start calls the OnStart method implemented for the Service.

func (*BaseService) Stats added in v3.6.0

func (bas *BaseService) Stats() *ServiceStats

Stats returns current ServiceStats that provide performance metrics.

func (*BaseService) Stop added in v3.6.0

func (bas *BaseService) Stop() error

Stop calls the OnStop method implemented for the Service.

func (*BaseService) String added in v3.6.0

func (bas *BaseService) String() string

String returns the name of the service.

func (*BaseService) SubdomainDiscovered added in v3.6.0

func (bas *BaseService) SubdomainDiscovered(ctx context.Context, req *DNSRequest, times int)

SubdomainDiscovered adds the request provided by the parameter to the service request channel.

func (*BaseService) Type added in v3.6.0

func (bas *BaseService) Type() string

Type returns the type of the service.

func (*BaseService) WhoisRequest added in v3.6.0

func (bas *BaseService) WhoisRequest(ctx context.Context, req *WhoisRequest)

WhoisRequest adds the request provided by the parameter to the service request channel.

type ContextKey

type ContextKey int

ContextKey is the type used for context value keys.

const (
	ContextConfig ContextKey = iota
	ContextEventBus
)

The key used when values are obtained during service requests.

type DNSAnswer

type DNSAnswer struct {
	Name string `json:"name"`
	Type int    `json:"type"`
	TTL  int    `json:"TTL"`
	Data string `json:"data"`
}

DNSAnswer is the type used by Amass to represent a DNS record.

type DNSRequest

type DNSRequest struct {
	Name    string
	Domain  string
	Records []DNSAnswer
	Tag     string
	Source  string
}

DNSRequest handles data needed throughout Service processing of a DNS name.

type Output

type Output struct {
	Name      string        `json:"name"`
	Domain    string        `json:"domain"`
	Addresses []AddressInfo `json:"addresses"`
	Tag       string        `json:"tag"`
	Sources   []string      `json:"sources"`
}

Output contains all the output data for an enumerated DNS name.

type Service added in v3.6.0

type Service interface {
	// Start the service
	Start() error
	OnStart() error

	// Stop the service
	Stop() error
	OnStop() error

	// CheckConfig checks if the service configuration allows for operation
	CheckConfig() error

	// RequestLen returns the current length of the request queue
	RequestLen() int

	// Methods to support processing of DNSRequests
	DNSRequest(ctx context.Context, req *DNSRequest)
	OnDNSRequest(ctx context.Context, req *DNSRequest)

	// Methods to support processing of resolved FQDNs
	Resolved(ctx context.Context, req *DNSRequest)
	OnResolved(ctx context.Context, req *DNSRequest)

	// Methods to support processing of discovered proper subdomains
	SubdomainDiscovered(ctx context.Context, req *DNSRequest, times int)
	OnSubdomainDiscovered(ctx context.Context, req *DNSRequest, times int)

	// Methods to support processing of AddrRequests
	AddrRequest(ctx context.Context, req *AddrRequest)
	OnAddrRequest(ctx context.Context, req *AddrRequest)

	// Methods to support processing of ASNRequests
	ASNRequest(ctx context.Context, req *ASNRequest)
	OnASNRequest(ctx context.Context, req *ASNRequest)

	// Methods to support processing of WhoisRequests
	WhoisRequest(ctx context.Context, req *WhoisRequest)
	OnWhoisRequest(ctx context.Context, req *WhoisRequest)

	// Returns a channel that is closed when the service is stopped
	Quit() <-chan struct{}

	// Type returns the type of the service
	Type() string

	// String description of the service
	String() string

	// Returns current ServiceStats that provide performance metrics
	Stats() *ServiceStats
}

Service is the object type for a service running within the Amass architecture.

type ServiceStats added in v3.6.0

type ServiceStats struct {
	DNSQueriesPerSec int
	NamesRemaining   int
	AddrsRemaining   int
}

ServiceStats provides metrics from an Amass service.

type WhoisRequest

type WhoisRequest struct {
	Domain     string
	Company    string
	Email      string
	NewDomains []string
	Tag        string
	Source     string
}

WhoisRequest handles data needed throughout Service processing of reverse whois.

Jump to

Keyboard shortcuts

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