Types¶
Indicator types, sightings, and extraction results.
Results are pydantic models. :class:IOCType is the type you pass and the
type you get back.
Classes:
-
IOCType–Supported indicator types.
-
Sighting–One place an indicator was observed.
-
Enrichment–Local facts derived from an indicator. No network calls.
-
Indicator–One deduplicated indicator and every place it was seen.
-
ExtractionStats–Counts for one extraction or a merged set of extractions.
-
Extraction–Indicators produced by one extract call or a merge of several.
Functions:
-
parse_type–Return the enum member whose export key is
value. -
type_key–Return the canonical string key for a type name or enum member.
Attributes:
-
OUTPUT_ORDER(tuple[str, ...]) – -
DEFAULT_TYPES(tuple[str, ...]) – -
OPT_IN_TYPES(tuple[str, ...]) – -
HASH_TYPES(tuple[str, ...]) – -
TYPE_LABELS(dict[str, str]) –
OUTPUT_ORDER
module-attribute
¶
OUTPUT_ORDER: tuple[str, ...] = (IOCType.IPV4.value, IOCType.IPV6.value, IOCType.DOMAIN.value, IOCType.URL.value, IOCType.MD5.value, IOCType.SHA1.value, IOCType.SHA256.value, IOCType.EMAIL.value, IOCType.CVE.value, IOCType.ATTACK.value, IOCType.REGISTRY.value, IOCType.WALLET.value, IOCType.SHA512.value, IOCType.CIDR.value, IOCType.MAC.value, IOCType.ASN.value, IOCType.JA3.value, IOCType.JA3S.value, IOCType.JARM.value, IOCType.MUTEX.value, IOCType.PATH.value, IOCType.USER_AGENT.value)
DEFAULT_TYPES
module-attribute
¶
DEFAULT_TYPES: tuple[str, ...] = tuple(key for key in OUTPUT_ORDER if key not in {IOCType.MUTEX.value, IOCType.PATH.value, IOCType.USER_AGENT.value})
OPT_IN_TYPES
module-attribute
¶
HASH_TYPES
module-attribute
¶
HASH_TYPES: tuple[str, ...] = (IOCType.MD5.value, IOCType.SHA1.value, IOCType.SHA256.value, IOCType.SHA512.value)
TYPE_LABELS
module-attribute
¶
TYPE_LABELS: dict[str, str] = {IOCType.IPV4.value: 'IPv4 addresses', IOCType.IPV6.value: 'IPv6 addresses', IOCType.DOMAIN.value: 'Domains', IOCType.URL.value: 'URLs', IOCType.MD5.value: 'MD5 hashes', IOCType.SHA1.value: 'SHA-1 hashes', IOCType.SHA256.value: 'SHA-256 hashes', IOCType.SHA512.value: 'SHA-512 hashes', IOCType.EMAIL.value: 'Email addresses', IOCType.CVE.value: 'CVE identifiers', IOCType.ATTACK.value: 'MITRE ATT&CK techniques', IOCType.REGISTRY.value: 'Registry keys', IOCType.WALLET.value: 'Crypto wallets', IOCType.CIDR.value: 'CIDR ranges', IOCType.MAC.value: 'MAC addresses', IOCType.ASN.value: 'AS numbers', IOCType.JA3.value: 'JA3 fingerprints', IOCType.JA3S.value: 'JA3S fingerprints', IOCType.JARM.value: 'JARM fingerprints', IOCType.MUTEX.value: 'Mutexes', IOCType.PATH.value: 'File paths', IOCType.USER_AGENT.value: 'User-Agent strings'}
IOCType
¶
Supported indicator types.
Pass members, not strings: IOCType.IPV4, IOCType.EMAIL,
IOCType.URL. The value of each member is the short key used in
exports (IOCType.IPV4.value == "ip").
Attributes:
-
IPV4– -
IPV6– -
DOMAIN– -
URL– -
MD5– -
SHA1– -
SHA256– -
SHA512– -
EMAIL– -
CVE– -
ATTACK– -
REGISTRY– -
WALLET– -
CIDR– -
MAC– -
ASN– -
JA3– -
JA3S– -
JARM– -
MUTEX– -
PATH– -
USER_AGENT–
Sighting
¶
Bases: BaseModel
One place an indicator was observed.
Attributes:
-
source(str) –Source label, usually a file name or a caller-supplied name.
-
line(int) –1-based line number in that source.
-
offset(int) –Start offset in characters, 0-based, in the source text.
-
end_offset(int) –End offset, exclusive, in the source text.
-
page(int | None) –Page number for paged documents such as PDF.
Noneotherwise.
Enrichment
¶
Bases: BaseModel
Local facts derived from an indicator. No network calls.
Fields that do not apply are None or empty. :meth:as_dict drops those.
Registered-domain and subdomain splits are a best-effort heuristic. They are
not a Public Suffix List. See the enrichment guide.
Methods:
-
as_dict–Return a JSON-ready mapping with empty fields removed.
Attributes:
-
model_config– -
ip_version(int | None) – -
is_private(bool | None) – -
is_global(bool | None) – -
is_multicast(bool | None) – -
is_reserved(bool | None) – -
is_loopback(bool | None) – -
is_link_local(bool | None) – -
is_cgnat(bool | None) – -
tld(str | None) – -
registered_domain(str | None) – -
subdomain(str | None) – -
scheme(str | None) – -
port(int | None) – -
path(str | None) – -
host(str | None) – -
host_is_ip(bool | None) – -
query_parameters(tuple[tuple[str, tuple[str, ...]], ...]) – -
file_extension(str | None) – -
hash_algorithm(str | None) – -
asn_number(int | None) – -
cidr_prefix(int | None) – -
cidr_network(str | None) – -
mac_multicast(bool | None) – -
mac_locally_administered(bool | None) – -
wallet_format(str | None) – -
registry_hive(str | None) –
Indicator
¶
Bases: BaseModel
One deduplicated indicator and every place it was seen.
value keeps the first-seen sieve form (hashes lower case, CVE identifiers
upper case, domains lower case). raw is the exact source slice, which
may still be defanged. normalized is the canonical form used for the
fingerprint. Neither field overwrites the other.
Attributes:
-
type(IOCType) –:class:
IOCTypemember, for exampleIOCType.IPV4. -
value(str) –First-seen sieve value.
-
normalized(str) –Canonical value. Equal to
valuewhen normalization is off. -
raw(str) –Exact slice of the original source for the first sighting.
-
tags(tuple[str, ...]) –Noise tags such as
privateorloopback. Empty when none apply. -
fingerprint(str) –SHA-256 hex digest of the type and the correlation key.
-
valid(bool | None) –TrueorFalsewhen validation ran, otherwiseNone. -
confidence(float) –Deterministic heuristic in the range 0.01 to 0.99.
-
validation_notes(tuple[str, ...]) –Stable reason codes. Empty when nothing failed.
-
enrichment(Enrichment) –Local enrichment. Never fetched from the network.
-
sightings(tuple[Sighting, ...]) –Every observation, first seen first.
ExtractionStats
¶
Bases: BaseModel
Counts for one extraction or a merged set of extractions.
Attributes:
-
counts(Mapping[str, int]) –Unique indicators per type. Missing keys mean zero.
-
total(int) –Number of unique indicators.
-
sightings(int) –Number of observations, counting repeats.
-
input_characters(int) –Characters actually scanned.
-
truncated(bool) –Truewhen a size limit cut the input short. -
match_limit_hit(bool) –Truewhen a per-type match cap stopped the scan. -
sources(tuple[str, ...]) –Source labels included in the result.
Extraction
¶
Bases: BaseModel
Indicators produced by one extract call or a merge of several.
Iterate the extraction to walk indicators in export order. :meth:get
and :meth:values take an :class:IOCType member. :meth:shared returns
indicators that showed up in at least two sources.
Methods:
-
model_post_init– -
__iter__– -
__len__– -
__repr__– -
get–Return indicators of one type, in first-seen order.
-
values–Return the sieve values of one type, in first-seen order.
-
shared–Return indicators observed in two or more sources.
Attributes:
-
model_config– -
indicators(tuple[Indicator, ...]) – -
stats(ExtractionStats) – -
truncated(bool) –Whether a size limit cut the input short.