graph

package
v0.0.0-...-465bddc Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: GPL-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package graph implements the graph data structures used by certgraph to build the certificate graph

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CertGraph

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

CertGraph main graph storage engine

func NewCertGraph

func NewCertGraph() *CertGraph

NewCertGraph instantiates a new empty CertGraph

func (*CertGraph) AddCert

func (graph *CertGraph) AddCert(certNode *CertNode)

AddCert add a CertNode to the graph

func (*CertGraph) AddDomain

func (graph *CertGraph) AddDomain(domainNode *DomainNode)

AddDomain add a DomainNode to the graph

func (*CertGraph) DomainDepth

func (graph *CertGraph) DomainDepth() uint

DomainDepth returns the maximum depth of the graph from the initial root domains

func (*CertGraph) GenerateMap

func (graph *CertGraph) GenerateMap() map[string]interface{}

GenerateMap returns a map representation of the certificate graph used for JSON serialization

func (*CertGraph) GetCert

func (graph *CertGraph) GetCert(fp fingerprint.Fingerprint) (*CertNode, bool)

GetCert returns (CertNode, found) for the certificate with the provided Fingerprint in the graph if found

func (*CertGraph) GetDomain

func (graph *CertGraph) GetDomain(domain string) (*DomainNode, bool)

GetDomain returns (DomainNode, found) for the domain in the graph if found

func (*CertGraph) GetDomainNeighbors

func (graph *CertGraph) GetDomainNeighbors(domain string, cdn bool, maxSANsSize int) []string

GetDomainNeighbors given a domain, return the list of all other domains that share a certificate with the provided domain that are in the graph cdn will include CDN certs as well

func (*CertGraph) NumDomains

func (graph *CertGraph) NumDomains() int

NumDomains returns the number of domains in the graph

type CertNode

type CertNode struct {
	Fingerprint fingerprint.Fingerprint
	Domains     []string
	// contains filtered or unexported fields
}

CertNode graph node to store certificate information

func (*CertNode) AddFound

func (c *CertNode) AddFound(driver string)

AddFound adds a driver name to the source of the certificate

func (*CertNode) ApexCount

func (c *CertNode) ApexCount() int

ApexCount the number of tld+1 domains in the certificate

func (*CertNode) CDNCert

func (c *CertNode) CDNCert() bool

CDNCert returns true if we think the certificate belongs to a CDN very weak detection, only supports fastly & cloudflare

func (*CertNode) Found

func (c *CertNode) Found() []string

Found returns a list of drivers that found this cert

func (*CertNode) String

func (c *CertNode) String() string

func (*CertNode) ToMap

func (c *CertNode) ToMap() map[string]string

ToMap returns a map of the CertNode's fields (weak serialization)

type DomainNode

type DomainNode struct {
	Domain         string
	Depth          uint
	Certs          map[fingerprint.Fingerprint][]string
	RelatedDomains status.Map
	Status         status.Status
	Root           bool
	HasDNS         bool
}

DomainNode structure to store a domain and its edges

func NewDomainNode

func NewDomainNode(domain string, depth uint) *DomainNode

NewDomainNode constructor for DomainNode, converts domain to lower nonWildcard

func (*DomainNode) AddCertFingerprint

func (d *DomainNode) AddCertFingerprint(fp fingerprint.Fingerprint, certSource string)

AddCertFingerprint appends a Fingerprint to the DomainNode's list of certificates

func (*DomainNode) AddRelatedDomains

func (d *DomainNode) AddRelatedDomains(domains []string)

AddRelatedDomains adds the domains in the provided array to the domainNode's related domains status map with an unknown status if they are not already in the map

func (*DomainNode) AddStatusMap

func (d *DomainNode) AddStatusMap(m status.Map)

AddStatusMap adds the status' in the map to the DomainNode also sets the Node's own status if it is in the Map side effect: will delete its own status from the provided map

func (*DomainNode) CheckForDNS

func (d *DomainNode) CheckForDNS(timeout time.Duration) (bool, error)

CheckForDNS checks for the existence of DNS records for the domain's apex sets the value to the node and returns the result as well

func (*DomainNode) GetCertificates

func (d *DomainNode) GetCertificates() []fingerprint.Fingerprint

GetCertificates returns a list of known certificate fingerprints for the domain

func (*DomainNode) String

func (d *DomainNode) String() string

String returns the string representation of a node

func (*DomainNode) ToMap

func (d *DomainNode) ToMap() map[string]string

ToMap returns a map of the DomainNode's fields (weak serialization)

Jump to

Keyboard shortcuts

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