Skip to main content

IOC Fanger

PyPi PyPI - Downloads CI Lint Codecov live demo

Python package to fang (example[.]com => example.com) and defang (example.com => example[.]com) indicators of compromise in text.

Read more in our interactive documentation!

What can be fanged?

ioc_fanger.fang recognises the following defanging patterns and restores them to their normal form:

  • Brackets, parentheses, or braces around a . or , — e.g. example[.]com, example(.)com, example{.}com, example[,]com
  • Brackets, parentheses, or braces around a : — e.g. http[:]//example.com
  • The literal word DOT, dot, punto, or punkt standing in for a . — e.g. example[dot]com, example DOT com, example-punto-com
  • Brackets, parentheses, or braces around :// — e.g. http[://]example.com
  • Brackets, parentheses, or braces around www — e.g. [www]example.com
  • Brackets, parentheses, or braces around a - — e.g. service[-]ict.nl
  • @ replaced with at, et, arroba, or @ itself wrapped in brackets/parentheses/braces — e.g. user[at]example.com, user(@)example.com, user AT example.com
  • Defanged URL schemes such as hXXp://, hXXps://, hxxp://, xxxx://, xxxxs://, xxxx[s]://, as well as bracketed variants like [http]:// and htt[p]://
  • URL schemes split by extra slashes or whitespace — e.g. http:///example.com, http: //example.com, https : //example.com
  • IPv4 addresses written with commas instead of dots — e.g. 8,8,8,8 → 8.8.8.8
  • Backslash-, caret-, or angle-bracket-escaped dots — e.g. example\.com, example^.com, example<.>com
  • Backslash-escaped slashes — e.g. http:\/\/example.com
  • Stray whitespace around an @ in an email — e.g. user @ example.com

These patterns combine, so inputs like hXXp://bad[.]example[dot]com/file[.]php are fully restored in a single call.

What can be defanged?

ioc_fanger.defang applies a small, deliberately conservative set of substitutions so the output is unambiguous to re-fang:

  • A . between two word characters becomes [.] — e.g. example.com → example[.]com, 8.8.8.8 → 8[.]8[.]8[.]8
  • The URL schemes http: and https: become hXXp: and hXXps: — e.g. http://example.com → hXXp://example[.]com
  • An @ between two non-whitespace characters becomes (at) — e.g. user@example.com → user(at)example[.]com

Developer Docs

For those working on or testing this library, here's some helpful tips.

Updating Benchmarks

This project uses pytest-benchmark to test the performance impact of changes.

By default, every time you run tests it will compare the new results with the existing results.

If you need to update the benchmarks, open the pyproject.toml and replace all flags starting with --benchmark with:

--benchmark-save=benchmark

This will save a file in the .benchmarks/ dir.

Metadata

Release files for ioc-fanger 5.1.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 ioc-fanger 5.1.1
File Size Uploaded
ioc_fanger-5.1.1.tar.gz 121.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ioc-fanger 5.1.1
File Interpreter ABI Platform
ioc_fanger-5.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 129.9 kB

Release files / ioc_fanger-5.1.1.tar.gz

Download URL ioc_fanger-5.1.1.tar.gz
Size 121.8 kB
Tags Source
SHA-256 checksum
How to use checksums
436248ec3fad31743f95895c94599bb17445b8bc4cce6384c8a4bd7a386e5372
BLAKE2b-256 checksum
How to use checksums
08f14cdcc89338639d287d93f8a52d8e4748d68becf167a0d532cb881df3d8c9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.

Transparency log

Release files / ioc_fanger-5.1.1-py3-none-any.whl

Download URL ioc_fanger-5.1.1-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
813aaf6a0ba00f84208eb9d260f5ea1273f0327fdf4cc3003ef6ad25bc5df0d7
BLAKE2b-256 checksum
How to use checksums
c0df7ededd94a6a352637625b30f0bd0d51c29a7a0601406205345e65c5b09e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jun 17, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

5.1.1 This release

2 release files

5.1.0

2 release files

5.0.0

2 release files

4.2.1

2 release files

4.2.0

2 release files

4.1.0

2 release files

4.0.0

2 release files

3.4.1

2 release files

3.4.0

2 release files

3.3.0

2 release files

3.2.3

2 release files

3.2.2

2 release files

3.2.1

2 release files

3.2.0

2 release files

3.1.4

2 release files

3.1.3

2 release files

3.1.2

2 release files

3.1.1

2 release files

3.1.0

2 release files

3.0.16

2 release files

3.0.12

2 release files

3.0.9

2 release files

3.0.8

2 release files

3.0.6

2 release files

3.0.5

2 release files

3.0.4

2 release files

3.0.3

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

1.0.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

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