Documentation ¶
Index ¶
- Constants
- func AcquireConfig(dir, file string, config *Config) (string, bool)
- func GetListFromFile(path string) ([]string, error)
- func GetResolversFromSettings(path string) ([]string, error)
- func OutputDirectory(dir string) string
- func RemoveLastDot(name string) string
- func ReverseDNS(addr string) (string, string, error)
- func SetCustomResolvers(res []string) error
- func SubdomainToDomain(name string) string
- type APIKey
- type ASNRequest
- type AddrRequest
- type AddressInfo
- type BaseService
- func (bas *BaseService) ASNRequestChan() <-chan *ASNRequest
- func (bas *BaseService) ASNRequestLen() int
- func (bas *BaseService) AddrRequestChan() <-chan *AddrRequest
- func (bas *BaseService) AddrRequestLen() int
- func (bas *BaseService) Bus() *EventBus
- func (bas *BaseService) Config() *Config
- func (bas *BaseService) DNSRequestChan() <-chan *DNSRequest
- func (bas *BaseService) DNSRequestLen() int
- func (bas *BaseService) IsActive() bool
- func (bas *BaseService) LowNumberOfNames() error
- func (bas *BaseService) OnLowNumberOfNames() error
- func (bas *BaseService) OnPause() error
- func (bas *BaseService) OnResume() error
- func (bas *BaseService) OnStart() error
- func (bas *BaseService) OnStop() error
- func (bas *BaseService) Pause() error
- func (bas *BaseService) PauseChan() <-chan struct{}
- func (bas *BaseService) Quit() <-chan struct{}
- func (bas *BaseService) Resume() error
- func (bas *BaseService) ResumeChan() <-chan struct{}
- func (bas *BaseService) SendASNRequest(req *ASNRequest)
- func (bas *BaseService) SendAddrRequest(req *AddrRequest)
- func (bas *BaseService) SendDNSRequest(req *DNSRequest)
- func (bas *BaseService) SendWhoisRequest(req *WhoisRequest)
- func (bas *BaseService) SetActive()
- func (bas *BaseService) Start() error
- func (bas *BaseService) Stats() *ServiceStats
- func (bas *BaseService) Stop() error
- func (bas *BaseService) String() string
- func (bas *BaseService) WhoisRequestChan() <-chan *WhoisRequest
- func (bas *BaseService) WhoisRequestLen() int
- type Config
- func (c *Config) AddAPIKey(source string, ak *APIKey)
- func (c *Config) AddDomain(domain string)
- func (c *Config) AddDomains(domains []string)
- func (c *Config) Blacklisted(name string) bool
- func (c *Config) CheckSettings() error
- func (c *Config) DomainRegex(domain string) *regexp.Regexp
- func (c *Config) Domains() []string
- func (c *Config) ExcludeDisabledDataSources(services []Service) []Service
- func (c *Config) GetAPIKey(source string) *APIKey
- func (c *Config) IsAddressInScope(addr string) bool
- func (c *Config) IsDomainInScope(name string) bool
- func (c *Config) LoadSettings(path string) error
- func (c *Config) WhichDomain(name string) string
- type DNSAnswer
- type DNSRequest
- type EventBus
- type MetricsCollector
- type Output
- type ResolveError
- type Service
- type ServiceStats
- type WhoisRequest
Constants ¶
const ( ALT = "alt" ARCHIVE = "archive" API = "api" AXFR = "axfr" BRUTE = "brute" CERT = "cert" DNS = "dns" EXTERNAL = "ext" SCRAPE = "scrape" )
Request tag types.
const ( NewNameTopic = "amass:newname" NewAddrTopic = "amass:newaddr" NewSubdomainTopic = "amass:newsub" ResolveNameTopic = "amass:resolve" NameResolvedTopic = "amass:resolved" ReverseSweepTopic = "amass:sweep" ActiveCertTopic = "amass:activecert" OutputTopic = "amass:output" IPToASNTopic = "amass:iptoasn" NewASNTopic = "amass:asn" WhoisRequestTopic = "amass:whoisreq" NewWhoisTopic = "amass:whoisinfo" )
Request Pub/Sub topics used across Amass.
const ( PriorityLow int = iota PriorityHigh PriorityCritical )
The priority levels for DNS resolution.
const ( APIKeyRequired int = iota APIKeyNotRequired APIkeyOptional )
Possible values for the AmassService.APIKeyRequired field.
const (
// DefaultOutputDirectory is the name of the directory used for output files, such as the graph database.
DefaultOutputDirectory = "amass"
)
const ( // ServiceRequestChanLength is the length of the chan that pulls requests off the queue. ServiceRequestChanLength int = 1000 )
Variables ¶
This section is empty.
Functions ¶
func AcquireConfig ¶
AcquireConfig populates the Config struct provided by the config argument. The configuration file path and a bool indicating the settings were successfully loaded are returned.
func GetListFromFile ¶
GetListFromFile reads a wordlist text or gzip file and returns the slice of words.
func GetResolversFromSettings ¶
GetResolversFromSettings loads the configuration file and returns all resolvers found.
func OutputDirectory ¶
OutputDirectory returns the file path of the Amass output directory. A suitable path provided will be used as the output directory instead.
func RemoveLastDot ¶
RemoveLastDot removes the '.' at the end of the provided FQDN.
func ReverseDNS ¶
ReverseDNS is performs reverse DNS queries without using the DNSService object.
func SetCustomResolvers ¶
SetCustomResolvers modifies the set of resolvers.
func SubdomainToDomain ¶
SubdomainToDomain returns the first subdomain name of the provided parameter that responds to a DNS query for the NS record type.
Types ¶
type APIKey ¶
type APIKey struct { Username string `ini:"username"` Password string `ini:"password"` Key string `ini:"apikey"` Secret string `ini:"secret"` }
APIKey contains values required for authenticating with web APIs.
type ASNRequest ¶
type ASNRequest struct { Address string ASN int Prefix string CC string Registry string AllocationDate time.Time Description string Netblocks []string Tag string Source string }
ASNRequest handles all autonomous system information needed by Amass.
type AddrRequest ¶
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 ¶
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 AmassService interface.
func NewBaseService ¶
func NewBaseService(srv Service, name string, config *Config, bus *EventBus) *BaseService
NewBaseService returns an initialized BaseService object.
func (*BaseService) ASNRequestChan ¶
func (bas *BaseService) ASNRequestChan() <-chan *ASNRequest
ASNRequestChan returns the channel that provides new service requests.
func (*BaseService) ASNRequestLen ¶
func (bas *BaseService) ASNRequestLen() int
ASNRequestLen returns the current length of the request queue.
func (*BaseService) AddrRequestChan ¶
func (bas *BaseService) AddrRequestChan() <-chan *AddrRequest
AddrRequestChan returns the channel that provides new service requests.
func (*BaseService) AddrRequestLen ¶
func (bas *BaseService) AddrRequestLen() int
AddrRequestLen returns the current length of the request queue.
func (*BaseService) Bus ¶
func (bas *BaseService) Bus() *EventBus
Bus returns the EventBus that handles communication for the enumeration.
func (*BaseService) Config ¶
func (bas *BaseService) Config() *Config
Config returns the Config for the enumeration this service supports.
func (*BaseService) DNSRequestChan ¶
func (bas *BaseService) DNSRequestChan() <-chan *DNSRequest
DNSRequestChan returns the channel that provides new service requests.
func (*BaseService) DNSRequestLen ¶
func (bas *BaseService) DNSRequestLen() int
DNSRequestLen returns the current length of the request queue.
func (*BaseService) IsActive ¶
func (bas *BaseService) IsActive() bool
IsActive returns true if SetActive has been called for the service within the last 3 seconds.
func (*BaseService) LowNumberOfNames ¶
func (bas *BaseService) LowNumberOfNames() error
LowNumberOfNames calls the OnLowNumberOfNames method implemented for the Service.
func (*BaseService) OnLowNumberOfNames ¶
func (bas *BaseService) OnLowNumberOfNames() error
OnLowNumberOfNames is a placeholder that should be implemented by a Service that has code to be executed when the enumeration is low in names to resolve.
func (*BaseService) OnPause ¶
func (bas *BaseService) OnPause() error
OnPause implements the Service interface
func (*BaseService) OnResume ¶
func (bas *BaseService) OnResume() error
OnResume implements the Service interface
func (*BaseService) OnStart ¶
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 ¶
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) Pause ¶
func (bas *BaseService) Pause() error
Pause implements the Service interface
func (*BaseService) PauseChan ¶
func (bas *BaseService) PauseChan() <-chan struct{}
PauseChan returns the pause channel for the service.
func (*BaseService) Quit ¶
func (bas *BaseService) Quit() <-chan struct{}
Quit return the quit channel for the service.
func (*BaseService) Resume ¶
func (bas *BaseService) Resume() error
Resume implements the Service interface
func (*BaseService) ResumeChan ¶
func (bas *BaseService) ResumeChan() <-chan struct{}
ResumeChan returns the resume channel for the service.
func (*BaseService) SendASNRequest ¶
func (bas *BaseService) SendASNRequest(req *ASNRequest)
SendASNRequest adds the request provided by the parameter to the service request channel.
func (*BaseService) SendAddrRequest ¶
func (bas *BaseService) SendAddrRequest(req *AddrRequest)
SendAddrRequest adds the request provided by the parameter to the service request channel.
func (*BaseService) SendDNSRequest ¶
func (bas *BaseService) SendDNSRequest(req *DNSRequest)
SendDNSRequest adds the request provided by the parameter to the service request channel.
func (*BaseService) SendWhoisRequest ¶
func (bas *BaseService) SendWhoisRequest(req *WhoisRequest)
SendWhoisRequest adds the request provided by the parameter to the service request channel.
func (*BaseService) SetActive ¶
func (bas *BaseService) SetActive()
SetActive marks the service as being active at time.Now() for future checks performed by the IsActive method.
func (*BaseService) Start ¶
func (bas *BaseService) Start() error
Start calls the OnStart method implemented for the Service.
func (*BaseService) Stats ¶
func (bas *BaseService) Stats() *ServiceStats
Stats returns current ServiceStats that provide performance metrics
func (*BaseService) Stop ¶
func (bas *BaseService) Stop() error
Stop calls the OnStop method implemented for the Service.
func (*BaseService) String ¶
func (bas *BaseService) String() string
String returns the name of the service.
func (*BaseService) WhoisRequestChan ¶
func (bas *BaseService) WhoisRequestChan() <-chan *WhoisRequest
WhoisRequestChan returns the channel that provides new service requests.
func (*BaseService) WhoisRequestLen ¶
func (bas *BaseService) WhoisRequestLen() int
WhoisRequestLen returns the current length of the request queue.
type Config ¶
type Config struct { sync.Mutex // A Universally Unique Identifier (UUID) for the enumeration UUID uuid.UUID // Logger for error messages Log *log.Logger // The writer used to save the data operations performed DataOptsWriter io.Writer // The directory that stores the bolt db and other files created Dir string `ini:"output_directory"` // The settings for connecting with a Gremlin Server GremlinURL string GremlinUser string GremlinPass string // The maximum number of concurrent DNS queries MaxDNSQueries int `ini:"maximum_dns_queries"` // Semaphore to enforce the maximum DNS queries SemMaxDNSQueries utils.Semaphore // The IP addresses specified as in scope Addresses []net.IP // CIDR that is in scope CIDRs []*net.IPNet // ASNs specified as in scope ASNs []int // The ports that will be checked for certificates Ports []int // The list of words to use when generating names Wordlist []string // Will the enumeration including brute forcing techniques BruteForcing bool // Will recursive brute forcing be performed? Recursive bool // Minimum number of subdomain discoveries before performing recursive brute forcing MinForRecursive int // Will discovered subdomain name alterations be generated? Alterations bool FlipWords bool FlipNumbers bool AddWords bool AddNumbers bool MinForWordFlip int EditDistance int AltWordlist []string // Only access the data sources for names and return results? Passive bool // Determines if zone transfers will be attempted Active bool // Determines if unresolved DNS names will be output by the enumeration IncludeUnresolvable bool `ini:"include_unresolvable"` // A blacklist of subdomain names that will not be investigated Blacklist []string // A list of data sources that should not be utilized DisabledDataSources []string // contains filtered or unexported fields }
Config passes along Amass configuration settings and options.
func (*Config) AddAPIKey ¶
AddAPIKey adds the data source and API key association provided to the configuration.
func (*Config) AddDomain ¶
AddDomain appends the domain name provided in the parameter to the list in the configuration.
func (*Config) AddDomains ¶
AddDomains appends the domain names provided in the parameter to the list in the configuration.
func (*Config) Blacklisted ¶
Blacklisted returns true is the name in the parameter ends with a subdomain name in the config blacklist.
func (*Config) CheckSettings ¶
CheckSettings runs some sanity checks on the configuration options selected.
func (*Config) DomainRegex ¶
DomainRegex returns the Regexp object for the domain name identified by the parameter.
func (*Config) ExcludeDisabledDataSources ¶
ExcludeDisabledDataSources returns a list of data sources excluding DisabledDataSources.
func (*Config) GetAPIKey ¶
GetAPIKey returns the API key associated with the provided data source name.
func (*Config) IsAddressInScope ¶
IsAddressInScope returns true if the addr parameter matches provided network scope and when no network scope has been set.
func (*Config) IsDomainInScope ¶
IsDomainInScope returns true if the DNS name in the parameter ends with a domain in the config list.
func (*Config) LoadSettings ¶
LoadSettings parses settings from an .ini file and assigns them to the Config.
func (*Config) WhichDomain ¶
WhichDomain returns the domain in the config list that the DNS name in the parameter ends with.
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 ¶
DNSRequest handles data needed throughout Service processing of a DNS name.
func NsecTraversal ¶
func NsecTraversal(domain, server string) ([]*DNSRequest, error)
NsecTraversal attempts to retrieve a DNS zone using NSEC-walking.
func ZoneTransfer ¶
func ZoneTransfer(sub, domain, server string) ([]*DNSRequest, error)
ZoneTransfer attempts a DNS zone transfer using the server identified in the parameters. The returned slice contains all the records discovered from the zone transfer.
type EventBus ¶
EventBus handles sending and receiving events across Amass.
func NewEventBus ¶
func NewEventBus() *EventBus
NewEventBus initializes and returns an EventBus object.
func (*EventBus) Stop ¶
func (eb *EventBus) Stop()
Stop prevents any additional requests from being sent.
func (*EventBus) Subscribe ¶
Subscribe registers callback to be executed for all requests on the channel.
func (*EventBus) Unsubscribe ¶
Unsubscribe deregisters the callback from the channel.
type MetricsCollector ¶
type MetricsCollector struct {
// contains filtered or unexported fields
}
MetricsCollector provides Amass services with the ability to track performance.
func NewMetricsCollector ¶
func NewMetricsCollector(srv Service) *MetricsCollector
NewMetricsCollector returns an initialized MetricsCollector.
func (*MetricsCollector) NamesRemainingCallback ¶
func (mc *MetricsCollector) NamesRemainingCallback(nrc func() int)
NamesRemainingCallback updates the names remaining callback routine.
func (*MetricsCollector) QueryTime ¶
func (mc *MetricsCollector) QueryTime(t time.Time)
QueryTime allows a DNS query event time to be posted with the MetricsCollector.
func (*MetricsCollector) Stats ¶
func (mc *MetricsCollector) Stats() *ServiceStats
Stats returns ServiceStats for the metrics collected by this MetricsCollector.
func (*MetricsCollector) Stop ¶
func (mc *MetricsCollector) Stop()
Stop halts execution of the metrics collector.
type Output ¶
type Output struct { Timestamp time.Time Name string `json:"name"` Domain string `json:"domain"` Addresses []AddressInfo `json:"addresses"` Tag string `json:"tag"` Source string `json:"source"` }
Output contains all the output data for an enumerated DNS name.
type ResolveError ¶
ResolveError contains the Rcode returned during the DNS query.
func (*ResolveError) Error ¶
func (e *ResolveError) Error() string
type Service ¶
type Service interface { // Start the service Start() error OnStart() error // Pause the service Pause() error OnPause() error // Resume the service Resume() error OnResume() error // Stop the service Stop() error OnStop() error // Architecture is ready for more names LowNumberOfNames() error OnLowNumberOfNames() error // Methods to support processing of DNSRequests SendDNSRequest(req *DNSRequest) DNSRequestChan() <-chan *DNSRequest DNSRequestLen() int // Methods to support processing of AddrRequests SendAddrRequest(req *AddrRequest) AddrRequestChan() <-chan *AddrRequest AddrRequestLen() int // Methods to support processing of ASNRequests SendASNRequest(req *ASNRequest) ASNRequestChan() <-chan *ASNRequest ASNRequestLen() int // Methods to support processing of WhoisRequests SendWhoisRequest(req *WhoisRequest) WhoisRequestChan() <-chan *WhoisRequest WhoisRequestLen() int IsActive() bool SetActive() // Returns channels that fire during Pause/Resume operations PauseChan() <-chan struct{} ResumeChan() <-chan struct{} // Returns a channel that is closed when the service is stopped Quit() <-chan struct{} // String description of the service String() string // Returns the configuration for the enumeration this service supports Config() *Config // Returns the event bus that handles communication for the enumeration Bus() *EventBus // Returns current ServiceStats that provide performance metrics Stats() *ServiceStats }
Service is the object type for a service running within the Amass enumeration architecture.
type ServiceStats ¶
ServiceStats provides metrics from an Amass service.