A collection of tools used to create MAL models and attack graphs.
Project description
MAL Toolbox overview
MAL Toolbox is a collection of python modules to help developers create and work with MAL (Meta Attack Language) models and attack graphs.
Attack graphs can be used to run simulations in MAL Simulator or run your own custom analysis on.
Usage
Installation
pip install mal-toolbox
Requirements
If you wish to run visualisations with graphviz, you must first download and install it on your computer. Depending on your operating system, you can find out how to do this here: link to graphviz installation.
Once the software has been successfully installed, you must also include the python package by running:
pip install graphviz
Configuration
You can use a maltoolbox.yml file in the current working directory to
configure the toolbox.
The config should look like this:
logging:
log_level: INFO
log_file: "logs/log.txt"
attackgraph_file: "logs/attackgraph.json"
model_file: "logs/model.yml"
langspec_file: "logs/langspec_file.yml"
langgraph_file: "logs/langspec_file.yml"
neo4j:
uri: None
username: None
password: None
dbname: None
Alternatively, you can use the MALTOOLBOX_CONFIG
environment variable to set a custom config file location.
# in your shell, e.g. bash do:
export MALTOOLBOX_CONFIG=path/to/yml/config/file
The default configuration can be found here:
https://github.com/mal-lang/mal-toolbox/blob/main/maltoolbox/__init__.py#L39-L53
Command Line Client
You can use the maltoolbox cli to:
- Generate attack graphs from model files
- Compile MAL languages
- Upgrade model files from older versions
Command-line interface for MAL toolbox operations
Usage:
maltoolbox compile <lang_file> <output_file>
maltoolbox generate-attack-graph [--graphviz] <model_file> <lang_file>
maltoolbox upgrade-model <model_file> <lang_file> <output_file>
maltoolbox visualize-model <model_file> <lang_file>
Arguments:
<model_file> Path to JSON instance model file.
<lang_file> Path to .mar or .mal file containing MAL spec.
<output_file> Path to write the result of the compilation (yml/json).
Options:
-h --help Show this screen.
-g --graphviz Visualize with graphviz
Notes:
- <lang_file> can be either a .mar file (generated by the older MAL
compiler) or a .mal file containing the DSL written in MAL.```
Contributing
CI Pipeline
Checks are made with:
mypyruffpytest
Make sure pipeline passes before PR is marked "Ready for review".
Tests
There are unit tests inside of ./tests.
To run all tests, use the pytest command. To run just a specific file or test function use pytest tests/<filename> or pytest -k <function_name>.
Making a release
-
Make a PR with one commit that updates the version number in
pyproject.tomlandmaltoolbox/__init__.py. Follow Semantic versioning. -
Get the PR reviewed and merged to
main. -
Tag the latest commit on
mainwith the new version number. -
Push the tag.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mal_toolbox-2.1.0.tar.gz.
File metadata
- Download URL: mal_toolbox-2.1.0.tar.gz
- Upload date:
- Size: 66.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
528a6a117ac46e1373331a9126e6ad94c28382501d8624907a2b9c43391e435a
|
|
| MD5 |
3417fdc664d1e4289bead41b2b74ee10
|
|
| BLAKE2b-256 |
1e815117d395086fc8965033cae3035c817972df209fbd8ef8d36fb4d1f28f59
|
Provenance
The following attestation bundles were made for mal_toolbox-2.1.0.tar.gz:
Publisher:
publish-to-pypi-and-test-pypi.yml on mal-lang/mal-toolbox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mal_toolbox-2.1.0.tar.gz -
Subject digest:
528a6a117ac46e1373331a9126e6ad94c28382501d8624907a2b9c43391e435a - Sigstore transparency entry: 908378816
- Sigstore integration time:
-
Permalink:
mal-lang/mal-toolbox@909f53ab3a457b96c11cfc137952ef56f25b8eb4 -
Branch / Tag:
refs/tags/2.1.0 - Owner: https://github.com/mal-lang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi-and-test-pypi.yml@909f53ab3a457b96c11cfc137952ef56f25b8eb4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mal_toolbox-2.1.0-py3-none-any.whl.
File metadata
- Download URL: mal_toolbox-2.1.0-py3-none-any.whl
- Upload date:
- Size: 77.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d68ac1df49bd1149095791b34f08016f9b1d8c9cb63f87108ba6e94adfb1d763
|
|
| MD5 |
c47c4db60fb8f616baa35908c27bc894
|
|
| BLAKE2b-256 |
0ffd807ff4d25a6364e9ebdc0f75dfae7d3fe508911f93fca8f683f396451474
|
Provenance
The following attestation bundles were made for mal_toolbox-2.1.0-py3-none-any.whl:
Publisher:
publish-to-pypi-and-test-pypi.yml on mal-lang/mal-toolbox
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mal_toolbox-2.1.0-py3-none-any.whl -
Subject digest:
d68ac1df49bd1149095791b34f08016f9b1d8c9cb63f87108ba6e94adfb1d763 - Sigstore transparency entry: 908378879
- Sigstore integration time:
-
Permalink:
mal-lang/mal-toolbox@909f53ab3a457b96c11cfc137952ef56f25b8eb4 -
Branch / Tag:
refs/tags/2.1.0 - Owner: https://github.com/mal-lang
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi-and-test-pypi.yml@909f53ab3a457b96c11cfc137952ef56f25b8eb4 -
Trigger Event:
push
-
Statement type: