Skip to main content

Set of utilities to parse and use MISP galaxy clusters

Project description

Galaxy Parser for MISP

Utilities to parse galaxy clusters and resolve labels, including synonyms.

There are some string normalization steps (whitespace removal and compound words handling) that can be improved, but anything domain-specific is computed using MISP galaxies.

./bin/query_galaxy.py sednit -g mitre-intrusion-set 
> Mapping 'sednit' to:  ['misp-galaxy:mitre-intrusion-set="APT28 - G0007"']
./bin/query_galaxy.py apt28 -g mitre-intrusion-set 
> Mapping 'apt28' to:  ['misp-galaxy:mitre-intrusion-set="APT28 - G0007"']
./bin/query_galaxy.py feodo -g malpedia
> Mapping 'feodo' to:  ['misp-galaxy:malpedia="Emotet"']
./bin/query_galaxy.py emotet -g malpedia
> Mapping 'emotet' to:  ['misp-galaxy:malpedia="Emotet"']

There is also another script included: update_cluster_tags.py. This script tries to handle scenarios when MISP galaxies evolve over time. For example clusters can be merged (because of new synonyms), or simply renamed (e.g., a MITRE technique getting slightly renamed). When this happens galaxy tags are not recognized anymore as such by the MISP instance, and instead they are visually downgraded to local tags.

This script searches and promotes all downgraded tags to their former (galaxy) glory. You can invoke it as follows (-d is a dry-run). Note that it requires accessing a full fledge MISP installation, and thus requires a configuration file (template included).

./bin/update_cluster_tags.py -c ./data/config.ini
> Scanning tags
> Tag 'misp-galaxy:mitre-attack-pattern="Command-Line Interface - T1059"' should be replaced with 'misp-galaxy:mitre-attack-pattern="Command and Scripting Interpreter - T1059"'
> Tag 'misp-galaxy:mitre-attack-pattern="Group Policy Modification - T1484"' should be replaced with 'misp-galaxy:mitre-attack-pattern="Domain Policy Modification - T1484"'
> Tag 'misp-galaxy:mitre-attack-pattern="Standard Application Layer Protocol - T1071"' should be replaced with 'misp-galaxy:mitre-attack-pattern="Application Layer Protocol - T1071"'
> Processing events
> [1/3] Replacing tag 'misp-galaxy:mitre-attack-pattern="Command-Line Interface - T1059"' with 'misp-galaxy:mitre-attack-pattern="Command and Scripting Interpreter - T1059"'
>        [1/1] Processing event 'Event 1 on ransomware'
> [2/3] Replacing tag 'misp-galaxy:mitre-attack-pattern="Group Policy Modification - T1484"' with 'misp-galaxy:mitre-attack-pattern="Domain Policy Modification - T1484"'
>        [1/1] Processing event 'Event 2 on ransomware'
> [3/3] Replacing tag 'misp-galaxy:mitre-attack-pattern="Standard Application Layer Protocol - T1071"' with 'misp-galaxy:mitre-attack-pattern="Application Layer Protocol - T1071"'
>        [1/1] Processing event 'Event 3 on ransomware'
> Processing attributes
> [1/3] Replacing tag 'misp-galaxy:mitre-attack-pattern="Command-Line Interface - T1059"' with 'misp-galaxy:mitre-attack-pattern="Command and Scripting Interpreter - T1059"'
>        [1/65] Processing attribute '8f4f6c37-29c1-47fe-a144-32eb834370e6'
> ...

Install

This package is available on PyPI, and it can be installed with pip:

pip install misp-galaxy-parser

To install and use the component requiring pymisp you just need to install the package together with its misp extra (use quotes or double quotes if your shell process square brackets):

pip install misp-galaxy-parser[misp]

Development

We use tox to run tests (via nose2), black as formatter, and pylint as static checker. You can install them (use a virtual environment) using pip:

python3 -m venv venv
source ./venv/bin/activate
pip install tox black pylint

And run them as follows:

tox
>  py39: OK (4.13=setup[3.98]+cmd[0.16] seconds)
>  congratulations :) (4.17 seconds)
pylint ./bin ./src ./tests
> 
> --------------------------------------------------------------------
> Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
> 
black ./bin ./src ./tests
> All done!  🍰 ✨
> 8 files left unchanged.

Contributing

The galaxy-parser-for-misp project team welcomes contributions from the community. Before you start working with galaxy-parser-for-misp, please read our Developer Certificate of Origin. All contributions to this repository must be signed as described on that page. Your signature certifies that you wrote the patch or have the right to pass it on as an open-source patch. For more detailed information, refer to CONTRIBUTING.md.

License

BSD 2-Clause

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

misp-galaxy-parser-0.1.5.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

misp_galaxy_parser-0.1.5-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file misp-galaxy-parser-0.1.5.tar.gz.

File metadata

  • Download URL: misp-galaxy-parser-0.1.5.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for misp-galaxy-parser-0.1.5.tar.gz
Algorithm Hash digest
SHA256 b4650d514b7768dadec62646353f17ac492db15c357c11195a8ec215ab207276
MD5 90a50e8967bb5718464cf54039839612
BLAKE2b-256 c723cd2e222dd8777924f725a14604185f89c5d8aff2a81d4fb279e0b1703a13

See more details on using hashes here.

File details

Details for the file misp_galaxy_parser-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for misp_galaxy_parser-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b5c372ab97e530802cb9d8a43f0c581ef0f5a408c5904e8f64606523e08d7e9b
MD5 aa4e3800dffbdf602de1cb00bf702bb0
BLAKE2b-256 d1853c00817491d4f85980554fc7db84c46bb153cf6cc3ef4e0607bacfdd30c3

See more details on using hashes here.

Supported by

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