graph

package
v3.11.12 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IN int = iota
	OUT
	BOTH
)

Constant values that represent the direction of edges during graph queries.

Variables

This section is empty.

Functions

This section is empty.

Types

type CayleyGraph added in v3.10.0

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

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

func NewCayleyGraph added in v3.10.0

func NewCayleyGraph(system, path string, options string) *CayleyGraph

NewCayleyGraph returns an intialized CayleyGraph object.

func NewCayleyGraphMemory added in v3.10.0

func NewCayleyGraphMemory() *CayleyGraph

NewCayleyGraphMemory creates a temporary graph in memory.

func (*CayleyGraph) AllNodesOfType added in v3.10.0

func (g *CayleyGraph) AllNodesOfType(ntypes ...string) ([]Node, error)

AllNodesOfType implements the GraphDatabase interface.

func (*CayleyGraph) AllOutNodes added in v3.10.0

func (g *CayleyGraph) AllOutNodes(node Node) ([]Node, error)

AllOutNodes returns all the nodes that the parameter node has out edges to.

func (*CayleyGraph) Close added in v3.10.0

func (g *CayleyGraph) Close()

Close implements the GraphDatabase interface.

func (*CayleyGraph) CountEdges added in v3.10.0

func (g *CayleyGraph) CountEdges(node Node, predicates ...string) (int, error)

CountEdges counts the total number of edges to a node.

func (*CayleyGraph) CountInEdges added in v3.10.0

func (g *CayleyGraph) CountInEdges(node Node, predicates ...string) (int, error)

CountInEdges implements the GraphDatabase interface.

func (*CayleyGraph) CountOutEdges added in v3.10.0

func (g *CayleyGraph) CountOutEdges(node Node, predicates ...string) (int, error)

CountOutEdges implements the GraphDatabase interface.

func (*CayleyGraph) CountProperties added in v3.10.0

func (g *CayleyGraph) CountProperties(node Node, predicates ...string) (int, error)

CountProperties implements the GraphDatabase interface.

func (*CayleyGraph) DeleteEdge added in v3.10.0

func (g *CayleyGraph) DeleteEdge(edge *Edge) error

DeleteEdge implements the GraphDatabase interface.

func (*CayleyGraph) DeleteNode added in v3.10.0

func (g *CayleyGraph) DeleteNode(node Node) error

DeleteNode implements the GraphDatabase interface.

func (*CayleyGraph) DeleteProperty added in v3.10.0

func (g *CayleyGraph) DeleteProperty(node Node, predicate, value string) error

DeleteProperty implements the GraphDatabase interface.

func (*CayleyGraph) DumpGraph added in v3.10.0

func (g *CayleyGraph) DumpGraph() string

DumpGraph prints all data currently in the graph.

func (*CayleyGraph) InsertEdge added in v3.10.0

func (g *CayleyGraph) InsertEdge(edge *Edge) error

InsertEdge implements the GraphDatabase interface.

func (*CayleyGraph) InsertNode added in v3.10.0

func (g *CayleyGraph) InsertNode(id, ntype string) (Node, error)

InsertNode implements the GraphDatabase interface.

func (*CayleyGraph) InsertProperty added in v3.10.0

func (g *CayleyGraph) InsertProperty(node Node, predicate, value string) error

InsertProperty implements the GraphDatabase interface.

func (*CayleyGraph) NodeToID added in v3.10.0

func (g *CayleyGraph) NodeToID(n Node) string

NodeToID implements the GraphDatabase interface.

func (*CayleyGraph) ReadEdges added in v3.10.0

func (g *CayleyGraph) ReadEdges(node Node, predicates ...string) ([]*Edge, error)

ReadEdges implements the GraphDatabase interface.

func (*CayleyGraph) ReadInEdges added in v3.10.0

func (g *CayleyGraph) ReadInEdges(node Node, predicates ...string) ([]*Edge, error)

ReadInEdges implements the GraphDatabase interface.

func (*CayleyGraph) ReadNode added in v3.10.0

func (g *CayleyGraph) ReadNode(id, ntype string) (Node, error)

ReadNode implements the GraphDatabase interface.

func (*CayleyGraph) ReadOutEdges added in v3.10.0

func (g *CayleyGraph) ReadOutEdges(node Node, predicates ...string) ([]*Edge, error)

ReadOutEdges implements the GraphDatabase interface.

func (*CayleyGraph) ReadProperties added in v3.10.0

func (g *CayleyGraph) ReadProperties(node Node, predicates ...string) ([]*Property, error)

ReadProperties implements the GraphDatabase interface.

func (*CayleyGraph) String added in v3.10.0

func (g *CayleyGraph) String() string

String returns a description for the CayleyGraph object.

func (*CayleyGraph) WriteNodeQuads added in v3.10.0

func (g *CayleyGraph) WriteNodeQuads(cg *CayleyGraph, nodes []Node) error

WriteNodeQuads replicates nodes from the cg parameter to the receiver CayleyGraph.

type Edge added in v3.10.0

type Edge struct {
	Predicate string
	From, To  Node
}

Edge represents an edge in the graph.

type Graph

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

Graph implements the Amass network infrastructure data model.

func NewGraph

func NewGraph(database *CayleyGraph) *Graph

NewGraph accepts a graph database that stores the Graph created and maintained by the data model.

func (*Graph) ASNCacheFill added in v3.9.0

func (g *Graph) ASNCacheFill(cache *requests.ASNCache) error

ASNCacheFill populates an ASNCache object with the AS data in the receiver object.

func (*Graph) AddNodeToEvent added in v3.3.0

func (g *Graph) AddNodeToEvent(node Node, source, tag, eventID string) error

AddNodeToEvent creates associations between a node in the graph, a data source and a discovery task.

func (*Graph) AllNodesOfType added in v3.6.0

func (g *Graph) AllNodesOfType(ntype string, events ...string) ([]Node, error)

AllNodesOfType provides all nodes in the graph of the identified type within the optionally identified events.

func (*Graph) CacheSourceData added in v3.8.0

func (g *Graph) CacheSourceData(source, tag, query, resp string) error

CacheSourceData inserts an updated response from the source/tag for the query.

func (*Graph) Close

func (g *Graph) Close()

Close will close the graph database being used by the Graph receiver.

func (*Graph) DumpGraph added in v3.3.0

func (g *Graph) DumpGraph() string

DumpGraph prints all data currently in the graph.

func (*Graph) EventDateRange added in v3.3.0

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

EventDateRange returns the date range associated with the provided event UUID.

func (*Graph) EventDomains added in v3.3.0

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

EventDomains returns the domains that were involved in the event.

func (*Graph) EventFQDNs added in v3.5.0

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

EventFQDNs returns the domains that were involved in the event.

func (*Graph) EventList added in v3.3.0

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

EventList returns a list of event UUIDs found in the graph.

func (*Graph) EventNames added in v3.6.0

func (g *Graph) EventNames(uuid string, filter stringfilter.Filter) []*requests.Output

EventNames returns findings within the receiver Graph for the event identified by the uuid string parameter and not already in the filter StringFilter argument. The filter is updated by EventNames.

func (*Graph) EventOutput added in v3.5.1

func (g *Graph) EventOutput(uuid string, filter stringfilter.Filter, asninfo bool, cache *requests.ASNCache) []*requests.Output

EventOutput returns findings within the receiver Graph for the event identified by the uuid string parameter and not already in the filter StringFilter argument. The filter is updated by EventOutput.

func (*Graph) EventSubdomains added in v3.4.2

func (g *Graph) EventSubdomains(events ...string) []string

EventSubdomains returns the subdomains discovered during the event(s).

func (*Graph) EventsInScope added in v3.10.0

func (g *Graph) EventsInScope(d ...string) []string

EventsInScope returns the events that include all of the domain arguments.

func (*Graph) GetSourceData added in v3.8.0

func (g *Graph) GetSourceData(source, query string, ttl int) (string, error)

GetSourceData returns the most recent response from the source/tag for the query within the time to live.

func (*Graph) HealAddressNodes added in v3.6.0

func (g *Graph) HealAddressNodes(cache *requests.ASNCache, uuid string) error

HealAddressNodes looks for 'ipaddr' nodes in the graph and creates missing edges to the appropriate 'netblock' nodes using data provided by the ASNCache parameter.

func (*Graph) InEventScope added in v3.6.0

func (g *Graph) InEventScope(node Node, uuid string, predicates ...string) bool

InEventScope checks if the Node parameter is within scope of the Event identified by the uuid parameter.

func (*Graph) InsertA added in v3.3.0

func (g *Graph) InsertA(fqdn, addr, source, tag, eventID string) error

InsertA creates FQDN, IP address and A record edge in the graph and associates them with a source and event.

func (*Graph) InsertAAAA added in v3.3.0

func (g *Graph) InsertAAAA(fqdn, addr, source, tag, eventID string) error

InsertAAAA creates FQDN, IP address and AAAA record edge in the graph and associates them with a source and event.

func (*Graph) InsertAS added in v3.3.0

func (g *Graph) InsertAS(asn, desc, source, tag, eventID string) (Node, error)

InsertAS adds/updates an autonomous system in the graph.

func (*Graph) InsertAddress added in v3.3.0

func (g *Graph) InsertAddress(addr, source, tag, eventID string) (Node, error)

InsertAddress creates an IP address in the graph and associates it with a source and event.

func (*Graph) InsertCNAME added in v3.3.0

func (g *Graph) InsertCNAME(fqdn, target, source, tag, eventID string) error

InsertCNAME adds the FQDNs and CNAME record between them to the graph.

func (*Graph) InsertEdge added in v3.3.0

func (g *Graph) InsertEdge(edge *Edge) error

InsertEdge will create an edge in the database if it does not already exist.

func (*Graph) InsertEvent added in v3.3.0

func (g *Graph) InsertEvent(eventID string) (Node, error)

InsertEvent create an event node in the graph that represents a discovery task.

func (*Graph) InsertFQDN added in v3.3.0

func (g *Graph) InsertFQDN(name, source, tag, eventID string) (Node, error)

InsertFQDN adds a fully qualified domain name to the graph.

func (*Graph) InsertInfrastructure added in v3.3.0

func (g *Graph) InsertInfrastructure(asn int, desc, addr, cidr, source, tag, eventID string) error

InsertInfrastructure adds/updates an associated IP address, netblock and autonomous system in the graph.

func (*Graph) InsertMX added in v3.3.0

func (g *Graph) InsertMX(fqdn, target, source, tag, eventID string) error

InsertMX adds the FQDNs and MX record between them to the graph.

func (*Graph) InsertNS added in v3.3.0

func (g *Graph) InsertNS(fqdn, target, source, tag, eventID string) error

InsertNS adds the FQDNs and NS record between them to the graph.

func (*Graph) InsertNetblock added in v3.3.0

func (g *Graph) InsertNetblock(cidr, source, tag, eventID string) (Node, error)

InsertNetblock adds a netblock/CIDR to the graph.

func (*Graph) InsertNodeIfNotExist added in v3.3.0

func (g *Graph) InsertNodeIfNotExist(id, ntype string) (Node, error)

InsertNodeIfNotExist will create a node in the database if it does not already exist.

func (*Graph) InsertPTR added in v3.3.0

func (g *Graph) InsertPTR(fqdn, target, source, tag, eventID string) error

InsertPTR adds the FQDNs and PTR record between them to the graph.

func (*Graph) InsertSRV added in v3.3.0

func (g *Graph) InsertSRV(fqdn, service, target, source, tag, eventID string) error

InsertSRV adds the FQDNs and SRV record between them to the graph.

func (*Graph) InsertSource added in v3.3.0

func (g *Graph) InsertSource(source, tag string) (Node, error)

InsertSource creates a data source node in the graph.

func (*Graph) IsCNAMENode

func (g *Graph) IsCNAMENode(fqdn string) bool

IsCNAMENode returns true if the FQDN has a CNAME edge to another FQDN in the graph.

func (*Graph) IsMXNode added in v3.3.0

func (g *Graph) IsMXNode(fqdn string) bool

IsMXNode returns true if the FQDN has a MX edge pointing to it in the graph.

func (*Graph) IsNSNode added in v3.3.0

func (g *Graph) IsNSNode(fqdn string) bool

IsNSNode returns true if the FQDN has a NS edge pointing to it in the graph.

func (*Graph) IsPTRNode added in v3.3.0

func (g *Graph) IsPTRNode(fqdn string) bool

IsPTRNode returns true if the FQDN has a PTR edge to another FQDN in the graph.

func (*Graph) IsRootDomainNode added in v3.3.0

func (g *Graph) IsRootDomainNode(fqdn string) bool

IsRootDomainNode returns true if the FQDN has a 'root' edge pointing to it in the graph.

func (*Graph) IsTLDNode added in v3.3.0

func (g *Graph) IsTLDNode(fqdn string) bool

IsTLDNode returns true if the FQDN has a 'tld' edge pointing to it in the graph.

func (*Graph) MigrateEvents added in v3.10.0

func (g *Graph) MigrateEvents(to *Graph, uuids ...string) error

MigrateEvents copies the nodes and edges related to the Events identified by the uuids from the receiver Graph into another.

func (*Graph) MigrateEventsInScope added in v3.10.0

func (g *Graph) MigrateEventsInScope(to *Graph, d []string) error

MigrateEventsInScope copies the nodes and edges related to the Events identified by the uuids from the receiver Graph into another.

func (*Graph) NamesToAddrs added in v3.10.4

func (g *Graph) NamesToAddrs(uuid string, names ...string) ([]*NameAddrPair, error)

NamesToAddrs returns a NameAddrPair for each name / address combination discovered in the graph.

func (*Graph) NodeSources added in v3.6.0

func (g *Graph) NodeSources(node Node, events ...string) ([]string, error)

NodeSources returns the names of data sources that identified the Node parameter during the events.

func (*Graph) ReadASDescription added in v3.3.0

func (g *Graph) ReadASDescription(asn string) string

ReadASDescription the description property of an autonomous system in the graph.

func (*Graph) ReadNode added in v3.10.0

func (g *Graph) ReadNode(id, ntype string) (Node, error)

ReadNode returns the node matching the id and type arguments.

func (*Graph) SourceTag added in v3.3.0

func (g *Graph) SourceTag(source string) string

SourceTag returns the tag associated with the identified data source.

func (*Graph) String

func (g *Graph) String() string

String returns the name of the graph database used by the Graph.

func (*Graph) VizData

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

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

type NameAddrPair added in v3.10.4

type NameAddrPair struct {
	Name string
	Addr string
}

NameAddrPair represents a relationship between a DNS name and an IP address it eventually resolves to.

type Node added in v3.10.0

type Node interface{}

Node represents a node in the graph.

type Property added in v3.10.0

type Property struct {
	Predicate string
	Value     string
}

Property represents a node property.

Jump to

Keyboard shortcuts

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