Skip to main content

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 models and attack graphs by working with the Meta Attack Language (MAL).

It allows you to:

  • Create system models from MAL languages.
  • Create attack graphs that can be used to run simulations in MAL Simulator or run your own custom analysis on.

For in-depth documentation and tutorials refer to the mal-toolbox Wiki and the mal-tutorials repository.

Contributing

CI Pipeline

Checks are made with:

  • mypy
  • ruff
  • pytest

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

  1. Make a PR with one commit that updates the version number in pyproject.toml and maltoolbox/__init__.py. Follow Semantic versioning.

  2. Get the PR reviewed and merged to main.

  3. Tag the latest commit on main with the new version number.

  4. Push the tag.

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.```

Project details


Release history Release notifications | RSS feed

This version

2.6.0

Download files

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

Source Distribution

mal_toolbox-2.6.0.tar.gz (68.8 kB view details)

Uploaded Source

Built Distribution

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

mal_toolbox-2.6.0-py3-none-any.whl (79.6 kB view details)

Uploaded Python 3

File details

Details for the file mal_toolbox-2.6.0.tar.gz.

File metadata

  • Download URL: mal_toolbox-2.6.0.tar.gz
  • Upload date:
  • Size: 68.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mal_toolbox-2.6.0.tar.gz
Algorithm Hash digest
SHA256 607030726af61e6c6c01749415f8c374070e88f54f5bc7af3907ea8b6d1012ca
MD5 5d54487ed4bf708584cb227aa6b8a384
BLAKE2b-256 3a437d7fc2024ce7c31aa3d4c800e0a6c2efa579b6ddd9f21f4af57d39f89cb4

See more details on using hashes here.

Provenance

The following attestation bundles were made for mal_toolbox-2.6.0.tar.gz:

Publisher: publish-to-pypi-and-test-pypi.yml on mal-lang/mal-toolbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mal_toolbox-2.6.0-py3-none-any.whl.

File metadata

  • Download URL: mal_toolbox-2.6.0-py3-none-any.whl
  • Upload date:
  • Size: 79.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mal_toolbox-2.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f76f7de75f52904b5aa6e0bebc89f6e4d628c36f69b3655ef2124a2b0a2b8a60
MD5 4b094c6e02fd879c5ecc160da466cc1d
BLAKE2b-256 e1bdeb178a0099dfa4e0d81d871ff9babfa12359f2a6d472d9ab697786981bf6

See more details on using hashes here.

Provenance

The following attestation bundles were made for mal_toolbox-2.6.0-py3-none-any.whl:

Publisher: publish-to-pypi-and-test-pypi.yml on mal-lang/mal-toolbox

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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