Documentation
¶
Overview ¶
Package resolvers implements primitives to resolve various identifiers against external data
Index ¶
- Variables
- func GetJA4DBSize() int
- func GetJA4HDBSize() int
- func GetJA4SDBSize() int
- func GetJA4TDBSize() int
- func GetJA4TSDBSize() int
- func GetJA4TScanDBSize() int
- func GetJA4XDBSize() int
- func Init(c Config, quietMode bool)
- func InitDHCPFingerprintAPIKey()
- func InitDHCPFingerprintDB()
- func InitDNSWhitelist()
- func InitLocalDNS()
- func InitServiceDB()
- func IsPrivateIP(ip net.IP) bool
- func IsWhitelistedDomain(domain string) bool
- func LookupDHCPFingerprint(fp, vendor string, userAgents []string) (*dhcpResult, error)
- func LookupDHCPFingerprintLocal(fp string) string
- func LookupDNSNameLocal(ip string) string
- func LookupDNSNames(ip string) []string
- func LookupGeolocation(addr string) (string, string)
- func LookupJA4(fingerprint string) string
- func LookupJA4H(fingerprint string) string
- func LookupJA4S(fingerprint string) string
- func LookupJA4T(fingerprint string) string
- func LookupJA4TS(fingerprint string) string
- func LookupJA4TScan(fingerprint string) string
- func LookupJA4X(fingerprint string) string
- func LookupManufacturer(mac string) string
- func LookupServiceByPort(port int, protocol string) string
- func SaveFingerprintDB()
- func SetLogger(lg *zap.Logger)
- func SetPerfTracker(pt *performance.Tracker)
- type Config
- type JA4Entry
- func LookupJA4Entry(fingerprint string) *JA4Entry
- func LookupJA4HEntry(fingerprint string) *JA4Entry
- func LookupJA4SEntry(fingerprint string) *JA4Entry
- func LookupJA4TEntry(fingerprint string) *JA4Entry
- func LookupJA4TSEntry(fingerprint string) *JA4Entry
- func LookupJA4TScanEntry(fingerprint string) *JA4Entry
- func LookupJA4XEntry(fingerprint string) *JA4Entry
Constants ¶
This section is empty.
Variables ¶
var ( // CurrentConfig holds the current configuration. CurrentConfig Config // ConfigRootPath points to the path for storing the netcap configuration and databases. // usually: /usr/local/etc/netcap ConfigRootPath string // DataBaseFolderPath points to the 'dbs' folder for storing the netcap databases. // usually: /usr/local/etc/netcap/dbs DataBaseFolderPath string // DataBaseBuildPath points to the build folder for db generation artifacts, // that are not tracked in version control. // usually: /usr/local/etc/netcap/build DataBaseBuildPath string )
var DefaultConfig = Config{ ReverseDNS: false, LocalDNS: false, MACDB: true, ServiceDB: true, GeolocationDB: true, DHCPDB: true, JA4DB: true, }
DefaultConfig is an example configuration.
Functions ¶
func GetJA4DBSize ¶ added in v0.9.0
func GetJA4DBSize() int
GetJA4DBSize returns the number of entries in the JA4 database
func GetJA4HDBSize ¶ added in v0.9.0
func GetJA4HDBSize() int
GetJA4HDBSize returns the number of entries in the JA4H database
func GetJA4SDBSize ¶ added in v0.9.0
func GetJA4SDBSize() int
GetJA4SDBSize returns the number of entries in the JA4S database
func GetJA4TDBSize ¶ added in v0.9.0
func GetJA4TDBSize() int
GetJA4TDBSize returns the number of entries in the JA4T database
func GetJA4TSDBSize ¶ added in v0.9.0
func GetJA4TSDBSize() int
GetJA4TSDBSize returns the number of entries in the JA4TS database
func GetJA4TScanDBSize ¶ added in v0.9.0
func GetJA4TScanDBSize() int
GetJA4TScanDBSize returns the number of entries in the JA4TScan database
func GetJA4XDBSize ¶ added in v0.9.0
func GetJA4XDBSize() int
GetJA4XDBSize returns the number of entries in the JA4X database
func Init ¶
Init can be used to initialize the resolvers package according to the provided configuration.
func InitDHCPFingerprintAPIKey ¶
func InitDHCPFingerprintAPIKey()
InitDHCPFingerprintAPIKey initializes the DHCP fingerprinting API key
func InitDHCPFingerprintDB ¶
func InitDHCPFingerprintDB()
InitDHCPFingerprintDB initializes the DHCP fingerprint database from the JSON encoded mapping persisted on disk.
func InitLocalDNS ¶
func InitLocalDNS()
InitLocalDNS initializes reverse dns resolution via local hosts mapping.
func InitServiceDB ¶
func InitServiceDB()
InitServiceDB initializes the ports to service names mapping. TODO: include service names for other transport protocols
func IsPrivateIP ¶
IsPrivateIP can be used whether an address belongs to private address space.
func IsWhitelistedDomain ¶
IsWhitelistedDomain checks whether a given domain is whitelisted must be called after calling InitDNSWhitelist().
func LookupDHCPFingerprint ¶
LookupDHCPFingerprint retrieves the data associated with an DHCP fingerprint.
func LookupDHCPFingerprintLocal ¶ added in v0.9.0
LookupDHCPFingerprintLocal retrieves the data associated with an DHCP fingerprint from the local database.
func LookupDNSNameLocal ¶
LookupDNSNameLocal retrieves the DNS names associated with an IP addr.
func LookupDNSNames ¶
LookupDNSNames retrieves the DNS names associated with an IP address.
func LookupGeolocation ¶
LookupGeolocation returns all associated geolocations for a given address and db handle results are being cached in an atomic map to avoid unnecessary lookups.
func LookupJA4H ¶ added in v0.9.0
LookupJA4H looks up a JA4H fingerprint in the database
func LookupJA4S ¶ added in v0.9.0
LookupJA4S looks up a JA4S fingerprint in the database
func LookupJA4T ¶ added in v0.9.0
LookupJA4T looks up a JA4T fingerprint in the database
func LookupJA4TS ¶ added in v0.9.0
LookupJA4TS looks up a JA4TS fingerprint in the database
func LookupJA4TScan ¶ added in v0.9.0
LookupJA4TScan looks up a JA4TScan fingerprint in the database
func LookupJA4X ¶ added in v0.9.0
LookupJA4X looks up a JA4X fingerprint in the database
func LookupManufacturer ¶
LookupManufacturer resolves a MAC addr to the manufacturer. It first checks the optional JSON database, then falls back to gopacket's built-in data.
func LookupServiceByPort ¶
LookupServiceByPort looks up the service name associated with a given port and protocol.
func SaveFingerprintDB ¶
func SaveFingerprintDB()
SaveFingerprintDB will persist the fingerprint database on disk. TODO: use a boltDB?
func SetPerfTracker ¶ added in v0.7.6
func SetPerfTracker(pt *performance.Tracker)
SetPerfTracker sets the performance tracker for resolver operations
Types ¶
type Config ¶
type Config struct {
// Controls whether ip addresses are resolved through the default OS resolver
ReverseDNS bool
// Controls if ip addresses are resolved locally through a provided hosts mapping
LocalDNS bool
// Enables MAC address vendor lookups
MACDB bool
// Enables resolving port numbers to service names
ServiceDB bool
// Enables ip to geolocation lookups via MaxMind GeoLite
GeolocationDB bool
// Enables DHCP fingerprint lookups
DHCPDB bool
// Enables JA4+ fingerprint lookups
JA4DB bool
}
Config contains settings for the resolvers package.
type JA4Entry ¶ added in v0.9.0
type JA4Entry struct {
Application string `json:"application"`
Library string `json:"library"`
Device string `json:"device"`
OS string `json:"os"`
UserAgentString string `json:"user_agent_string"`
CertificateAuthority string `json:"certificate_authority"`
ObservationCount int `json:"observation_count"`
Verified bool `json:"verified"`
Notes string `json:"notes"`
JA4Fingerprint string `json:"ja4_fingerprint"`
JA4FingerprintString string `json:"ja4_fingerprint_string"`
JA4SFingerprint string `json:"ja4s_fingerprint"`
JA4HFingerprint string `json:"ja4h_fingerprint"`
JA4XFingerprint string `json:"ja4x_fingerprint"`
JA4TFingerprint string `json:"ja4t_fingerprint"`
JA4TSFingerprint string `json:"ja4ts_fingerprint"`
JA4TScanFingerprint string `json:"ja4tscan_fingerprint"`
}
JA4Entry represents a single entry from the JA4+ database
func LookupJA4Entry ¶ added in v0.9.0
LookupJA4Entry looks up a JA4 fingerprint and returns the full entry
func LookupJA4HEntry ¶ added in v0.9.0
LookupJA4HEntry looks up a JA4H fingerprint and returns the full entry
func LookupJA4SEntry ¶ added in v0.9.0
LookupJA4SEntry looks up a JA4S fingerprint and returns the full entry
func LookupJA4TEntry ¶ added in v0.9.0
LookupJA4TEntry looks up a JA4T fingerprint and returns the full entry
func LookupJA4TSEntry ¶ added in v0.9.0
LookupJA4TSEntry looks up a JA4TS fingerprint and returns the full entry
func LookupJA4TScanEntry ¶ added in v0.9.0
LookupJA4TScanEntry looks up a JA4TScan fingerprint and returns the full entry
func LookupJA4XEntry ¶ added in v0.9.0
LookupJA4XEntry looks up a JA4X fingerprint and returns the full entry
func (*JA4Entry) GetDescription ¶ added in v0.9.0
GetDescription returns a human-readable description for the entry