Documentation
¶
Index ¶
- Constants
- type CayleyGraph
- type Edge
- type Graph
- func (g *Graph) AddNodeToEvent(ctx context.Context, node Node, source, eventID string) error
- func (g *Graph) AllNodesOfType(ctx context.Context, ntype string, uuids ...string) ([]Node, error)
- func (g *Graph) AllOutNodes(ctx context.Context, node Node) ([]Node, error)
- func (g *Graph) CacheSourceData(ctx context.Context, source, query, resp string) error
- func (g *Graph) Close()
- func (g *Graph) CountEdges(ctx context.Context, node Node, predicates ...string) (int, error)
- func (g *Graph) CountInEdges(ctx context.Context, node Node, predicates ...string) (int, error)
- func (g *Graph) CountOutEdges(ctx context.Context, node Node, predicates ...string) (int, error)
- func (g *Graph) CountProperties(ctx context.Context, node Node, predicates ...string) (int, error)
- func (g *Graph) DeleteEdge(ctx context.Context, edge *Edge) error
- func (g *Graph) DeleteNode(ctx context.Context, node Node) error
- func (g *Graph) DeleteProperty(ctx context.Context, node Node, predicate string, value interface{}) error
- func (g *Graph) DumpGraph(ctx context.Context) string
- func (g *Graph) EventDateRange(ctx context.Context, uuid string) (time.Time, time.Time)
- func (g *Graph) EventDomains(ctx context.Context, uuid string) []string
- func (g *Graph) EventFQDNs(ctx context.Context, uuid string) []string
- func (g *Graph) EventList(ctx context.Context) []string
- func (g *Graph) EventSubdomains(ctx context.Context, events ...string) []string
- func (g *Graph) EventsInScope(ctx context.Context, d ...string) []string
- func (g *Graph) GetSourceData(ctx context.Context, source, query string, ttl int) (string, error)
- func (g *Graph) InEventScope(ctx context.Context, node Node, uuid string, predicates ...string) bool
- func (g *Graph) IsCNAMENode(ctx context.Context, fqdn string) bool
- func (g *Graph) IsMXNode(ctx context.Context, fqdn string) bool
- func (g *Graph) IsNSNode(ctx context.Context, fqdn string) bool
- func (g *Graph) IsPTRNode(ctx context.Context, fqdn string) bool
- func (g *Graph) IsRootDomainNode(ctx context.Context, fqdn string) bool
- func (g *Graph) IsTLDNode(ctx context.Context, fqdn string) bool
- func (g *Graph) Migrate(ctx context.Context, to *Graph) error
- func (g *Graph) MigrateEvents(ctx context.Context, to *Graph, uuids ...string) error
- func (g *Graph) MigrateEventsInScope(ctx context.Context, to *Graph, d []string) error
- func (g *Graph) NamesToAddrs(ctx context.Context, uuid string, names ...string) ([]*NameAddrPair, error)
- func (g *Graph) NodeSources(ctx context.Context, node Node, events ...string) ([]string, error)
- func (g *Graph) NodeToID(n Node) string
- func (g *Graph) ReadASDescription(ctx context.Context, asn int) string
- func (g *Graph) ReadASPrefixes(ctx context.Context, asn int) []string
- func (g *Graph) ReadEdges(ctx context.Context, node Node, predicates ...string) ([]*Edge, error)
- func (g *Graph) ReadEventQuads(ctx context.Context, uuids ...string) ([]quad.Quad, error)
- func (g *Graph) ReadInEdges(ctx context.Context, node Node, predicates ...string) ([]*Edge, error)
- func (g *Graph) ReadNode(ctx context.Context, id, ntype string) (Node, error)
- func (g *Graph) ReadOutEdges(ctx context.Context, node Node, predicates ...string) ([]*Edge, error)
- func (g *Graph) ReadProperties(ctx context.Context, node Node, predicates ...string) ([]*Property, error)
- func (g *Graph) String() string
- func (g *Graph) UpsertA(ctx context.Context, fqdn, addr, source, eventID string) error
- func (g *Graph) UpsertAAAA(ctx context.Context, fqdn, addr, source, eventID string) error
- func (g *Graph) UpsertAS(ctx context.Context, asn, desc, source, eventID string) (Node, error)
- func (g *Graph) UpsertAddress(ctx context.Context, addr, source, eventID string) (Node, error)
- func (g *Graph) UpsertCNAME(ctx context.Context, fqdn, target, source, eventID string) error
- func (g *Graph) UpsertEdge(ctx context.Context, edge *Edge) error
- func (g *Graph) UpsertEvent(ctx context.Context, eventID string) (Node, error)
- func (g *Graph) UpsertFQDN(ctx context.Context, name, source, eventID string) (Node, error)
- func (g *Graph) UpsertInfrastructure(ctx context.Context, asn int, desc, addr, cidr, source, eventID string) error
- func (g *Graph) UpsertMX(ctx context.Context, fqdn, target, source, eventID string) error
- func (g *Graph) UpsertNS(ctx context.Context, fqdn, target, source, eventID string) error
- func (g *Graph) UpsertNetblock(ctx context.Context, cidr, source, eventID string) (Node, error)
- func (g *Graph) UpsertNode(ctx context.Context, id, ntype string) (Node, error)
- func (g *Graph) UpsertPTR(ctx context.Context, fqdn, target, source, eventID string) error
- func (g *Graph) UpsertProperty(ctx context.Context, node Node, predicate, value string) error
- func (g *Graph) UpsertSRV(ctx context.Context, fqdn, service, target, source, eventID string) error
- func (g *Graph) UpsertSource(ctx context.Context, source string) (Node, error)
- func (g *Graph) WriteNodeQuads(ctx context.Context, cg *Graph, nodes []Node) error
- type NameAddrPair
- type Node
- type Property
Constants ¶
const ( IN int = iota OUT BOTH )
Constant values that represent the direction of edges during graph queries.
const TypeAS string = "as"
TypeAS is the type for an autonomous system in the graph database.
const TypeAddr string = "ipaddr"
const TypeEvent string = "event"
TypeEvent is the type that represents an event over a range of time that extended the graph.
const TypeFQDN string = "fqdn"
const TypeNetblock string = "netblock"
const TypeSource string = "source"
TypeSource is the type representing a data source that has contributed findings to the graph.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CayleyGraph ¶
CayleyGraph is the object for managing a network infrastructure link graph.
func NewCayleyGraph ¶
func NewCayleyGraph(system, path string, options string) *CayleyGraph
NewCayleyGraph returns an intialized CayleyGraph object.
func NewCayleyGraphMemory ¶
func NewCayleyGraphMemory() *CayleyGraph
NewCayleyGraphMemory creates a temporary graph in memory.
func (*CayleyGraph) Close ¶
func (g *CayleyGraph) Close()
Close implements the GraphDatabase interface.
func (*CayleyGraph) DumpGraph ¶
func (g *CayleyGraph) DumpGraph(ctx context.Context) string
DumpGraph prints all data currently in the graph.
func (*CayleyGraph) String ¶
func (g *CayleyGraph) String() string
String returns a description for the CayleyGraph object.
type Graph ¶
type Graph struct {
// contains filtered or unexported fields
}
Graph implements the 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) AddNodeToEvent ¶
AddNodeToEvent creates associations between a node in the graph, a data source and a discovery task.
func (*Graph) AllNodesOfType ¶
AllNodesOfType provides all nodes in the graph of the identified type within the optionally identified events.
func (*Graph) AllOutNodes ¶
AllOutNodes returns all the nodes that the parameter node has out edges to.
func (*Graph) CacheSourceData ¶
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) CountEdges ¶
CountEdges counts the total number of edges to a node.
func (*Graph) CountInEdges ¶
CountInEdges implements the GraphDatabase interface.
func (*Graph) CountOutEdges ¶
CountOutEdges implements the GraphDatabase interface.
func (*Graph) CountProperties ¶
CountProperties implements the GraphDatabase interface.
func (*Graph) DeleteEdge ¶
DeleteEdge implements the GraphDatabase interface.
func (*Graph) DeleteNode ¶
DeleteNode implements the GraphDatabase interface.
func (*Graph) DeleteProperty ¶
func (g *Graph) DeleteProperty(ctx context.Context, node Node, predicate string, value interface{}) error
DeleteProperty implements the GraphDatabase interface.
func (*Graph) EventDateRange ¶
EventDateRange returns the date range associated with the provided event UUID.
func (*Graph) EventDomains ¶
EventDomains returns the domains that were involved in the event.
func (*Graph) EventFQDNs ¶
EventFQDNs returns the domains that were involved in the event.
func (*Graph) EventSubdomains ¶
EventSubdomains returns the subdomains discovered during the event(s).
func (*Graph) EventsInScope ¶
EventsInScope returns the events that include all of the domain arguments.
func (*Graph) GetSourceData ¶
GetSourceData returns the most recent response from the source/tag for the query within the time to live.
func (*Graph) InEventScope ¶
func (g *Graph) InEventScope(ctx context.Context, 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) IsCNAMENode ¶
IsCNAMENode returns true if the FQDN has a CNAME edge to another FQDN in the graph.
func (*Graph) IsMXNode ¶
IsMXNode returns true if the FQDN has a MX edge pointing to it in the graph.
func (*Graph) IsNSNode ¶
IsNSNode returns true if the FQDN has a NS edge pointing to it in the graph.
func (*Graph) IsPTRNode ¶
IsPTRNode returns true if the FQDN has a PTR edge to another FQDN in the graph.
func (*Graph) IsRootDomainNode ¶
IsRootDomainNode returns true if the FQDN has a 'root' edge pointing to it in the graph.
func (*Graph) IsTLDNode ¶
IsTLDNode returns true if the FQDN has a 'tld' edge pointing to it in the graph.
func (*Graph) MigrateEvents ¶
MigrateEvents copies the nodes and edges related to the Events identified by the uuids from the receiver Graph into another.
func (*Graph) MigrateEventsInScope ¶
MigrateEventsInScope copies the nodes and edges related to the Events identified by the uuids from the receiver Graph into another.
func (*Graph) NamesToAddrs ¶
func (g *Graph) NamesToAddrs(ctx context.Context, uuid string, names ...string) ([]*NameAddrPair, error)
NamesToAddrs returns a NameAddrPair for each name / address combination discovered in the graph.
func (*Graph) NodeSources ¶
NodeSources returns the names of data sources that identified the Node parameter during the events.
func (*Graph) ReadASDescription ¶
ReadASDescription the description property of an autonomous system in the graph.
func (*Graph) ReadASPrefixes ¶
func (*Graph) ReadEventQuads ¶
ReadEventQuads returns all graph database quads associated with the provided events.
func (*Graph) ReadInEdges ¶
ReadInEdges implements the GraphDatabase interface.
func (*Graph) ReadOutEdges ¶
ReadOutEdges implements the GraphDatabase interface.
func (*Graph) ReadProperties ¶
func (g *Graph) ReadProperties(ctx context.Context, node Node, predicates ...string) ([]*Property, error)
ReadProperties implements the GraphDatabase interface.
func (*Graph) UpsertA ¶
UpsertA creates FQDN, IP address and A record edge in the graph and associates them with a source and event.
func (*Graph) UpsertAAAA ¶
UpsertAAAA creates FQDN, IP address and AAAA record edge in the graph and associates them with a source and event.
func (*Graph) UpsertAddress ¶
UpsertAddress creates an IP address in the graph and associates it with a source and event.
func (*Graph) UpsertCNAME ¶
UpsertCNAME adds the FQDNs and CNAME record between them to the graph.
func (*Graph) UpsertEdge ¶
UpsertEdge will create an edge in the database if it does not already exist.
func (*Graph) UpsertEvent ¶
UpsertEvent create an event node in the graph that represents a discovery task.
func (*Graph) UpsertFQDN ¶
UpsertFQDN adds a fully qualified domain name to the graph.
func (*Graph) UpsertInfrastructure ¶
func (g *Graph) UpsertInfrastructure(ctx context.Context, asn int, desc, addr, cidr, source, eventID string) error
UpsertInfrastructure adds/updates an associated IP address, netblock and autonomous system in the graph.
func (*Graph) UpsertNetblock ¶
UpsertNetblock adds a netblock/CIDR to the graph.
func (*Graph) UpsertNode ¶
UpsertNode will create a node in the database.
func (*Graph) UpsertProperty ¶
UpsertProperty implements the GraphDatabase interface.
func (*Graph) UpsertSource ¶
UpsertSource creates a data source node in the graph.
type NameAddrPair ¶
NameAddrPair represents a relationship between a DNS name and an IP address it eventually resolves to.