handlers

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: 21 Imported by: 2

Documentation

Index

Constants

View Source
const (
	OptDomain         = "domain"
	OptSubdomain      = "subdomain"
	OptCNAME          = "cname"
	OptA              = "a"
	OptAAAA           = "aaaa"
	OptPTR            = "ptr"
	OptSRV            = "service"
	OptNS             = "ns"
	OptMX             = "mx"
	OptInfrastructure = "infrastructure"
)

These strings represent the various Amass data operations.

View Source
const (
	// DefaultGraphDBDirectory is the directory name used by default for the graph database.
	DefaultGraphDBDirectory string = "amass_output"
)
View Source
const (
	// GremlinMaxConnections defines the limited number of concurrent connections to the Gremlin Server.
	GremlinMaxConnections int = 25
)

Variables

This section is empty.

Functions

func DataOptsDriver

func DataOptsDriver(data []DataOptsParams, handler DataHandler) error

DataOptsDriver uses a slice of DataOptsParams to populate another Amass DataHandler.

Types

type DataHandler

type DataHandler interface {
	fmt.Stringer

	// Inserts data operations into the graph.
	Insert(data *DataOptsParams) error

	// Returns a list of enumeration IDs found in the data.
	EnumerationList() []string

	// Returns the domains that were involved in the provided enumeration.
	EnumerationDomains(uuid string) []string

	// Returns the date range associated with the provided enumeration UUID.
	EnumerationDateRange(uuid string) (time.Time, time.Time)

	// Returns complete paths in the graph, with the option of only unmarked results.
	GetOutput(uuid string, marked bool) []*core.Output

	// Sets a 'read' property on the vertex matching Name, Domain and UUID.
	MarkAsRead(data *DataOptsParams) error

	// Return true if the Name, Domain and UUID match a CNAME in the graph.
	IsCNAMENode(data *DataOptsParams) bool

	// Signals the handler to prepare for closing.
	Close()
}

DataHandler is the interface for storage of Amass data operations.

type DataOptsHandler

type DataOptsHandler struct {
	Enc *json.Encoder
}

DataOptsHandler is the object that implements the DataHandler interface for JSON files.

func NewDataOptsHandler

func NewDataOptsHandler(w io.Writer) *DataOptsHandler

NewDataOptsHandler returns a JSON file handler for Amass data operations.

func (*DataOptsHandler) Close

func (d *DataOptsHandler) Close()

Close implements the Amass DataHandler interface.

func (*DataOptsHandler) EnumerationDateRange

func (d *DataOptsHandler) EnumerationDateRange(uuid string) (time.Time, time.Time)

EnumerationDateRange returns the date range associated with the provided enumeration UUID.

func (*DataOptsHandler) EnumerationDomains

func (d *DataOptsHandler) EnumerationDomains(uuid string) []string

EnumerationDomains returns the domains that were involved in the provided enumeration.

func (*DataOptsHandler) EnumerationList

func (d *DataOptsHandler) EnumerationList() []string

EnumerationList returns a list of enumeration IDs found in the data.

func (*DataOptsHandler) GetOutput

func (d *DataOptsHandler) GetOutput(uuid string, marked bool) []*core.Output

GetOutput implements the Amass DataHandler interface.

func (*DataOptsHandler) Insert

func (d *DataOptsHandler) Insert(data *DataOptsParams) error

Insert implements the Amass DataHandler interface.

func (*DataOptsHandler) IsCNAMENode

func (d *DataOptsHandler) IsCNAMENode(data *DataOptsParams) bool

IsCNAMENode implements the Amass DataHandler interface.

func (*DataOptsHandler) MarkAsRead

func (d *DataOptsHandler) MarkAsRead(data *DataOptsParams) error

MarkAsRead implements the Amass DataHandler interface.

func (*DataOptsHandler) String

func (d *DataOptsHandler) String() string

String returns a description for the DataOptsHandler object.

type DataOptsParams

type DataOptsParams struct {
	UUID         string `json:"uuid"`
	Timestamp    string `json:"timestamp"`
	Type         string `json:"type"`
	Name         string `json:"name"`
	Domain       string `json:"domain"`
	Service      string `json:"service"`
	TargetName   string `json:"target_name"`
	TargetDomain string `json:"target_domain"`
	Address      string `json:"addr"`
	ASN          int    `json:"asn"`
	CIDR         string `json:"cidr"`
	Description  string `json:"desc"`
	Tag          string `json:"tag"`
	Source       string `json:"source"`
}

DataOptsParams defines the parameters for Amass data operations.

func ParseDataOpts

func ParseDataOpts(r io.Reader) ([]DataOptsParams, error)

ParseDataOpts decodes JSON entries provided via a Reader and returns a DataOptsParams slice.

type Graph

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

Graph is the object for managing a network infrastructure link graph.

func NewGraph

func NewGraph(path string) *Graph

NewGraph returns an intialized Graph object.

func (*Graph) Close

func (g *Graph) Close()

Close implements the Amass DataHandler interface.

func (*Graph) EnumerationDateRange

func (g *Graph) EnumerationDateRange(uuid string) (time.Time, time.Time)

EnumerationDateRange returns the date range associated with the provided enumeration UUID.

func (*Graph) EnumerationDomains

func (g *Graph) EnumerationDomains(uuid string) []string

EnumerationDomains returns the domains that were involved in the provided enumeration.

func (*Graph) EnumerationList

func (g *Graph) EnumerationList() []string

EnumerationList returns a list of enumeration IDs found in the data.

func (*Graph) GetOutput

func (g *Graph) GetOutput(uuid string, marked bool) []*core.Output

GetOutput returns new findings within the enumeration Graph.

func (*Graph) Insert

func (g *Graph) Insert(data *DataOptsParams) error

Insert implements the Amass DataHandler interface.

func (*Graph) IsCNAMENode

func (g *Graph) IsCNAMENode(data *DataOptsParams) bool

IsCNAMENode implements the Amass DataHandler interface.

func (*Graph) MarkAsRead

func (g *Graph) MarkAsRead(data *DataOptsParams) error

MarkAsRead implements the Amass DataHandler interface.

func (*Graph) String

func (g *Graph) String() string

String implements the Amass data handler interface.

func (*Graph) VizData

func (g *Graph) VizData(uuid string) ([]viz.Node, []viz.Edge)

VizData returns the current state of the Graph as viz package Nodes and Edges.

type Gremlin

type Gremlin struct {
	Log *log.Logger
	URL string
	// contains filtered or unexported fields
}

Gremlin is the client object for a Gremlin/TinkerPop graph database connection.

func NewGremlin

func NewGremlin(url, user, pass string, l *log.Logger) *Gremlin

NewGremlin returns a client object that implements the Amass DataHandler interface. The url param typically looks like the following: ws://localhost:8182

func (*Gremlin) Close

func (g *Gremlin) Close()

Close implements the Amass DataHandler interface.

func (*Gremlin) EnumerationDateRange

func (g *Gremlin) EnumerationDateRange(uuid string) (time.Time, time.Time)

EnumerationDateRange returns the date range associated with the provided enumeration UUID.

func (*Gremlin) EnumerationDomains

func (g *Gremlin) EnumerationDomains(uuid string) []string

EnumerationDomains returns the domains that were involved in the provided enumeration.

func (*Gremlin) EnumerationList

func (g *Gremlin) EnumerationList() []string

EnumerationList returns a list of enumeration IDs found in the data.

func (*Gremlin) GetOutput

func (g *Gremlin) GetOutput(uuid string, marked bool) []*core.Output

GetOutput implements the Amass DataHandler interface.

func (*Gremlin) Insert

func (g *Gremlin) Insert(data *DataOptsParams) error

Insert implements the Amass DataHandler interface.

func (*Gremlin) IsCNAMENode

func (g *Gremlin) IsCNAMENode(data *DataOptsParams) bool

IsCNAMENode implements the Amass DataHandler interface.

func (*Gremlin) MarkAsRead

func (g *Gremlin) MarkAsRead(data *DataOptsParams) error

MarkAsRead implements the Amass DataHandler interface.

func (*Gremlin) String

func (g *Gremlin) String() string

String returns a description for the Gremlin client object.

type Neo4j

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

Neo4j is the client object for a Neo4j graph database connection.

func NewNeo4j

func NewNeo4j(url, username, password string, l *log.Logger) (*Neo4j, error)

NewNeo4j returns a client object that implements the Amass DataHandler interface. The url param typically looks like the following: localhost:7687

func (*Neo4j) Close

func (n *Neo4j) Close()

Close cleans up the Neo4j client object.

func (*Neo4j) EnumerationDateRange

func (n *Neo4j) EnumerationDateRange(uuid string) (time.Time, time.Time)

EnumerationDateRange returns the date range associated with the provided enumeration UUID.

func (*Neo4j) EnumerationDomains

func (n *Neo4j) EnumerationDomains(uuid string) []string

EnumerationDomains returns the domains that were involved in the provided enumeration.

func (*Neo4j) EnumerationList

func (n *Neo4j) EnumerationList() []string

EnumerationList returns a list of enumeration IDs found in the data.

func (*Neo4j) GetOutput

func (n *Neo4j) GetOutput(uuid string, marked bool) []*core.Output

GetOutput implements the Amass DataHandler interface.

func (*Neo4j) Insert

func (n *Neo4j) Insert(data *DataOptsParams) error

Insert implements the Amass DataHandler interface.

func (*Neo4j) IsCNAMENode

func (n *Neo4j) IsCNAMENode(data *DataOptsParams) bool

IsCNAMENode implements the Amass DataHandler interface.

func (*Neo4j) MarkAsRead

func (n *Neo4j) MarkAsRead(data *DataOptsParams) error

MarkAsRead implements the Amass DataHandler interface.

func (*Neo4j) String

func (n *Neo4j) String() string

String returns a description for the Neo4j client object.

Jump to

Keyboard shortcuts

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