Skip to main content

Extract IOCs from text.

Project description

ioc-hunter

IOC Hunter finds indicators of compromise (IOC). The parse_iocs function can extract IOCs from text.
The type_ioc function can determine the IOC type of a string that you pass in.

The IOCs that are recognized are:

  • ssdeep
  • sha256
  • sha1
  • md5
  • email
  • ipv4_public
  • ipv4_private
  • ipv6_public
  • ipv6_private
  • filename
  • domain
  • url

Parse IOCs

The parse_iocs function parses IOCs in the list above from text. There is an option to defang the IOCs that are passed back as well as an option to provide a whitelist regex. This will also return IOCs labeled as unknown when text is found to be suspicious, but doesn't match any of the IOC types.

from ioc_hunter import parse_iocs

text = "Your text goes here"
whitelist = r".*internaldomain\.com.*"
iocs = parse_iocs(text, defang=False, whitelist_regex=whitlist)
parse_iocs

Params:
    text – A string to parse.
    defang – If True, defang any IOCs we can (see DEFANGABLE). If False, return IOCs in their fanged state.
    whitelist_regex – Any IOC matching this regex will be ignored
    iocs_to_parse – A list of IOC types to look for (see IOC_TYPES_SEARCH_ORDER for options)
    whitelist_domains – A list or CSV of domains to exclude from results. Excludes domains and URLs that match
    whitelist_ip_cidr_ranges – A list or CSV of CIDR ranges to exclude from results. Excludes IPs and URLs that match
Returns:
    A dictionary with the ioc type as the key and a list of iocs for each value.

Type IOC

The type_ioc function takes in text and determines if that text matches any of the IOC types. If it does not match any, it will return unkown.

from ioc_hunter import type_ioc

suspected_ioc = "mydomain.com"
ioc_type = type_ioc(suspected_ioc)
type_ioc

Params:
    ioc – The IOC to classify.
    types_to_find – A list of types you want to look for.
Returns:
    The type of the IOC as a string, (see IOC_TYPES_SEARCH_ORDER for options)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ioc-hunter-1.1.0.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

ioc_hunter-1.1.0-py3-none-any.whl (14.7 kB view details)

Uploaded Python 3

File details

Details for the file ioc-hunter-1.1.0.tar.gz.

File metadata

  • Download URL: ioc-hunter-1.1.0.tar.gz
  • Upload date:
  • Size: 15.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.15

File hashes

Hashes for ioc-hunter-1.1.0.tar.gz
Algorithm Hash digest
SHA256 6502e2cd75050ec3e5001b408148d1ff5d2a8743a4f7e36ca71f3c0ef3d867b4
MD5 a5b298d9889953b4b977c61909265255
BLAKE2b-256 511646a77982ac08c5de9e3339fbb778ac75a4f0b54867e3d808c30d2550b8e8

See more details on using hashes here.

File details

Details for the file ioc_hunter-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: ioc_hunter-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 14.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.8.3 keyring/23.4.1 rfc3986/1.5.0 colorama/0.4.4 CPython/3.6.15

File hashes

Hashes for ioc_hunter-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d5ef68335a18532610c2a5b18ca0793a873ef8b67cba4616f18cc380ecf40072
MD5 796d11862d1c67f694ea0b654cb5d811
BLAKE2b-256 479f46475ab2f610f49854686f94548ae38a92454f547ea0b7fa087cda450142

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page