Skip to main content

iocscrape

PyPI version Python Version License Category

CTI tool to extract IOCs from CTI reports (URLs or files)
IOC extraction is best-effort and may produce false positives - always review before ingestion.

Features

  • Extract IOCs from:
    • URLs (CTI articles / reports)
    • Files: txt, html, pdf, docx, xlsx
  • Uses trafilatura to convert web pages into clean text (reduces noise from hidden links / menus / assets).
  • Groups suspicious/noisy matches into Low-Confidence (Review) using:
    • Public Suffix List (PSL) validation
    • MISP warninglists (vendored snapshot + optional --update)
    • filename-like domain detection (e.g. something.png)
    • static asset URL detection (e.g. .png, .css, .woff2)
  • Output formats:
    • Default: TXT (pixhash-like run log style)
    • Optional: JSON
  • --update updates both: warninglists + PSL

Installation

python3 -m pip install --user pipx
python3 -m pipx ensurepath
pipx install iocscrape

Option 2:

pip install iocscrape

Usage

Extract from URL

iocscrape --url "https://example.com/report" --out output.txt

Extract from File

iocscrape --file "/path/report.pdf" --out output.txt

JSON Output

iocscrape --url "https://example.com/report" --out output.json --format json

Updating datasets (Warninglists + PSL)

By default, iocscrape ships with a vendored snapshot of:

  • MISP warninglists, and
  • Public Suffix List (PSL).

To update them:

iocscrape --update

To update + run extraction in one command:

iocscrape --update --url "https://example.com/report" --out output.txt

Cache location: ~/.cache/iocscrape

Supported IOC Types

  • URL
  • Domain
  • IPv4
  • IPv6
  • Email
  • MD5
  • SHA1
  • SHA256
  • CVE

Output

1. TXT (Default)

The output file is a run log:

  • Results section contains "high-confidence" IOCs
  • Low-Condidence (Review) section contains items flagged by:
    • Warninglists match
    • PSL invalid suffix
    • Filename-like "domain"
    • Static asset URL

Example structure:

iocscrape Run Log
=================

[#] Target:       ...
[#] Date:         ...
[#] Time:         ...
[#] User-Agent:   ...
[#] Output File:  ...

-------
Results
-------

[#] URL (..)
...

-----------------------
Low-Confidence (Review)
-----------------------

[#] DOMAIN (..)
value >> reason

2. JSON

Contains:

  • Counts per IOC type
  • IOC by type
  • Low-confidence array with reasons

Notes on False Positives

This tool uses regex-based extraction. It can still pick up:

  • File names that look like domains
  • Configuration keys
  • Benign public infrastructure (flagged via warninglists / PSL into low-confidence)

Always review the output before operational ingestion (SIEM/Blocklists/EDR/Firewall... etc.).

License

MIT License. See LICENSE.

Contributing

Issues/PRs are welcomed:

Metadata

Release files for iocscrape 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iocscrape 0.3.1
File Size Uploaded Provenance Actions
iocscrape-0.3.1.tar.gz 13.4 kB Without provenance Details for iocscrape-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for iocscrape 0.3.1
File Interpreter ABI Platform Actions
iocscrape-0.3.1-py3-none-any.whl Python 3 none any Details for iocscrape-0.3.1-py3-none-any.whl

Total release size: 30.2 kB

Release files / iocscrape-0.3.1.tar.gz

Download URL iocscrape-0.3.1.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
980bdccf6571cf69147c27fd1866e5c3d1e5d4227be95f11eb6d3ffa56deb44c
BLAKE2b-256 checksum
How to use checksums
6cf072fde51f4840cadbc32fa29102a5741c15c0d6ab107c827e25c2d8c492cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / iocscrape-0.3.1-py3-none-any.whl

Download URL iocscrape-0.3.1-py3-none-any.whl
Size 16.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f56c1692b997c799c906967e799d6927f325892d779eaf23d9e54b4e6f18fdef
BLAKE2b-256 checksum
How to use checksums
7b2f04a7ecdf026ee3f9699ce17eecae1993107cb61c0c91157426d817289cd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for iocscrape 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page