DetectMate Library for log processing components
Project description
DetectMateLibrary
Main library to run the different components in DetectMate.
Main structure
The library contains the next components:
- Parsers: parse the logs received from the reader.
- Detectors: return alerts if anomalies are detected.
- Alert Aggregation: aggregate the alerts produced by the detectors.
- Schemas: standard data classes use in DetectMate.
+--------+ +-----------+ +-------------------+
| Parser | --> | Detector | -> | Alert Aggregation |
+--------+ +-----------+ +-------------------+
Developer setup:
Step 1: Install python dependencies
Set up the dev environment and install pre-commit hooks:
uv sync --dev
uv run prek install
Step 2: Install Protobuf dependencies
To install in Linux do:
sudo apt install -y protobuf-compiler
protoc --version
This dependency is only needed if a proto file is modified. To compile the proto file do:
protoc --proto_path=src/detectmatelibrary/schemas/ --python_out=src/detectmatelibrary/schemas/ src/detectmatelibrary/schemas/schemas.proto
Step 3: Run unit tests
Run the tests:
uv run pytest -q
Run the tests with coverage (add --cov-report=html to generate an HTML report):
uv run pytest --cov=. --cov-report=term-missing
Workspace generator (mate create)
DetectMateLibrary includes a small CLI helper to bootstrap standalone workspaces for custom parsers and detectors. This is useful if you want to develop and test components in isolation while still using the same library and schemas.
Usage
The CLI entry point is mate with a create command:
mate create --type <parser|detector> --name <workspace_name> --dir <target_dir>
| Option | Description |
|---|---|
--type |
Component type to generate: - parser: CoreParser-based template- detector: CoreDetector-based template |
--name |
Name of the component and package: - Creates package dir: <target_dir>/<name>/- Creates main file: <name>.py- Derives class names: <Name> and <Name>Config |
--dir |
Directory where the workspace will be created |
What gets generated
For example:
mate create --type parser --name custom_parser --dir ./workspaces/custom_parser
will create:
workspaces/custom_parser/ # workspace root
├── custom_parser/ # Python package
│ ├── __init__.py
│ └── custom_parser.py # CoreParser-based template
├── tests/
│ └── test_custom_parser.py # generated from template to test custom_parser
├── data.json # example data to run the code
├── LICENSE.md # copied from main project
├── .gitignore # copied from main project
├── .pre-commit-config.yaml # copied from main project
├── pyproject.toml # minimal project + dev extras
└── README.md # setup instructions
Documentation
Contribution
We're happily taking patches and other contributions. Please see the following links for how to get started:
If you encounter any bugs, please create an issue on Github.
License
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 detectmatelibrary-0.3.2.tar.gz.
File metadata
- Download URL: detectmatelibrary-0.3.2.tar.gz
- Upload date:
- Size: 89.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d245600ebc741fe65b33c6703534fb75d3a8f2645d30f6f195c33c5ca29db70
|
|
| MD5 |
3b19618829868cd2980f5868289c02aa
|
|
| BLAKE2b-256 |
c8f3dfd1442490cb74794864914152615c8823065085b281ec02e4f3ba043522
|
Provenance
The following attestation bundles were made for detectmatelibrary-0.3.2.tar.gz:
Publisher:
python-publish.yml on ait-detectmate/DetectMateLibrary
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
detectmatelibrary-0.3.2.tar.gz -
Subject digest:
7d245600ebc741fe65b33c6703534fb75d3a8f2645d30f6f195c33c5ca29db70 - Sigstore transparency entry: 2084648335
- Sigstore integration time:
-
Permalink:
ait-detectmate/DetectMateLibrary@3b7e38309aece9a4661f7dc100391d208ab9315a -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/ait-detectmate
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@3b7e38309aece9a4661f7dc100391d208ab9315a -
Trigger Event:
release
-
Statement type:
File details
Details for the file detectmatelibrary-0.3.2-py3-none-any.whl.
File metadata
- Download URL: detectmatelibrary-0.3.2-py3-none-any.whl
- Upload date:
- Size: 129.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
002c9c1912474048d6a0de05e3fc5b44ab9064aea76a45dc3354a936e820fb5d
|
|
| MD5 |
2cb3cb2fc0abf59ec2ae7ed5f14d63d8
|
|
| BLAKE2b-256 |
f19e85f85435a3048eb242583dfd7e0f67dd77d4b6c94700da9895ad2095f7a0
|
Provenance
The following attestation bundles were made for detectmatelibrary-0.3.2-py3-none-any.whl:
Publisher:
python-publish.yml on ait-detectmate/DetectMateLibrary
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
detectmatelibrary-0.3.2-py3-none-any.whl -
Subject digest:
002c9c1912474048d6a0de05e3fc5b44ab9064aea76a45dc3354a936e820fb5d - Sigstore transparency entry: 2084648337
- Sigstore integration time:
-
Permalink:
ait-detectmate/DetectMateLibrary@3b7e38309aece9a4661f7dc100391d208ab9315a -
Branch / Tag:
refs/tags/v0.3.2 - Owner: https://github.com/ait-detectmate
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@3b7e38309aece9a4661f7dc100391d208ab9315a -
Trigger Event:
release
-
Statement type: