Repository navigation
Prohori 0.2.0
Machine learning, evaluated honestly: anomaly detection on your own logs, and intrusion-detection
models on two public flow datasets with leakage controls, a model card and a cross-dataset test.
Highlights
--modelsondetect,incidentsandtriage: anomaly detectors flag source IPs that behave
unlike the rest of the log; their alerts join the incidents.- Leakage-controlled UNSW-NB15 and CIC-IDS-2017 preparation, gradient boosting and Isolation
Forest flow models, SOC metrics (PR-AUC, recall at frozen thresholds, false alerts per 10,000
flows, per-class recall) anddocs/MODEL_CARD.md. - A cross-dataset test showing that the flow models do not transfer between the datasets.
prohori score FLOWS --model NAMEfor scoring a CSV of flows with a saved model.
Added
- Leakage-controlled preparation of the UNSW-NB15 and CIC-IDS-2017 flow datasets for the
machine-learning track (prohori.ml, behind themlextra):scripts/download_datasets.pylists the datasets with their licences and citations,
downloads CIC-IDS-2017 only when asked (checked against a pinned size and SHA-256 before it is
opened, then extracted member by member), prints the manual steps for UNSW-NB15, verifies
the files and prints a cleaning report.- Chunked CSV reading with fixed column types and a Parquet cache keyed by the raw file's hash.
- Cleaning that drops identifier, address, port, time and label-derived columns, relabels
"Attempted" CIC-IDS-2017 flows as benign, removes duplicates and conflicting rows, removes
official test rows that also occur in training, and fits imputation and category encoding on
the training split only. A leakage check runs on every prepared dataset. - Synthetic fixture datasets in
tests/fixtures/ml/with the real headers. docs/DATASETS.mdand ADR-0019.
- The first flow detectors and their evaluation (
python -m prohori.ml.train):- Gradient boosting (supervised) and an Isolation Forest trained on benign flows only, with
fixed settings. - Thresholds chosen on the validation split for 1 % and 0.1 % false-positive rates and
frozen; the test split is scored once per seed. - PR-AUC, ROC-AUC, the test false-positive rate reached, recall, precision, false alerts per
10,000 flows and recall per attack class, as mean and standard deviation over seeds 0-2.
Accuracy is not reported. - Uncleaned and no-TTL variants that show the effect of the leakage controls.
- Results for both datasets in
results/ml_*.json, tables generated into
docs/MODEL_CARD.mdand the README, and models saved outside git with a SHA-256 sidecar
and a warning that model files are pickles. docs/MODEL_CARD.mdand ADR-0020.
- Gradient boosting (supervised) and an Isolation Forest trained on benign flows only, with
- A cross-dataset test (
python -m prohori.ml.transfer): models trained on one dataset's twelve
common features (a documented, lossy mapping) and scored on the other. Gradient boosting's
ROC-AUC falls from 0.95 and 1.00 to 0.64 and 0.61, and its 1 % threshold flags 42 % and 60 % of
the other dataset's benign flows; results inresults/ml_cross.jsonand the model card
(ADR-0021). prohori score FLOWS --model NAME: score a CSV of flows with a saved model and list the
flagged flows (--fpr,--top,-f json,--exit-zero); needs themlextra and says so
when it is missing.--no-cacheforprohori.ml.trainandprohori.ml.transfer: neither read nor write the
Parquet cache.- Anomaly detection on your own logs:
--modelsondetect,incidentsandtriagecuts the
events into five-minute windows per source IP, computes thirteen behaviour features and flags
unusual windows with a robust z-score (base install) and an Isolation Forest (mlextra).
Model alerts (detector_kind: model) join the incidents with a limitation and a review action. python -m prohori.ml.logevalcompares the detectors with the rules on the simulator's
attacks; cut-offs were chosen on the default variants and frozen before the held-out variants
were scored. Results inresults/ml_logs.jsonanddocs/ANOMALY.md(ADR-0022): on the
held-out variants the detectors catch 15 to 17 of 40 attacks against 36 for the rules, none
that the rules miss, with 0 to 0.35 false alerts a run against 6.5.
Changed
- The release workflow no longer creates the GitHub release, so none of its jobs can write to the
repository; maintainers create it with one command (docs/RELEASING.md). - The clones badge's data branch is published with
peaceiris/actions-gh-pages; the workflow's
top-level token is read-only.
Fixed
- The UNSW-NB15 partition files are pinned to the size and SHA-256 of the published files, and
the dataset documentation has the measured effect of cleaning them.