Kestrel-SGR (APCS) — Autonomous Phishing Control System
APCS is a deterministic, multi‑plane security control system that detects, analyzes, predicts, and actively neutralises social‑engineering threats (phishing, smishing, vishing) across enterprise environments.
Built on a Skill Graph Runtime (SGR) — a Directed Acyclic Graph (DAG) executor that chains perception, decision, and dominance skills with schema validation, confidence aggregation, and saga-based rollback.
Features
- Skill Graph Runtime — DAG executor with JSON schema validation and confidence aggregation
- URL Detonation Engine — Multi-link reputation analysis via CyberWatch API + local heuristics (malicious/suspicious/safe classification)
- File Upload Scanning — Upload
.eml,.txt,.msg,.htmlfiles for automatic pipeline analysis - Multi-Signal Risk Scoring — 15+ signals including URL detonation, SPF/DKIM/DMARC spoof flags, ML risk score, entity extraction, and URL suspicion analysis
- Veto Overrides — Hard deny on spoofed emails, malicious detonations, or high ML risk
- Lightweight Rego Policy Engine — Python-based OPA evaluator with runtime policy updates
- ML Scorer — Optional scikit-learn based risk estimation (displayed as ML Confidence)
- Real-Time Dashboard — Glassmorphic UI with D3.js DAG visualization, SSE live updates, replay, and analytics
- Forensic Replay — Encrypted trace store with step-by-step skill replay
- SOAR Playbooks — Action buttons to execute remediation (block, quarantine, MFA reset)
- PII Redaction — Automatic detection and redaction of PII before external processing
- RBAC — Token-based auth with Analyst and Admin roles
- Transaction Saga — Automatic rollback of side-effects on failure
- 303 passing tests — 100% line coverage across all core and skills modules
Quick Start
# One-click install (creates venv, installs deps, starts server)
.\Kestrel-sgr.ps1
# Or manually:
git clone https://github.com/rohit-barui/Kestrel-SGR.git
cd Kestrel-SGR
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt
python server.py
Open http://localhost:9090 and enter the default Analyst token:
fe12751c01c2ad2a4f99004855697e18c173cfe54fdf57436b29f2a2923946b5
Architecture
┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐
│ Perception Plane │ │ Decision Plane │ │ Dominance Plane │
│ (Ingestion, parse, │ │ (Risk scoring, │ │ (Deception, │
│ enrichment) │ │ policy evaluation) │ │ containment) │
└───────┬─────────────┘ └───────┬─────────────┘ └───────┬─────────────┘
│ │ │
└───────► SGR ◄───────────┘ │
│ │
▼ ▼
┌─────────────────┐ ┌─────────────────┐
│ Core Package │ │ Web Dashboard │
│ (engine, policy,│ │ (HTML/JS/CSS) │
│ gateway, etc) │ └─────────────────┘
└─────────────────┘
Planes
- Perception — Ingests raw payloads, extracts URLs/QR codes/passwords, enriches with WHOIS/DNS, detects typo-squatting, extracts entities, checks URL reputation via CyberWatch
- Decision — Aggregates risk from all signals, applies veto overrides, recommends actions, validates SPF/DKIM/DMARC
- Dominance — Deploys honey credentials, rewrites links, blocks IPs, quarantines emails, triggers MFA resets
DAG Flow (19 Nodes)
ingest → extract_urls → whois_lookup, enrich_dns, detect_typo_squatting,
extract_entities, enrich_external, detonate_urls,
validate_spf_dkim, scan_qr_codes,
extract_archive_password
→ ml_score → aggregate_risk → apply_veto → recommend_actions
→ deploy_honey_credentials, rewrite_links, containment_actions,
block_ip, quarantine_email, trigger_mfa_reset
API Endpoints
| Method | Path | Auth | Role | Description |
|---|---|---|---|---|
POST |
/api/scan |
Yes | Any | Run SGR pipeline on email/SMS/voice/URL payload |
POST |
/api/scan/upload |
Yes | Any | Upload .eml/.txt/.msg/.html for scanning |
POST |
/api/detonate |
Yes | Any | Batch URL/domain reputation analysis |
GET |
/api/scenarios |
Yes | Any | List preset threat scenarios |
GET |
/api/health |
No | — | Liveness probe (version, uptime) |
GET |
/api/stats |
Yes | Any | Aggregate scan statistics |
GET |
/api/trend |
Yes | Any | Risk trend data |
GET |
/api/replay/<id> |
Yes | Any | Forensic trace by scan ID |
GET |
/api/metrics |
No | — | Prometheus-compatible counters |
GET |
/api/policies |
Yes | Admin | Retrieve Rego policy |
PUT |
/api/policies |
Yes | Admin | Update Rego policy (hot-reload) |
GET |
/api/integrations |
Yes | Admin | View vault config |
PUT |
/api/integrations |
Yes | Admin | Save integration secrets |
POST |
/api/auth/login |
No | — | Validate token |
POST |
/api/auth/token/generate |
Yes | Admin | Generate new API token |
POST |
/api/action |
Yes | Any | Execute SOAR playbook action |
POST |
/api/analytics/quality |
Yes | Any | Submit false positive feedback |
GET |
/events |
No | — | Server-Sent Events stream |
GET |
/api/export/csv |
Yes | Any | Download CSV export |
GET |
/api/export/report |
Yes | Any | Download summary report |
Repository Structure
Kestrel-SGR/
├── server.py # REST API + static router
├── core/ # Core runtime (engine, policy, gateway, detonation, etc.)
├── skills/ # DAG skill nodes (perception, decision, dominance)
├── policies/ # Rego policy files
├── web/ # Dashboard frontend (HTML/JS/CSS)
├── tests/ # 303 unit tests
├── docs/ # Documentation
├── docker/ # Docker + nginx config
├── Kestrel-sgr.ps1 # One-click installer
└── requirements.txt
Documentation
| Document | Description |
|---|---|
| Architecture | HLD, LLD, data flow, core components |
| Core Package | Detailed module documentation |
| Skills Package | All 19 DAG nodes and risk scoring formulas |
| Policy Files | Rego rules and policy management |
| Web UI Guide | Dashboard features and development |
| Usage Guide | Complete walkthrough with API examples |
| Testing Guide | Test suite, coverage requirements |
| Contributing | Workflow, code style, PR checklist |
| Change Log | Version history |
License
MIT License — see LICENSE for details.
Owner
Rohit Barui — GitHub
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 kestrel_sgr-0.4.0.tar.gz.
File metadata
- Download URL: kestrel_sgr-0.4.0.tar.gz
- Upload date:
- Size: 74.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a4d23e973ef0996087ec1bedb9e1b922e83c83bbfa9ef7ad438c7a6647d1c4e7
|
|
| MD5 |
dad6c7474a6fe176eccdc8174a516af8
|
|
| BLAKE2b-256 |
0193b98a1b8a6dec100c5297d2388ae5311c6e906ece465ec0855382848c07be
|
File details
Details for the file kestrel_sgr-0.4.0-py3-none-any.whl.
File metadata
- Download URL: kestrel_sgr-0.4.0-py3-none-any.whl
- Upload date:
- Size: 56.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/7.0.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
785391c3c6286f2fb2929cc842c831f89d37c9121d331b8d47813afc31dc29b1
|
|
| MD5 |
30c01e0ec5b3a0c2e291b542bfa28826
|
|
| BLAKE2b-256 |
310b290e05a3d83d611b62c0484edd895a32f4f65566adb5da65a1bdfbfd5f7e
|