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: http://ioc-fanger.hightower.space.

Defanging - converting indicators of compromise from the normal form (which can become links) to a form which cannot accidentally become a link:

example.com => example[.]com

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

example[.]com => example.com

What can it fang?

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

Installation

The recommended means of installation is using pip:

pip install ioc_fanger

Alternatively, you can install ioc_fanger as follows:

git clone https://github.com/ioc-fang/ioc_fanger.git && cd ioc_fanger;
python setup.py install --user;

Usage

Via Python

Use ioc_fanger as follows:

import ioc_fanger

ioc_fanger.defang("example.com http://bad.com/phishing.php")  # example[.]com hXXp://bad[.]com/phishing[.]php
ioc_fanger.fang("example[.]com hXXp://bad[.]com/phishing[.]php")  # example.com http://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"  # example.com
defang "example.com"  # 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 https://github.com/fhightower/ioc-finder project helpful. It is a project designed to parse indicators of compromise from text (it uses grammars rather than regexes).

Credits

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.

Source Distribution

ioc_fanger-3.0.15.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

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

ioc_fanger-3.0.15-py2.py3-none-any.whl (6.4 kB view details)

Uploaded Python 2Python 3

File details

Details for the file ioc_fanger-3.0.15.tar.gz.

File metadata

  • Download URL: ioc_fanger-3.0.15.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for ioc_fanger-3.0.15.tar.gz
Algorithm Hash digest
SHA256 0b9093a159849635d257d2a96e0f8af844dd6eb7cb0e79a4472dc6a2e07ef13e
MD5 9317dd3933d2a06269100d5747d60765
BLAKE2b-256 3ce4239ec4fe566eac9480d3483c2df1a8f0260a07d1bab7747d8a414a6fdba7

See more details on using hashes here.

File details

Details for the file ioc_fanger-3.0.15-py2.py3-none-any.whl.

File metadata

  • Download URL: ioc_fanger-3.0.15-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

File hashes

Hashes for ioc_fanger-3.0.15-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 802384aa97514b2601c13c6b6bf42afabd02fa1079b87ffa2a7d419f065bcf04
MD5 880a85cf9b770b3c26a487be59290346
BLAKE2b-256 ab44c77de84868211d3de5b2582f55046759be1f56b7501c702c3233e3f602b2

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