A laptop-sized mini-SOC: from raw logs to detections, enriched incidents and analyst-ready reports, with honest machine-learning evaluation and a streaming data pipeline.
Prohori™ (প্রহরী) is Bengali for "guard". It is a source-available, defensive security-operations toolkit in Python that runs on a single laptop with free tools only, offline by default. It is free for personal and other non-commercial use (License).
Status: v1.1.0, stable. One command goes from a log file to scored incidents and shareable reports, and a labelled attack simulator measures the rules. Machine learning (anomaly detectors over your own logs, flow models evaluated with leakage controls), a streaming pipeline with warehouse models, dashboards and scheduled jobs, and an opt-in LLM analyst build on that core. The command line and file formats follow semantic versioning from here on. See the CHANGELOG, the threat model and the roadmap.
pipx install prohori # or: pip install prohori
prohori demoThe demo simulates an account takeover, an SSH brute force and a web scan, triages each one
offline and writes an HTML report per incident to prohori-demo/. It needs no configuration and
sends nothing over the network. Sample reports: Markdown,
HTML (download and open it) and
redacted.
- What it does
- Install
- Quick start
- Example: an account takeover
- Commands
- Built-in detection rules
- How well the rules work
- Machine learning
- Streaming pipeline
- LLM analyst (optional)
- Performance
- Privacy and safety
- Documentation
- Limitations
- Roadmap
- Development
flowchart LR
A[Log files<br>auth.log, nginx, app JSON] --> B[parse<br>common event schema]
B --> C[detect<br>21 YAML rules<br>+ anomaly detectors]
C --> D[incidents<br>group, score, ATT&CK]
E[enrich<br>GeoLite2, AbuseIPDB, VirusTotal] --> D
D --> F[report<br>Markdown, HTML, JSON, CSV]
| Stage | Today |
|---|---|
| Parse | Linux auth.log (sshd, sudo, PAM), nginx/Apache access logs, application security events (JSON Lines), and since 1.2 Suricata eve.json, Zeek conn.log, Windows Security and Sysmon events (Winlogbeat, NXLog or PowerShell JSON, event XML, native .evtx with the evtx extra) and the systemd journal (journalctl -o json), and any JSON Lines layout through a YAML field mapping, into one typed event schema. Format detection, streaming with bounded memory, hostile input handled (oversized lines, bad encodings, control characters). Daylight-saving changes handled: the hour repeated when the clocks go back keeps moving forward instead of being dropped as late. |
| Detect | 37 readable YAML rules (Sigma-inspired) with field modifiers, thresholds, distinct counts, ratios, sliding and tumbling windows and ordered sequences. Every rule ships with test fixtures and a runbook; regular expressions run on RE2, so no pattern can hang a run. With --models, anomaly detectors (robust z-score, Isolation Forest) also flag source IPs that behave unlike the rest of the log. SSH attacks are counted even when sshd logs host names instead of addresses (UseDNS), and a log with millions of alerts stays bounded in memory: the table shows the first 100, JSON streams every alert, and incidents keep a capped number. Known-benign activity is silenced with a reviewed suppressions file (reason, owner and expiry date per entry; allow-listed addresses): suppressed alerts are counted and listed, never dropped, and never hide another alert of an incident. |
| Enrich | IP geolocation, network owner and reputation from local GeoLite2 files, AbuseIPDB and VirusTotal, all optional. SQLite cache, daily budgets, rate limiting and bounded retries. Private and documentation addresses never leave the machine. |
| Incidents | Related alerts (same IP, account, request or session within a time gap) become one incident with a points-based score you can read line by line, severity, confidence, MITRE ATT&CK v20.0 mapping, a timeline, recommended actions and stated limitations. Detects sign-ins from an IP or app new to the account. |
| Simulate | Ten labelled attack scenarios (SSH brute force, password spraying, credential stuffing, token reuse, account takeover, web scanning, injection, admin misuse, Windows remote-desktop sign-ins, a Windows workstation intrusion seen by Sysmon) hidden in realistic background activity, byte-identical for a seed, documentation IP addresses only. Used to measure every rule's precision and recall. |
| Report | Markdown, a self-contained HTML page, JSON or a CSV timeline, with an appendix of input and rule-file SHA-256 hashes. --redact replaces account names, ids and emails (and optionally IPs) with keyed pseudonyms, and refuses to write a report that would still leak one. |
| Stream | The same parsers, rules and incident builder, continuously: lite mode in one process with DuckDB (no Docker), or a Docker stack with Redpanda, one container per stage and a PostgreSQL warehouse. Follow live logs through rotation or replay files, with at-least-once delivery, dead letters and each row stored once. |
Prohori only recommends actions. It never blocks addresses, disables accounts or touches remote systems.
Prohori needs Python 3.11 or newer. CI tests it on Linux and Windows (Python 3.11 to 3.14) and on macOS (Python 3.13), and every release is installed and its demo run on all three.
- From PyPI:
pipx install prohoriputs theprohoricommand in its own environment;pip install prohoriworks in any virtual environment. Optional parts are extras:pip install "prohori[geoip]"for local GeoLite2 files,pip install "prohori[ml]"for the machine-learning code (scikit-learn, pandas, pyarrow),pip install "prohori[pipeline]"for the streaming pipeline (DuckDB, confluent-kafka, psycopg),pip install "prohori[llm]"for the Gemini provider of the LLM analyst (google-genai),pip install "prohori[evtx]"for native Windows.evtxfiles (evtx), andpip install "prohori[all]"for all of them. The base install never needs them. - As a Docker image:
docker run --rm ghcr.io/utshabasak/prohori:latest demoruns the same command line with the pipeline extra, for linux/amd64 and linux/arm64. Mount a folder to read your own logs:docker run --rm -v "$PWD:/data" ghcr.io/utshabasak/prohori triage /data/auth.log. - From source: install uv, then
git clone https://github.com/UtshaBasak/Prohori.git && cd Prohori && uv sync, and run commands asuv run prohori .... The sample files used below are in the repository.
Official builds come only from this repository's releases, PyPI (prohori) and
ghcr.io/utshabasak/prohori, each with a signed provenance attestation and, from 1.1, a signed
CycloneDX SBOM (software bill of materials) of what it contains;
docs/RELEASING.md shows how to check a download.
Everything below runs offline on the synthetic samples in the repository (run from a clone).
uv run prohori triage samples/logs/account-takeover.jsonl -o triage/ # the whole pipeline
uv run prohori parse samples/logs/auth.log # normalise a log
uv run prohori detect samples/logs/auth.log # run the 37 rules
uv run prohori enrich 203.0.113.7 --offline # look up an IP (demo data)
uv run prohori incidents samples/logs/account-takeover.jsonl # group alerts into incidents
uv run prohori report samples/incidents/INC-ee7c8818fbb34989.json -f html -o report.html
uv run prohori simulate account-takeover --seed 1 --out out/ # your own labelled attackprohori triage writes triage/summary.md, triage/incidents.jsonl and an HTML report per
incident. Open a report in a browser: one file, no scripts, no external resources. For your own
logs, prohori triage /var/log/auth.log --year 2026 -o triage/ works the same way (add
--redact-ips before sharing the output).
samples/logs/account-takeover.jsonl is a synthetic attack on a web shop account: 12 wrong passwords from one IP in 33 seconds, a successful sign-in, two-step verification switched off and the bKash payout number changed. Prohori raises 4 alerts and joins them into one critical incident:
INC-ee7c8818fbb34989 critical score 100
title Successful sign-in after many failures from one IP and 3 related alerts
time (UTC) 2026-10-24 21:10:00 - 2026-10-24 21:13:10
confidence high
rules PRH-ACCT-001, PRH-AUTH-001, PRH-AUTH-003
entities source.ip: 203.0.113.7
user.email_hash: 0cc175b9c0f1b6a831c399e269772661
user.id: u-2001
Every point of the score is explained (from prohori report):
| Points | Reason |
|---|---|
| +50 | Most severe alert: PRH-AUTH-003 (critical) |
| +20 | 2 more rules fired: PRH-ACCT-001, PRH-AUTH-001 |
| +20 | A sign-in succeeded after failed attempts |
| +15 | Sensitive account or admin change: account.2fa.disabled, account.bkash.changed |
| +20 | Reputation of 203.0.113.7: abuse confidence 97; 9 vendors flag it as malicious (from bundled demo data) |
| +10 | Sign-in to u-2001 from 203.0.113.7, an IP not seen for this account before (1 earlier IP) |
| +5 | Sign-in to u-2001 with client web, not seen for this account before |
| -40 | Capped at 100 |
| 100 | Total |
The report adds the timeline, the IP's enrichment, the ATT&CK techniques (T1078 Valid Accounts, T1098 Account Manipulation, T1110 Brute Force, T1110.001 Password Guessing, T1556.006 Multi-Factor Authentication), recommended actions from the runbooks and the limitations, such as "single log source" and "enrichment is bundled demo data".
To see it yourself: uv run prohori incidents samples/logs/account-takeover.jsonl and
uv run prohori report samples/incidents/INC-ee7c8818fbb34989.json.
| Command | What it does | Docs |
|---|---|---|
prohori demo |
Simulate attacks, triage them and show the results; no configuration, offline | CLI.md |
prohori triage FILE |
Log in, incidents and a report per incident out (--format, --redact, --online) |
CLI.md |
prohori parse FILE |
Parse and normalise a log; table or JSON Lines | PARSERS.md |
prohori detect FILE |
Run the 37 built-in rules (and --rules DIR, --models for the anomaly detectors, --suppressions FILE for reviewed exceptions); exit code 3 when alerts are found |
RULES.md |
prohori rules list / validate / test |
Show, check and test detection rules; validate --suppressions FILE checks a suppressions file |
RULES.md |
prohori enrich IP... |
Geolocation and reputation; --offline never uses the network |
ENRICHMENT.md |
prohori incidents FILE |
Parse, detect and group alerts into scored incidents; offline enrichment unless --online |
INCIDENTS.md |
prohori report INCIDENT |
Render an incident as md, html, json or csv; --redact, --redact-ips |
REPORTS.md |
prohori explain INCIDENT |
Explain an incident with an LLM; off by default, redacted before sending, --show-payload to check first; llm extra |
LLM_ANALYST.md |
prohori ask "QUESTION" |
Answer from ATT&CK and the runbooks (and an incident with -f); offline it shows the best sources; answers citing unknown values are rejected |
LLM_ANALYST.md |
prohori simulate SCENARIO --out DIR |
Write a labelled attack scenario (--list, --seed, --variant heldout, --set) |
SIMULATOR.md |
prohori score FLOWS --model NAME |
Score a CSV of network flows with a saved model; needs the ml extra (--fpr, --top, -f json) |
CLI.md |
prohori pipeline replay FILE... / tail FILE... |
Stream log files through the lite pipeline into DuckDB, or with --bootstrap into the Docker stack; tail follows live logs until Ctrl+C; needs the pipeline extra |
PIPELINE.md |
prohori pipeline up / status / down |
Start, check and stop the Docker stack (Redpanda, PostgreSQL, one container per stage); needs Docker and a clone | PIPELINE.md |
prohori version |
The version, ATT&CK release and built-in rule set |
Commands that take a file also read standard input with -, and every command has --help.
Exit codes are the same everywhere: 0 nothing found, 3 alerts or incidents found
(--exit-zero turns this off for CI pipelines), 1 nothing could be processed and 2 invalid
usage. The full reference is docs/CLI.md.
| Rule | Detects | Severity | ATT&CK |
|---|---|---|---|
| PRH-AUTH-001 | Brute-force sign-in attempts from one IP | high | T1110, T1110.001 |
| PRH-AUTH-002 | Password spraying or credential stuffing from one IP | high | T1110.003, T1110.004 |
| PRH-AUTH-003 | Successful sign-in after many failures from one IP | critical | T1110, T1078 |
| PRH-AUTH-004 | Account lockouts across many accounts | high | T1110 |
| PRH-AUTH-005 | Failed sign-ins for one account from many addresses | high | T1110, T1110.001 |
| PRH-AUTH-006 | Slow password guessing on one account | high | T1110, T1110.001 |
| PRH-AUTH-007 | Failed sign-ins for many accounts from one network | medium | T1110.003 |
| PRH-AUTH-008 | Failed sign-ins for many accounts from many addresses | high | T1110.004 |
| PRH-AUTH-009 | Sign-ins for unknown accounts from many addresses | medium | T1110.004 |
| PRH-AUTH-010 | Successful sign-in after many failures on one account | critical | T1110, T1078 |
| PRH-SESS-001 | Refresh-token reuse | high | T1528, T1550.001 |
| PRH-ACCT-001 | Sensitive account change shortly after sign-in | high | T1098, T1556.006 |
| PRH-AUTHZ-001 | Authorisation denials across many resources | medium | T1595.003 |
| PRH-ABUSE-001 | Rate-limit bursts or bot-check failures from one IP | medium | T1499.002 |
| PRH-ADMIN-001 | Admin role granted | high | T1098 |
| PRH-ADMIN-002 | Admin action at an unusual hour (22:00-07:00 local time) | medium | T1078 |
| PRH-WEB-001 | Web scanning from one IP | medium | T1595.003 |
| PRH-WEB-002 | Injection patterns in request paths | medium | T1190 |
| PRH-WEB-003 | Scanner or empty user agent at a high request rate | medium | T1595.002 |
| PRH-WEB-004 | Probes for sensitive files and admin tools | medium | T1595.003 |
| PRH-SSH-001 | SSH invalid-user storm or repeated authentication-limit disconnects | high | T1110, T1110.001 |
| PRH-IDS-001 | Suricata alert, severity 1 (passed through) | high | from the signature |
| PRH-IDS-002 | Suricata alert, severity 2 (passed through) | medium | from the signature |
| PRH-IDS-003 | Suricata alert, severity 3 or above (passed through) | low | from the signature |
| PRH-NET-001 | Port scan: 25 ports from one address in 5 minutes | medium | T1046, T1595 |
| PRH-NET-002 | Large outbound transfer (500 MB in one connection) | medium | T1048 |
| PRH-NET-003 | Long outbound connection (8 hours) | low | T1071 |
| PRH-WIN-001 | Windows sign-in failures from one source (10 in 5 minutes) | high | T1110, T1110.001 |
| PRH-WIN-002 | Windows sign-in failures for 5+ accounts from one source | high | T1110.003 |
| PRH-WIN-003 | Windows sign-in after 5+ failures from the same source | critical | T1110, T1078 |
| PRH-WIN-004 | Account added to a Windows administrators group | high | T1098, T1098.007 |
| PRH-WIN-005 | Windows Security log cleared (experimental) | high | T1685.005 |
| PRH-WIN-006 | Windows lockouts of 3+ accounts in 15 minutes (experimental) | high | T1110 |
| PRH-PROC-001 | PowerShell started with an encoded command | high | T1059.001, T1027.010 |
| PRH-PROC-002 | An Office application or browser started a shell or script host | high | T1204.002, T1059, T1566.001 |
| PRH-PROC-003 | New Windows service (registry ImagePath or sc.exe create) |
medium | T1543.003 |
| PRH-PROC-004 | lsass memory read by an unusual process, or the SAM hive saved | critical | T1003, T1003.001 |
The host rules (PROC, since 1.2) use Sysmon and Windows 4688 process events and are measured on
the simulator's windows-intrusion scenario. The Windows rules (WIN, since 1.2) are measured on
the simulator's windows-signin scenario,
except PRH-WIN-005 and PRH-WIN-006, which it does not exercise. The network rules (IDS and NET,
since 1.2) are experimental: the simulator writes no network
traffic, so their false positives are not measured yet. The passthrough rules keep the
signature's own MITRE metadata in the event instead of claiming a technique.
ATT&CK tags are verified against the official Enterprise ATT&CK v20.0 data. Each rule has a
runbook in src/prohori/runbooks/. Writing your own rules is covered in
docs/RULES.md.
prohori simulate writes each attack scenario in three variants: default, the attack the
rules were designed for; held-out, the same attack done the way a careful attacker would
(slower, from more addresses, with a browser user agent, obfuscated, or at another hour); and
held-out 2, slower still, from twice the addresses spread over several networks.
scripts/evaluate_rules.py runs all rules over five seeds of each and compares the alerts with
the line labels.
Evasion-resistant rules (1.1). The 1.0 rules all counted per source address, so slow or spread-out attacks slipped through: held-out credential stuffing was missed in every run. Six new rules count per account, per network and per log, with thresholds fixed at twice the benign maximum before any held-out run was scored. Credential stuffing is now caught in every held-out run, with no new false positives anywhere; spraying spread over many networks is still missed. Step 28c then fixed the simulator itself: every customer had shared one /24, which hid password spraying from one provider network under the benign background. With customers spread over many networks (address model 2), all rule sets were scored again, the thresholds derived again by the same rule, and the per-network rule (PRH-AUTH-007) now catches that spraying in every held-out run. The method and its limits are in the case study. Before (the frozen 1.0 and step-28b rules) and after, on address model 2:
Generated from results/rules_eval.json, simulator address model 2: the frozen baselines (1.0 rules (addresses 2): 15 rules; 1.1 rules, step 28b (addresses 2): 21 rules) against today's 37 rules, 5 seeds per variant. Attacks caught by at least one of their expected rules. Do not edit by hand.
| Scenario | Held-out: 1.0 rules (addresses 2) | Held-out: 1.1 rules, step 28b (addresses 2) | Held-out: now | Held-out 2: 1.0 rules (addresses 2) | Held-out 2: 1.1 rules, step 28b (addresses 2) | Held-out 2: now |
|---|---|---|---|---|---|---|
| account-takeover | 5/5 | 5/5 | 5/5 | 5/5 | 5/5 | 5/5 |
| admin-misuse | 5/5 | 5/5 | 5/5 | 5/5 | 5/5 | 5/5 |
| credential-stuffing | 0/5 | 5/5 | 5/5 | 0/5 | 5/5 | 5/5 |
| injection | 5/5 | 5/5 | 5/5 | 5/5 | 5/5 | 5/5 |
| password-spraying | 5/5 | 5/5 | 5/5 | 0/5 | 0/5 | 0/5 |
| ssh-bruteforce | 5/5 | 5/5 | 5/5 | 5/5 | 5/5 | 5/5 |
| token-reuse | 5/5 | 5/5 | 5/5 | 5/5 | 5/5 | 5/5 |
| web-scanning | 5/5 | 5/5 | 5/5 | 5/5 | 5/5 | 5/5 |
| All attacks | 35/40 | 40/40 | 40/40 | 30/40 | 35/40 | 35/40 |
| False-positive alerts on benign lines | 277 | 277 | 277 | 274 | 274 | 274 |
Default variants: 40/40 attacks caught with 295 false-positive alerts (1.0 rules (addresses 2)); 40/40 attacks caught with 295 false-positive alerts (1.1 rules, step 28b (addresses 2)); 40/40 attacks caught with 295 false-positive alerts (now).
Scenarios added after the baselines were frozen are left out of this comparison, so its totals stay comparable: windows-intrusion, windows-signin (see the per-scenario results in docs/SIMULATOR.md).
For reference, the same comparison on address model 1 (frozen, not comparable with the table above: the simulator's background was different):
| Scenario | Held-out: 1.0 rules (addresses 1) | Held-out: 1.1 rules, step 28b (addresses 1) | Held-out 2: 1.0 rules (addresses 1) | Held-out 2: 1.1 rules, step 28b (addresses 1) |
|---|---|---|---|---|
| account-takeover | 5/5 | 5/5 | 5/5 | 5/5 |
| admin-misuse | 5/5 | 5/5 | 5/5 | 5/5 |
| credential-stuffing | 0/5 | 5/5 | 0/5 | 5/5 |
| injection | 5/5 | 5/5 | 5/5 | 5/5 |
| password-spraying | 5/5 | 5/5 | 0/5 | 0/5 |
| ssh-bruteforce | 5/5 | 5/5 | 5/5 | 5/5 |
| token-reuse | 5/5 | 5/5 | 5/5 | 5/5 |
| web-scanning | 5/5 | 5/5 | 5/5 | 5/5 |
| All attacks | 35/40 | 40/40 | 30/40 | 35/40 |
| False-positive alerts on benign lines | 259 | 259 | 287 | 287 |
Default variants: 40/40 attacks caught with 295 false-positive alerts (1.0 rules (addresses 1)); 40/40 attacks caught with 295 false-positive alerts (1.1 rules, step 28b (addresses 1)).
Expected rules that still miss (runs missed):
- Held-out,
account-takeover: PRH-ACCT-001 2/5, PRH-AUTH-001 5/5, PRH-AUTH-010 5/5 - Held-out,
admin-misuse: PRH-ADMIN-002 5/5 - Held-out,
credential-stuffing: PRH-AUTH-001 5/5, PRH-AUTH-002 5/5, PRH-AUTH-003 5/5 - Held-out,
password-spraying: PRH-AUTH-001 5/5 - Held-out,
ssh-bruteforce: PRH-AUTH-001 5/5, PRH-AUTH-005 5/5 - Held-out,
web-scanning: PRH-WEB-003 5/5 - Held-out,
windows-intrusion: PRH-PROC-001 5/5, PRH-PROC-002 5/5, PRH-PROC-003 5/5 - Held-out,
windows-signin: PRH-WIN-001 5/5, PRH-WIN-002 5/5 - Held-out 2,
account-takeover: PRH-ACCT-001 2/5, PRH-AUTH-001 5/5, PRH-AUTH-010 5/5 - Held-out 2,
admin-misuse: PRH-ADMIN-002 5/5 - Held-out 2,
credential-stuffing: PRH-AUTH-001 5/5, PRH-AUTH-002 5/5, PRH-AUTH-003 5/5 - Held-out 2,
password-spraying: PRH-AUTH-001 5/5, PRH-AUTH-002 5/5, PRH-AUTH-007 5/5 - Held-out 2,
ssh-bruteforce: PRH-AUTH-001 5/5 - Held-out 2,
web-scanning: PRH-WEB-003 5/5 - Held-out 2,
windows-intrusion: PRH-PROC-001 5/5, PRH-PROC-002 5/5, PRH-PROC-003 5/5 - Held-out 2,
windows-signin: PRH-WIN-001 5/5, PRH-WIN-002 5/5
PRH-ACCT-001 has low precision on purpose: it flags every sensitive change soon after a sign-in, including the owners' own. These are synthetic results written by the rules' author; the full per-rule table and caveats are in docs/SIMULATOR.md.
Suppressions (1.1). Exceptions for one site go in a suppressions file rather than in the
rules. Every entry has a reason, an owner and an expiry date, and silences an alert only when
all of the alert's events match it; suppressed alerts are still written, counted per entry and
kept out of incidents. The example file, samples/suppressions.yml,
silences the simulated shop's planned admin role grant:
prohori rules validate --suppressions samples/suppressions.yml
prohori incidents app.jsonl --suppressions samples/suppressions.ymlScored on the same detections with and without it (results/rules_eval.json), PRH-ADMIN-001's
precision goes from 0.5 to 1.0 in every variant, no true positive is lost and every attack is
still detected. The owners' own setting changes are not suppressed: in the simulator only the
attacker's network tells them apart, and an exception built on that would encode the answer.
See docs/RULES.md.
Two tracks, both evaluated the way a SOC would judge them: how many attacks are caught for how many false alerts, never accuracy.
--models on detect, incidents and triage cuts the parsed events into five-minute windows
per source IP, computes thirteen behaviour features (sign-in attempts and failures, accounts and
paths touched, 4xx share, path entropy, user-agent diversity, new clients, night activity) and
flags windows that are unusual for that log: a robust z-score (base install) and an Isolation
Forest (ml extra). Their alerts are marked detector_kind: model, explained with numbers only,
and join the incidents. Compared with the rules on the simulator's held-out attacks:
| Detector | Attacks caught | Precision | False alerts a run | Caught only by it |
|---|---|---|---|---|
| Detection rules (any rule) | 40/40 | 45 % | 6.92 | - |
| Robust z-score | 20/40 | 97 % | 0.05 | 0 |
| Fixed thresholds | 10/40 | 100 % | 0.0 | 0 |
| Isolation Forest | 17/40 | 97 % | 0.03 | 0 |
Held-out variants, seeds 1 to 5; an attack is caught when a true-positive alert is credited to it. Any rule counts here, which is why the rules catch one attack more than in the expected-rule count above.
The detectors catch the loud attacks (brute force, scanning, injection) with almost no false alerts, but nothing the rules miss: a slow or spread-out attack looks ordinary in a five-minute window from one address. They are a quiet second signal, not a new way to find attacks. Details and the false alerts' causes: docs/ANOMALY.md.
Intrusion-detection models trained on two public network-flow datasets, UNSW-NB15 and the improved CIC-IDS-2017:
- Leakage-controlled data. Identifier, address, port, time and label-derived columns are dropped; duplicates and contradictory rows are removed; test rows that also occur in training are removed and counted; transforms are learned from training data only. DATASETS.md has the numbers.
- Two models: gradient boosting (supervised) and an Isolation Forest trained on benign traffic only.
- Honest metrics. Thresholds are chosen for a 1 % or 0.1 % false-positive rate on a validation split made of time blocks the training data does not touch (since 1.1), then frozen; the test split is scored once per seed. Reported: PR-AUC, recall, the false-positive rate actually reached on test, false alerts per 10,000 flows and recall per attack class, as mean and standard deviation over three seeds. Never accuracy. Every run also measures how well each way of choosing thresholds holds on test (the calibration study).
- Model files without pickle. Saved models are skops files, loaded only into the types a
model needs, after checking their SHA-256 (optionally against
prohori score --sha256) and the library versions they were made with. 1.0 pickle models still load, through an allowlist.
| Dataset | Model | PR-AUC | Recall | Test FPR | False alerts / 10k |
|---|---|---|---|---|---|
| unsw-nb15 | Gradient boosting (supervised) | 0.950 | 24.72 % | 0.03 % | 1.9 |
| unsw-nb15 | Isolation Forest (benign only) | 0.532 | 2.18 % | 0.12 % | 7.4 |
| cicids2017 | Gradient boosting (supervised) | 0.999 | 99.92 % | 0.10 % | 8.6 |
| cicids2017 | Isolation Forest (benign only) | 0.528 | 0.00 % | 0.09 % | 7.9 |
Means over seeds 0, 1, 2 on the cleaned test splits, with thresholds chosen for a 0.1 % false-positive rate on the validation split and then frozen.
What the numbers say: gradient boosting catches 25 % of UNSW-NB15's attacks at 1.9 false alerts per 10,000 flows, missing most fuzzing and analysis traffic, and on CIC-IDS-2017 catches 99.92 %, which says more about that lab dataset than about the model. Thresholds chosen on validation time blocks held on UNSW-NB15's test file (0.9 % false positives at the 1 % target); with validation rows drawn at random, as in 1.0, the same target gave 4.8 %. The Isolation Forest is not a usable detector on either dataset. Without the leakage controls the same pipeline would report a PR-AUC of 0.988 instead of 0.950 on UNSW-NB15. Cleaning removed 41 % of UNSW-NB15's 257,673 rows and 18 % of CIC-IDS-2017's 2,099,976 flows, mostly duplicates once the identifiers are gone.
Details, failure cases and limitations: docs/MODEL_CARD.md.
Do the models work on another network? Not usefully.
Trained on the 12 features both datasets share and tested on the other dataset, gradient boosting's ROC-AUC falls from 0.95 and 1.00 to 0.64 and 0.59, weak but above chance, and the threshold that gave 1 % false positives at home flags 42 % to 61 % of the other dataset's benign flows:
| Trained on → tested on | ROC-AUC, same dataset | ROC-AUC, other dataset | PR-AUC (chance), same dataset | PR-AUC (chance), other dataset | Benign flows flagged on the other dataset (1 % threshold) |
|---|---|---|---|---|---|
| unsw-nb15 → cicids2017 | 0.950 | 0.636 | 0.914 (0.33) | 0.329 (0.16) | 41.8 % |
| cicids2017 → unsw-nb15 | 1.000 | 0.590 | 0.999 (0.16) | 0.401 (0.33) | 60.5 % |
Gradient boosting, means over seeds 0, 1, 2. ROC-AUC: 0.5 is chance. PR-AUC: chance is the attack share, in brackets.
A flow model trained on one lab's traffic learns that lab. The mapping, its losses and the per-class results are in the model card.
Can the gap be closed without the target's labels?
A pre-registered study (ADR-0041) tried six low-compute ways to close the gap without target labels, and a few labelled target flows as an upper bound. Target-test ROC-AUC, means over seeds 0, 1, 2: unsw-nb15 → cicids2017: baseline 0.636, best unsupervised method per-domain quantile map 0.824 (+0.188), 100 labelled target flows 0.966, trained on the target 1.000; cicids2017 → unsw-nb15: baseline 0.590, best unsupervised method importance weighting 0.638 (+0.048), 100 labelled target flows 0.758, trained on the target 0.950. Unsupervised methods that help in both directions: per-domain quantile map. Details: model card.
uv run python scripts/download_datasets.py fetch cicids2017 # about 330 MB
uv run python -m prohori.ml.train --dataset cicids2017 --seeds 0 1 2
uv run python -m prohori.ml.transfer --seeds 0 1 2 # the cross-dataset test
prohori score flows.csv --model cicids2017/hgb-seed0 # score your own flowsprohori score reads a CSV of flows in the layout the model was trained on (CICFlowMeter output
for a CIC-IDS-2017 model) and lists the flagged flows; see docs/CLI.md.
The batch commands read a file and stop. prohori pipeline keeps going. Lite mode runs the same
parsers, rules and incident builder as a chain of consumers in one process, without Docker, and
stores everything in a DuckDB file:
pip install "prohori[pipeline]"
prohori simulate web-scanning --seed 1 --out logs # write a simulated log to replay
prohori pipeline replay logs/web-scanning.log --times 2 # replay twice: each row stored once
prohori pipeline tail /var/log/auth.log --year 2026 # follow a live log until Ctrl+C
# query the results (the DuckDB Python library is already installed with the extra):
python -c "import duckdb; print(duckdb.connect('.prohori/pipeline/prohori.duckdb', read_only=True).sql('SELECT severity, score, title FROM incidents'))"The duckdb command-line tool works too, but it must be version 2.0 or newer: the pipeline
extra writes DuckDB 2.0 files, which older tools (such as 1.5.x, still what some package managers
install) cannot open ("version number 69, but we can only read versions between 64 and 68").
Download it from duckdb.org or the
GitHub releases.
flowchart LR
T[tail / replay] -->|raw-logs| N[normalise]
N -->|events| D[detect]
D -->|alerts| I[incidents]
N & D & I --> S[(DuckDB)]
N -.->|dead-letter| S
- Same answers as batch. For every simulator scenario, the incidents the stream writes are
exactly those of
prohori incidentson the same file. That holds even when the file is replayed twice, which CI tests on Linux and Windows. - Nothing lost, nothing doubled. Delivery is at least once (publish, fsync, then commit). Every id is a hash of its content, so a replay, a redelivery or a crash mid-run adds no rows. Duplicate events are dropped before the rules, so they cannot push a threshold over its limit.
- A restart changes nothing. The detector and the incident stage keep their state in memory and rebuild it from the topics when they start. The two decisions that depend on the clock (releasing events held for reordering when the log goes quiet, and closing incidents when alerts stop) are written into the topics as small control markers, so the rebuild makes them at the same points and publishes exactly the alerts and incidents of the live run. A property test checks this over random timings on the file, memory and Kafka transports.
- Bad input is set aside. Lines no parser accepts and malformed messages go to a dead-letter table with the reason, and are counted.
- Live logs. The tailer survives rotation by rename or truncation (on Windows too, without blocking the writer's rotation) and continues where it stopped after a restart. Ctrl+C finishes cleanly.
- Honest limits. Lite mode is slower than the batch command (see
Performance) and handles a single host's logs. Its topics are not trimmed, and
--modelsstays a batch feature.
The Docker stack runs the same stages as separate containers over Redpanda (a Kafka-compatible broker), with a PostgreSQL warehouse, from a clone of the repository:
uv run prohori pipeline up # build, start and wait until every service is healthy
uv run prohori simulate web-scanning --seed 1 --out logs # write a simulated log to replay
uv run prohori pipeline replay logs/web-scanning.log --bootstrap 127.0.0.1:19092
uv run prohori pipeline status # services, health and rows in the warehouse
uv run prohori pipeline down # --volumes also deletes the data| Service | What it is | Memory limit |
|---|---|---|
redpanda |
Kafka-compatible broker, one node | 1.5 GB |
postgres |
Warehouse (raw schema) |
512 MB |
normalise, detect, incidents, sink |
One Prohori container per stage | 256-384 MB each |
The measured memory use is in docs/PIPELINE.md. A smoke test in CI starts it from empty volumes, replays a simulated attack twice and checks that the warehouse holds each event once and exactly the incidents of the batch command. Images are pinned by digest, the containers run unprivileged, and the ports are bound to 127.0.0.1 only. Since 1.1:
- Logins: Grafana (user
admin) and Airflow (userprohori) ask for a login, and Redpanda accepts only SASL/SCRAM clients with per-user permissions.pipeline upgenerates every password intopipeline/.env(git-ignored) on the first start;replay --bootstrapfinds its login there by itself. - Least privilege: the stages, dbt and Airflow connect as
prohori_app, which owns the warehouse schemas and cannot create roles, run server programs or read other databases; the superuser only initialises the database (and moves a 1.0 stack's tables to the new role on the first start). - Any password works, including
@/:#%: none is ever written into a URL. SetPROHORI_APP_DB_PASSWORDand the other passwords in the environment ofpipeline up. - Durable broker: Redpanda syncs writes to disk (no longer its developer mode), so a host crash loses no message a stage has committed past.
- Indexed dashboards: the time columns the dashboards filter are indexed, and a message the broker refuses as too large becomes a dead letter instead of a crash loop.
Details: docs/PIPELINE.md.
Warehouse models. A dbt project (pipeline/dbt/) turns the stored rows into tested tables
on either database:
- daily attack counts, alerts per rule, top source addresses and incident durations;
- rule precision and detection latency, and time to detect each simulated attack (from the simulator's labels);
- flow-model performance over time.
uv sync --group dbt
uv run python scripts/build_lite_warehouse.py --db .prohori/pipeline/prohori.duckdb
uv run dbt build --project-dir pipeline/dbt --profiles-dir pipeline/dbt # --target postgres for the stackdbt build runs 68 data-quality checks: keys, nulls, accepted values, ranges, duplicates,
cross-table consistency and future timestamps. A separate freshness check covers the inputs. On
the simulator's ten scenarios, the models' rule precision equals the simulator's own
evaluation alert for alert, which CI checks. Every attack was detected; the detection delay per
scenario is in docs/WAREHOUSE.md.
Dashboards. prohori pipeline up also starts Grafana on http://127.0.0.1:13000, with three
dashboards provisioned from pipeline/grafana/. Sign in as admin with the password
pipeline up generated into pipeline/.env (since 1.1; PROHORI_GRAFANA_ANONYMOUS=true opens
them without a login, as in 1.0):
- Overview: events, alerts and incidents over time, rule hits and top sources. It reads the raw tables, so it fills as soon as a replay is stored.
- Detection quality: rule precision, time to detect, detection latency and flow-model performance, from the dbt marts.
- Pipeline health: time since the last stored event, rows per minute and dead letters.
Grafana reads through its own database role, which can only SELECT. The smoke test runs every
panel's query through Grafana after a replay. Details: docs/DASHBOARD.md.
Scheduled jobs. prohori pipeline up --orchestration adds Airflow (http://127.0.0.1:18080)
with five DAGs:
| Job | When | What it does |
|---|---|---|
| Backfill | By hand | Replays all ten simulated scenarios with their labels, then builds the marts |
| Data quality | Hourly | dbt build with its 68 checks, and a freshness check on the events |
| Nightly evaluation | 02:00 UTC | Retrains the flow models; the run fails if recall drops below 0.62 |
| Incident digest | 06:00 UTC | The last day's incidents, rules and dead letters, as Markdown and JSON |
| Enrichment refresh | 03:30 UTC | Keeps the incident stage's enrichment cache current (offline without API keys) |
Each task runs a prohori command (pipeline digest, check-recall, refresh-enrichment) or
dbt, so every job also works without Airflow. CI imports the DAGs with Airflow on Linux and runs
each one in the stack. Details: docs/ORCHESTRATION.md.
prohori explain and prohori ask can use a language model (Gemini, or an offline mock) to
explain an incident or answer a question from ATT&CK and the runbooks. They are off by default
and use the llm extra.
- Redacted: usernames and emails are replaced with pseudonyms, and event descriptions are never sent.
- Fenced: text from logs is marked as data.
- Checked: an answer that names an address, id, technique or link that is not in the incident or its sources is rejected, and the local summary is shown instead.
An offline evaluation scores recorded answers against hand-written references. It counts factual errors, missing indicators and whether injected instructions were followed:
31 cases: 16 attacks, 7 false positives and 8 incidents with a hidden instruction.
| Model | Recorded | Answers accepted | With a factual error | Indicators named | Points covered |
|---|---|---|---|---|---|
| Gemini (gemini-3.5-flash-lite) | 2026-11-21 | 31/31 | 0/31 | 115/115 | 91/93 |
| System | Injections the answer followed | Followed and shown to the analyst |
|---|---|---|
| Mock (a template, offline) | 0/8 | 0/8 |
| Scripted adversary (obeys every injection) | 8/8 | 3/8 |
| Gemini (gemini-3.5-flash-lite) | 0/8 | 0/8 |
4 of the 8 injected texts reached the model at all, always fenced (user agent); those in a request path or a username never did.
Details: docs/LLM_ANALYST.md.
Measured on logs of more than a million lines each, one process per run:
| Run | Lines | Lines a second | Peak memory |
|---|---|---|---|
incidents, nginx/Apache access log |
1,068,041 | 7,155 | 149 MiB |
pipeline replay (lite mode), access log |
1,068,041 | 1,894 | 1,096 MiB |
incidents, auth.log (sshd) |
1,000,591 | 10,009 | 180 MiB |
incidents, JSON Lines app log |
1,036,150 | 6,238 | 245 MiB |
One run each on Windows 11 with 12 logical CPUs, Python 3.13.14, offline enrichment; prohori demo took 1.5 s. The batch command peaked at 245 MiB.
How it is measured and what the numbers mean: docs/PERFORMANCE.md.
- Offline by default. Nothing leaves the machine unless you configure API keys and, for
incidents, pass
--online. The LLM analyst (prohori explain) is off unless you setPROHORI_LLM_PROVIDER; when on, it sends a redacted summary of one incident, and on Gemini's free tier Google may use what is sent (docs/LLM_ANALYST.md). Tests block real network access. - Private, reserved and documentation IP addresses are never sent to outside services, even when keys are configured. VirusTotal keeps the addresses it is asked about, so querying is a deliberate choice.
- Logs are untrusted input. Parsers cap line lengths and strip control characters; reports escape every value for their format (HTML, Markdown, CSV formulas) and are tested with hostile input.
- Shareable reports.
--redact/--redact-ipsuse keyed pseudonyms and fail closed. - No secrets in the repository. API keys live in the environment or a git-ignored
.env; gitleaks runs on every commit and in CI. - Samples are synthetic and use documentation address ranges only. Public datasets are downloaded only on an explicit command, never committed and never fetched at import time.
Third-party data terms (MITRE ATT&CK, GeoLite2, AbuseIPDB, VirusTotal, the Gemini API) are summarised in docs/LICENSES.md.
| Document | Contents |
|---|---|
| CLI reference | Every command, the shared options, formats and exit codes |
| Architecture | Components, data flow and run modes |
| Event schema | Event, Alert and Incident fields |
| Parsers | Supported formats, options and field mappings |
| Rules | Rule format, evaluation semantics, testing and the built-in rules |
| Enrichment | Providers, privacy, cache, limits and configuration |
| Incidents | Grouping, the scoring table, confidence and limitations |
| Reports | Formats, sections, redaction and output safety |
| Simulator | Attack scenarios, labels, and rule precision and recall |
| Datasets | UNSW-NB15 and CIC-IDS-2017: getting them, licences, leakage controls |
| Model card | Flow detectors: intended use, evaluation, results, failure cases |
| Anomaly detection | --models: features, detectors, comparison with the rules, false alerts |
| Streaming pipeline | Lite mode and the Docker stack: topics, delivery guarantees, dead letters, tailing, the tables |
| Warehouse models | dbt models, data-quality checks, labels and model results, results on the simulator |
| Dashboards | The Grafana dashboards: panels, set-up, access, time range, changing a dashboard |
| Scheduled jobs | The Airflow DAGs: backfill, data quality, nightly evaluation, digest, enrichment refresh |
| LLM analyst | prohori explain and ask: what is sent, redaction, sources and tools, prompt-injection defences and answer checks, providers, limits, data-use terms |
| Performance | Throughput and peak memory on logs of a million lines, and how they are measured |
| Threat model | Assets, trust boundaries, threats, the controls for each and the residual risks |
| Decisions | Architecture decision records |
| Releasing | How releases are built, tested and published |
| Third-party terms | Data and service licences |
| Wiki | Installation, quick start and guides |
Prohori is honest about what it does not do:
- The streaming stack runs on one machine. It is a single-node broker built from a clone, with logins (Grafana, Airflow, SASL/SCRAM on Kafka) but no TLS, on 127.0.0.1 only. Prohori never blocks, disables or changes anything.
- Rules see only what the logs say. Request bodies, headers and encrypted traffic are not inspected; the web rules use the request line only.
- Thresholds can be evaded. Since 1.1 slow and distributed credential stuffing and SSH guessing are caught, but password spraying spread over many networks still is not (see How well the rules work), and every threshold was set against simulated traffic. When sshd logs host names, an attacker who controls their reverse DNS can change the name to split the count.
- Very large alert counts are trimmed.
incidentsandtriagekeep at most 1,000 alerts per rule and entities and 10,000 of each severity, and say in the incident how many more there were. A flood of medium alerts cannot crowd out a critical one, but once 10,000 alerts of one severity are kept, later alerts of that severity form no new incident (the summary counts them); thedetecttable likewise lists the hidden alerts by severity. - Some rules are noisy by design. PRH-ACCT-001 flags every sensitive change shortly after a sign-in, including the owner's own; incidents list such benign causes as limitations. A suppressions file can silence known cases, but only you know which changes were yours.
- Suppressions are only as good as their review. An entry silences what it matches until it
expires; Prohori warns about expired entries and shows every suppressed alert, but cannot tell
a careless
*entry from a careful one. - The evaluation is synthetic and written by the rules' author. Test the rules on your own logs before relying on them.
- Enrichment free tiers are small and non-commercial, and reputation data is evidence, not proof.
- Supported formats are
auth.log, nginx/Apache access logs and JSON Lines (built-in app layout or a field mapping). Windows event logs and cloud audit logs are not supported yet.
| Release | Contents | State |
|---|---|---|
| v0.1.0 | Batch core: parsers, rules, enrichment, incidents, reports, log simulator with rule evaluation, triage and demo commands |
Released |
| v0.2.0 | Machine learning: leakage-controlled intrusion detection on public flow datasets, log-derived anomaly detection, model cards | Released |
| v0.3.0 | Pipeline: streaming core and lite mode, Redpanda and PostgreSQL in Docker, dbt models and data-quality checks, Grafana dashboards, Airflow jobs; Docker image on GitHub Packages | Released |
| v1.0.0 | Optional LLM analyst: providers, redaction, explain and ask, retrieval, prompt-injection defences, answer validation and an evaluation; threat model, performance notes, completed licence notes, macOS in CI |
Released |
| v1.0.1 | Fixes from a full review: stricter redaction and answer checks, parser and output-path robustness, safer stack shutdown and Airflow parameters, signed provenance for release files | Released |
| v1.1.0 | Hardening: new licence (PolyForm Strict), deterministic stream rebuilds, evasion-resistant per-account sign-in rules with a before-and-after score, warehouse and broker hardening, safer model files, a cross-dataset generalisation study, logins for the stack, SBOMs, suppressions and allow-lists | Released |
| v1.2.0 | More log sources: Suricata, Zeek, Windows Security events, Sysmon, the systemd journal, AWS CloudTrail; a Sigma rule importer. Done so far: Suricata eve.json and Zeek conn.log with six network rules |
In progress |
| v1.3.0 to v1.7.0 | A real-time defender for your own PC: a Windows security checkup, behaviour-based detection with reversible containment, ransomware, network, spyware, boot and device defenses, a guard for AI coding agents and MCP tools, supply-chain and phishing checks, attack drills, Linux | Planned |
| v1.8.0, v2.0.0 | A desktop security assistant, web UI, package-manager installs, VS Code and browser extensions, a documentation website and a GitHub Action | Planned |
uv sync # create .venv with the package and dev tools
uv run pre-commit install # optional: run checks on every commit
uv run ruff check . # lint
uv run ruff format --check . # formatting
uv run mypy # strict type check
uv run pytest --cov # tests with coverage (kept at 85 % or more)
uv run prohori rules test # run every rule against its fixtures
uv run pytest tests/unit/ml -q # dataset and leakage tests (synthetic fixtures, no downloads)
uv run pytest tests/integration # end to end, including lite mode against the batch command
uv sync --group dbt && uv run pytest tests/integration/test_dbt.py # the dbt modelsCI runs on Linux and Windows with Python 3.11 to 3.14 and on macOS with 3.13, plus CodeQL,
secret scanning (gitleaks and GitGuardian), parser fuzzing and the OpenSSF Scorecard. Super-Linter
checks changed workflow files (actionlint) and Dockerfiles (hadolint), and Prowler scans the
Docker and Compose files for security misconfigurations (results in the Security tab). PR-Agent reviews the owner's
pull requests with the Gemini API; it only reads the diff and never edits the description.
CircleCI also runs the test suite on Linux with Smarter Testing (circleci testsuite run "pytest",
defined in .circleci/test-suites.yml), which reruns only the failed tests when a workflow is
rerun and shows results on the job's Tests tab. All GitHub Actions are pinned to commit SHAs. See
CONTRIBUTING.md for conventions; outside code contributions are not
accepted, but issues and ideas are welcome.
To report a vulnerability, see SECURITY.md.
Copyright (c) 2026 Utsha Basak. Prohori is source-available under the PolyForm Strict License 1.0.0, from version 1.1.0 onwards:
- You may read the code, and install and use the official releases for free for personal use, study, research, hobby projects and other non-commercial purposes; charities, schools, public research and government bodies may use it too.
- You may not, without written permission, copy the code into other projects, change it, publish changed or unchanged copies, or build products or services from it.
- Commercial use needs a separate licence: open an issue or contact the owner on GitHub.
Versions up to and including 1.0.1 were released under the MIT License, which still applies to copies of those versions (text). The name and logo are trademarks (TRADEMARKS.md). Third-party data, services and dependencies keep their own terms; see docs/LICENSES.md.
