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.4.2.tar.gz (3.6 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ioc_hunter-1.4.2-py3-none-any.whl (3.6 MB view details)

Uploaded Python 3

File details

Details for the file ioc_hunter-1.4.2.tar.gz.

File metadata

  • Download URL: ioc_hunter-1.4.2.tar.gz
  • Upload date:
  • Size: 3.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for ioc_hunter-1.4.2.tar.gz
Algorithm Hash digest
SHA256 1da47217fa20544aacb9384f43576ab1f11a930021603118ae1495bc4a2bea3f
MD5 c14430f0ebd42d1dd7f377aec82717d2
BLAKE2b-256 fad116baa6d47829472aedfc191cca65a7444dce2a173572c7db967026f04675

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ioc_hunter-1.4.2-py3-none-any.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.22

File hashes

Hashes for ioc_hunter-1.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fa713e750d24bfe66794ef457d28d11b41a67fa59eae0dab47932930654fff12
MD5 e2c66a439692b8975a9557fcb948912a
BLAKE2b-256 5069c636ba91841b290967b2cc116495c489416ded05a14827866ec69a68d73f

See more details on using hashes here.

Supported by

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