core

package
v0.0.0-...-7fb8fc3 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2019 License: Apache-2.0 Imports: 17 Imported by: 83

Documentation

Index

Constants

View Source
const (
	ALT     = "alt"
	ARCHIVE = "archive"
	API     = "api"
	AXFR    = "axfr"
	BRUTE   = "brute"
	CERT    = "cert"
	DNS     = "dns"
	SCRAPE  = "scrape"
)

Request tag types.

View Source
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"
)

Request Pub/Sub topics used across Amass.

View Source
const (
	APIKeyRequired int = iota
	APIKeyNotRequired
	APIkeyOptional
)

Possible values for the AmassService.APIKeyRequired field.

View Source
const (
	// ServiceRequestChanLength is the length of the chan that pulls requests off the queue.
	ServiceRequestChanLength int = 1000
)

Variables

This section is empty.

Functions

func GetListFromFile

func GetListFromFile(path string) ([]string, error)

GetListFromFile reads a wordlist text or gzip file and returns the slice of words

func GetResolversFromSettings

func GetResolversFromSettings(path string) ([]string, error)

GetResolversFromSettings loads the configuration file and returns all resolvers found.

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 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) 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) IsActive

func (bas *BaseService) IsActive() bool

IsActive returns true if SetActive has been called for the service within the last 10 seconds.

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 an 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) RequestChan

func (bas *BaseService) RequestChan() <-chan *Request

RequestChan returns the channel that provides new service requests.

func (*BaseService) RequestLen

func (bas *BaseService) RequestLen() int

RequestLen returns the current length of the request queue.

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) SendRequest

func (bas *BaseService) SendRequest(req *Request)

SendRequest 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.

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 ports that will be checked for certificates
	Ports []int `ini:"port,,allowshadow"`

	// The list of words to use when generating names
	Wordlist []string

	// Will the enumeration including brute forcing techniques
	BruteForcing bool `ini:"brute_forcing"`

	// Will recursive brute forcing be performed?
	Recursive bool `ini:"recursive_brute_forcing"`

	// Minimum number of subdomain discoveries before performing recursive brute forcing
	MinForRecursive int `ini:"minimum_for_recursive"`

	// Will discovered subdomain name alterations be generated?
	Alterations    bool
	FlipWords      bool
	FlipNumbers    bool
	AddWords       bool
	AddNumbers     bool
	MinForWordFlip int
	EditDistance   int

	// 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 enumeration configurations

func (*Config) AddAPIKey

func (c *Config) AddAPIKey(source string, ak *APIKey)

AddAPIKey adds the data source and API key association provided to the configuration.

func (*Config) AddDomain

func (c *Config) AddDomain(domain string)

AddDomain appends the domain name provided in the parameter to the list in the configuration.

func (*Config) AddDomains

func (c *Config) AddDomains(domains []string)

AddDomains appends the domain names provided in the parameter to the list in the configuration.

func (*Config) Blacklisted

func (c *Config) Blacklisted(name string) bool

Blacklisted returns true is the name in the parameter ends with a subdomain name in the config blacklist.

func (*Config) CheckSettings

func (c *Config) CheckSettings() error

CheckSettings runs some sanity checks on the configuration options selected.

func (*Config) DomainRegex

func (c *Config) DomainRegex(domain string) *regexp.Regexp

DomainRegex returns the Regexp object for the domain name identified by the parameter.

func (*Config) Domains

func (c *Config) Domains() []string

Domains returns the list of domain names currently in the configuration.

func (*Config) ExcludeDisabledDataSources

func (c *Config) ExcludeDisabledDataSources(services []Service) []Service

ExcludeDisabledDataSources returns a list of data sources excluding DisabledDataSources.

func (*Config) GetAPIKey

func (c *Config) GetAPIKey(source string) *APIKey

GetAPIKey returns the API key associated with the provided data source name.

func (*Config) IsDomainInScope

func (c *Config) IsDomainInScope(name string) bool

IsDomainInScope returns true if the DNS name in the parameter ends with a domain in the config list.

func (*Config) LoadSettings

func (c *Config) LoadSettings(path string) error

LoadSettings parses settings from an .ini file and assigns them to the Config.

func (*Config) WhichDomain

func (c *Config) WhichDomain(name string) string

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 EventBus

type EventBus struct {
	sync.Mutex
	// contains filtered or unexported fields
}

EventBus handles sending and receiving events across Amass.

func NewEventBus

func NewEventBus() *EventBus

NewEventBus initializes and returns an EventBus object.

func (*EventBus) Publish

func (eb *EventBus) Publish(topic string, args ...interface{})

Publish sends req on the channel labeled with name.

func (*EventBus) Stop

func (eb *EventBus) Stop()

Stop prevents any additional requests from being sent.

func (*EventBus) Subscribe

func (eb *EventBus) Subscribe(topic string, fn interface{})

Subscribe registers callback to be executed for all requests on the channel labeled name.

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 Request

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

Request contains data obtained throughout Service processing.

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

	SendRequest(req *Request)
	RequestChan() <-chan *Request

	IsActive() bool
	SetActive()

	// Returns channels that fire during Pause/Resume operations
	PauseChan() <-chan struct{}
	ResumeChan() <-chan struct{}
	RequestLen() int

	// 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

type ServiceStats struct {
	DNSQueriesPerSec int
	NamesRemaining   int
	AddrsRemaining   int
}

ServiceStats provides metrics from an Amass service.

Jump to

Keyboard shortcuts

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