Skip to main content

Python package to defang and refang indicators of compromise from text.

Project description

IOC Fanger

PyPi Travis CI Codecov Codacy

Python package to fang and defang indicators of compromise in text. You can test out this project here:

Defanging - converting indicators of compromise from the normal form (which can become links) to a form which cannot accidentally become a link: => example[.]com

Fanging - converting indicators of compromise from a defanged form to the normal, original form:

example[.]com =>

What can it fang?

Just about everything. Check out the tests to see some examples of what this package can handle.


The recommended means of installation is using pip:

pip install ioc_fanger

Alternatively, you can install ioc_fanger as follows:

git clone && cd ioc_fanger;
python install --user;


Via Python

Use ioc_fanger as follows:

import ioc_fanger

ioc_fanger.defang("")  # example[.]com hXXp://bad[.]com/phishing[.]php
ioc_fanger.fang("example[.]com hXXp://bad[.]com/phishing[.]php")  #

Via Command Line

Once the package is installed, there will be two commands available in the command line:

  • fang
  • defang

After each command, provide the text you would like to fang/defang:

fang "example[.]com"  #
defang ""  # example[.]com

Adding More Fanging/Defanging Options

You can view the current fanging patterns here and the defanging patterns here.

To add more fanging options, edit fang.json and add an entry for the new pattern you would like to fang. The available keys for each entry are:

  • find (required): This is the string pattern you would like to find
  • replace (required): This is the string used to replace all instances to pattern specified by the find key
  • case_sensitive (optional - boolean): If this is true, the pattern specified by the find key will be treated as case sensitive (it will only be replaced if the case is an exact match)
  • regex (optional - boolean): If this is true, the pattern specified by the find key will be treated as a regex (it will not be escaped before use)

Other Helpful Projects

If you are working with IOCs, you may find the project helpful. It is a project designed to parse indicators of compromise from text (it uses grammars rather than regexes).


This package was created with Cookiecutter and the fhightower/python-project-template project template.

Project details

Download files

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

Files for ioc-fanger, version 3.0.15
Filename, size & hash File type Python version Upload date
ioc_fanger-3.0.15-py2.py3-none-any.whl (6.4 kB) View hashes Wheel py2.py3
ioc_fanger-3.0.15.tar.gz (6.8 kB) View hashes Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page