Skip to main content

A suite of tools for simulating MITRE ATT&CK techniques for Linux and macOS

Project description

Install instructions

To install the Posix Atomic Test Harness simply run

pipenv install posixath

or

pip install posixath

then follow the instructions below for how to run the tests

Running the tests (simple)

The posixath package contains all the code necessary to run myriad attack techniques for both Linux and macOS. Below are a few examples of how to run the various tests. For more information run. If you want more examples of how to run very specific tests please refer to the documentation for that specific technique.

python -m posixath --help

Viewing available tests

To view the available tests run

python -m posixath [linux|macos] --list

Running a specific attack technique

To run a specific attack technique you need to specify the platform and the technique as follows

python -m posixath linux -t T1018

or for macOS

python -m posixath macos -t T1059

Documentation

We use a variation on mkdocs for our documentation. All of the documentation is housed in the docs folder of the repo. They are markdown files and so can be easily viewed in github or in any standard markdown viewer. You can also use the python library mkdocs-material to generate a more friendly local web view of the documentation. To do so make sure you have the dev dependencies listed in the Pipfile installed. Then run mkdocs serve from the root directly. This will create a web server that listens on localhost and provides a nice web UI for viewing the documenation.

Dependencies

Linux

Some test require that the user be root in order to run.

Below is a list of packages required for being able to run the posix tests

Ubuntu

$ sudo apt-get install libcap-dev

Fedora

$ sudo dnf install libcap-devel

Advanced Usage

You can use the Posix Atomic Test Harnesses directly from the code base as well. The following instructions will walk you through how to setup your environment so that you can run the tests directly from the source. Running tests this way allows you to use any tools that operate with pytest itself.

pytest runner

Pytest is used as our test runner to execute various Atomic Test Harness tests. In order to prepare your environment please run:

pipenv install
pipenv shell
pytest -k [linux|macos] -v

NOTE: If you don't have pipenv installed please see the guide here

Running the tests

The tests can be run two different ways. The first is by cloning the repo and calling directly into pytest. The second is by installing the code base from PyPi.

Enumerate the different types of tests that can be run

pytest --co

Enumerate the various command line parameters

pytest --help and look for the custom options section

or

pytest --fixtures

Enumerate the different types of linux tests

pytest -v -m linux --co

Enumerate the different types of macOS tests

pytest -v -m macos --co

Enumerate attack variations for a given technique

pytest -v -m linux -k T1548_001 --co

Run all linux tests

pytest -v tests/linux

or

pytest -v -m linux

Run all macOS tests

pytest -v tests/macos

or

pytest -v -m macos

Run a specific attack type for linux

pytest -v -m linux -k T1548_001

Run a specific attack type variation for linux

pytest -v -m linux -k T1548_001 -k chmod

Run a specific attack type for macOS

pytest -v -m macos -k T1018

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

posixath-0.0.5.tar.gz (68.9 kB view details)

Uploaded Source

Built Distribution

posixath-0.0.5-py3-none-any.whl (42.4 kB view details)

Uploaded Python 3

File details

Details for the file posixath-0.0.5.tar.gz.

File metadata

  • Download URL: posixath-0.0.5.tar.gz
  • Upload date:
  • Size: 68.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for posixath-0.0.5.tar.gz
Algorithm Hash digest
SHA256 2465d8d773f1f3b8d8a2eead386af083db50bf6b859992abd819f62eacdca1ce
MD5 b06b61e42079e9ab9bc78e06f7a4bdc9
BLAKE2b-256 c49227d69a221bf5768becda96ab237056a5b683b062ca0748119f0ea6845908

See more details on using hashes here.

File details

Details for the file posixath-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: posixath-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 42.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.13

File hashes

Hashes for posixath-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ad08f7ef234cc306d3e24c4814c4802b6c4f6606bfbc69b472be5e991f6ae89f
MD5 f239f50d37b6d903dd5de0585a3486ab
BLAKE2b-256 95b767eb62e710388a961f50a6165ad48fbc91ae497c8b520540fe41b631a7f2

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