Fingerprint¶
A Fingerprint object holds the fingerprints as generated by FlowPrint. These fingerprints are sets of (dst ip, dst port)-tuples and TLS certificates. Essentially, it extends the frozenset (i.e., an unchangable set) class with methods useful for comparing, identifying, reading and storing fingerprints.
-
class
fingerprint.
Fingerprint
¶ FlowPrint fingerprint: a frozenset of NetworkDestinations.
-
destinations
¶ (IP, port) destination tuples in fingerprint
Note
Only as getter, cannot be set
Type: list
-
certificates
¶ Certificates in fingerprint
Note
Only as getter, cannot be set
Type: list
-
n_flows
¶ Threshold for the window size in seconds
Type: int
-
-
static
Fingerprint.
__new__
(cls, *args)¶ FlowPrint fingerprint: a frozenset of NetworkDestinations.
Fingerprint comparison¶
To compare fingerprints using the Jaccard distance as given in the paper we provide the fingerprint.Fingerprint.compare()
method.
-
Fingerprint.
compare
(other)¶ Compare fingerprint with other fingerprint
Parameters: other (Fingerprint) – Fingerprint to compare with Returns: result – Jaccard similarity between self and other Return type: float
Fingerprint merging¶
To merge multiple fingerprints together we provide the fingerprint.Fingerprint.merge()
method
-
Fingerprint.
merge
(*other)¶ Merge fingerprint with other fingerprint(s)
Parameters: *other (Fingerprint) – One or more fingerprints to merge with given Fingerprint Returns: result – Merged fingerprint Return type: Fingerprint
I/O methods¶
Fingerprints themselves are unchangable, however we can modify them by casting them to and from dictionaries using the following methods.
-
Fingerprint.
to_dict
()¶ Return fingerprint as dictionary object
Returns: result – Fingerprint as dictionary, may be used for JSON export Return type: dict
-
Fingerprint.
from_dict
(dictionary)¶ Load fingerprint from dictionary object
Parameters: dictionary (dict) – - Dictionary containing fingerprint object
- ’certificates’ -> list of certificates ‘destinations’ -> list of destinations ‘n_flows’ -> int specifying #flows in fingerprint.
Returns: result – Fingerprint object as read from dictionary Return type: Fingerprint