raksa-iocscan-mcp
Officialby luminariadev
README.md
# raksa-iocscan
[](https://github.com/luminariadev/raksa-iocscan/actions/workflows/ci.yml)
[](https://github.com/luminariadev/raksa-iocscan/actions/workflows/release.yml)
[](LICENSE)
[](https://www.python.org/)
[-2ea44f.svg)](pyproject.toml)
[](https://docs.oasis-open.org/sarif/sarif/v2.1.0/sarif-v2.1.0.html)
[](#mcp-server-integration-raksa-iocscan-mcp)
[](https://m8ven.ai/mcp/luminariadev/raksa-iocscan)
[](https://scorecard.dev/viewer/?uri=github.com/luminariadev/raksa-iocscan)
Fast, zero-mandatory-dependency Malware Defense & IoC Scanner written in Python (`Layer 5` of the Raksa Security Suite).
`raksa-iocscan` inspects local hosts, CI artifacts, build outputs, documents, and incident triage directories with zero external runtime requirements (`dependencies = []` in `pyproject.toml`): single-pass streaming SHA-256/SHA-1/MD5 hashing (`348.0 MB/s`), PE Imphash + pure-Python FastCDC fuzzy similarity (`IOC-004`), allowlist drift diffing (`diff-allowlist`), continuous incremental `watch` daemon with SIEM NDJSON + HTTPS webhooks + Prometheus `/metrics`, bounded PE Authenticode DER & Universal Fat Mach-O inspection (`IOC-211`), multi-stage static payload deobfuscation (`IOC-210`), static OOXML/OLE2/PDF/LNK/HTA/SVG triage (`IOC-207`..`IOC-209`), pure-Python YARA compilation with JSON rule cache (`--rules-cache`, `10.6x` warm speedup) and literal-prefiltered AST evaluation (`5,183.6 files/sec` across 26 built-in rules; `3,915.7 files/sec` across 250 rules, `pe.*`/`elf.*`/`math.entropy()` parity, plus optional `yara-x` extra), STIX 2.1/JSON/CSV IoC extraction, bounded ZIP/TAR/7z/RAR archive inspection (`IOC-401`..`IOC-404`), fail-closed `.iocscan.yml` policies, SARIF 2.1.0 / Markdown / NDJSON reporting, 14 CLI subcommands, and a 10-tool stdio MCP server.
## Key Capabilities (`v0.3.0`)
- **27 Built-In Defensive Rules (`IOC-001` through `IOC-501`)**: Mapped to NIST SP 800-83, CIS Controls v8, CWE-22/CWE-409/CWE-434, STIX 2.1, MITRE ATT&CK, and MITRE D3FEND techniques (`D3-FH`, `D3-AL`, `D3-FA`, `D3-FE`, `D3-BA`, `D3-PSA`, `D3-DA`, `D3-NCI`).
- **Pure-Python YARA Compiler, Parity & JSON Rule Cache (`IOC-101`..`IOC-103`)**: Zero-dependency lexer/parser supporting comments, `meta:`, ASCII/`wide`/`nocase`/`fullword` strings, hex wildcards/jumps/alternations, byte regexes, `uint16`/`uint32`/`filesize`, `$id at` / `$id in (..)`, `math.entropy()`, `pe.imphash()`, `pe.is_pe`, `pe.is_dll()`, `pe.machine`, `pe.number_of_sections`, `pe.is_signed`, `elf.type`, `elf.machine`, `elf.number_of_sections`, compile-time literal anchor prefiltering, SHA-256 fingerprint-verified JSON caching (`--rules-cache`), syntax verification (`verify-yara`), 26 built-in signatures with 0 false positives on source code, and cached optional `--yara-engine yara-x`.
- **Streaming Hash, Imphash, Fuzzy Similarity, Diff & Online Adapters (`IOC-001`..`IOC-004`)**: Computes SHA-256, SHA-1, and MD5 in a single `64 KiB` chunked stream; matches JSON/CSV/TXT blocklist/watchlist DBs plus PE Imphash and Gear-based FastCDC fuzzy hashes (`raksa-fzh1:*`) for mutated binary variants (`IOC-004`); generates and diffs deterministic SHA-256 allowlists (`hash-manifest` / `diff-allowlist`); and optionally queries hash-only online providers (`custom`, `malwarebazaar`, `threatfox`, `circl-nsrl`, `virustotal`) with a 6-hour disk TTL cache (`--online --online-provider`).
- **PE Authenticode DER & Universal Fat Mach-O Signing Checks (`IOC-211`)**: Bounded ASN.1 DER PKCS#7 inspection extracting signer CN/O/Country, digest OIDs (`SHA-256`..`MD5`), and countersignature/RFC-3161 timestamps, alongside Fat Mach-O (`FAT_MAGIC`/`FAT_MAGIC_64`) architecture slicing checking `LC_LOAD_DYLIB` and `LC_CODE_SIGNATURE` uniformity across `arm64`/`x86_64` slices.
- **Multi-Stage Static Payload Deobfuscator (`IOC-210`)**: Recursively decodes up to 3 layers (`256 KiB` cap, 12 unique stages) of Base64, UTF-16LE PowerShell `-EncodedCommand`, `zlib`/`gzip` streams, `\xNN` escapes, and `fromhex(...)` strings before re-scanning inner stages with YARA, IoC, and script analyzers.
- **Static Document, Legacy OLE2, PDF & Smuggling Triage (`IOC-207`..`IOC-209`)**: Analyzes OOXML `.docx`/`.docm`/`.xlsx`/`.xlsm`/`.pptx`/`.dotm` and legacy OLE2 CFBF `.doc`/`.xls`/`.ppt`/`.msi` containers (`IOC-207`) for VBA macro storage, external `.rels` attached template URLs, and DDE execution, PDFs with `#XX`-unescaped `/JavaScript`/`/OpenAction`/`/Launch`/`/EmbeddedFile` (`IOC-208`), and Windows `.lnk` shortcuts, `.hta`, and `.svg` smuggling payloads (`IOC-209`).
- **Pure-Python PE/ELF/Mach-O, Entropy & Script Analyzer (`IOC-201`..`IOC-206`)**: Audits magic-byte/extension masquerading (`IOC-202`), RWX sections/executable stacks/packer section hints (`IOC-203`), section & whole-file Shannon entropy (`IOC-201`), risky PE injection imports, Imphash & ELF memfd/ptrace symbol clusters (`IOC-204`), ASLR/NX/timestamp/overlay hygiene (`IOC-205`), and obfuscated script/dropper chains (`IOC-206`).
- **STIX 2.1 IoC Extractor (`IOC-301`..`IOC-304`)**: Extracts printable ASCII/UTF-16LE strings and refanged observables (`[.]`, `hxxp://`), suppresses version-number and private/loopback IP noise, matches STIX 2.1 / JSON / CSV / TXT feeds, and detects `.onion` / raw-IP downloader or socket persistence indicators.
- **Bounded Archive & 7z/RAR Header Scanners (`IOC-401`..`IOC-404`)**: Inspects `.zip`/`.jar`/`.whl` and `.tar`/`.tar.gz`/`.tgz` strictly in memory while blocking Zip Slip traversal (`IOC-401`), Zip Bombs exceeding size/ratio/member caps (`IOC-402`), flagged or deeply nested payloads (`IOC-403`), and pure-Python `.7z`/RAR4/RAR5 AES encryption evasion or dangerous executable entries (`IOC-404`).
- **Continuous Watch Daemon, Enterprise Policy (`IOC-501`) & Multi-Format Output**: Runs `watch` incremental filesystem monitoring with deduplicated Schema v1 SIEM NDJSON (`--siem-out`), HTTPS webhooks (`--webhook-url`), and live Prometheus `/metrics` + `/healthz` HTTP telemetry (`--metrics-addr`), alongside fail-closed `.iocscan.yml` waivers, custom regex rules (`IOC-501`), deterministic baselines, and ANSI-sanitized `table`, `json`, `sarif` 2.1.0, `markdown`, and `ndjson` reports.
- **14 CLI Subcommands & 10-Tool Stdio MCP Server**: Exposes parallel `ThreadPoolExecutor` scans and targeted triage tools over line-bounded (`2 MiB`) JSON-RPC 2.0 MCP stdio (`raksa_iocscan-0.3.0-py3-none-any.whl`: `105,643` bytes).
## Architecture
```text
+--------------------------------------------------------------------------------+
| raksa-iocscan CLI / MCP / CI |
| scan | scan-yara | watch | check-hash | diff-allowlist | inspect-binary |
| inspect-document | decode-payload | extract-iocs | hash-manifest | verify-yara |
+--------------------------------------------------------------------------------+
| | | | |
v v v v v
+-----------+ +-----------+ +-----------+ +-----------+ +-----------+
|hash_engine| |yara_engine| |static_ | |doc & | |ioc & |
|SHA256/Imp | |Prefilter +| |analyzer | |deobf | |archive |
|FastCDC/TI | |Cache/pe. | |PE/Auth/Fat| |OOXML/OLE2/| |STIX/Zip/ |
|Diff | |AST/yara-x | |ELF/Mach-O | |PDF/B64/Z | |Tar/7z/RAR |
+-----------+ +-----------+ +-----------+ +-----------+ +-----------+
|
v
+-------------------------------------------------------------------+
| scanner.py / watcher.py (ThreadPoolExecutor, --siem-out, /metrics)|
| policy.py (.iocscan.yml fail-closed waivers, IOC-501, baselines) |
| schema.py (Finding v1 + Posture 0-100) -> report.py |
+-------------------------------------------------------------------+
```
See [docs/architecture.md](docs/architecture.md) and [docs/threat-model.md](docs/threat-model.md) for component design and defensive bounds.
## Installation
### From Source / `pip` / `uv`
Requires Python `3.11` or newer (`pyproject.toml` declares zero mandatory runtime dependencies):
```bash
pip install --no-deps .
```
Optional extras (`PyYAML` for full YAML spec features, `yara-x` for native YARA acceleration, `pytest` for tests):
```bash
pip install -e ".[yaml,yara,dev]"
```
Or with `uv`:
```bash
uv tool install .
```
### Container Image (Non-Root `python:3.12-slim`)
```bash
docker build -t raksa-iocscan:v0.3.0 .
docker run --rm -v "$PWD:/workspace:ro" raksa-iocscan:v0.3.0 scan --path /workspace --fail-on low --format table
```
## Quick Start
### Unified Scan, Watch Daemon, YARA Cache, Allowlist Diff, Binary & Document Triage
```bash
# Verify clean fixture baseline (exit code 0, score 100/100 A+)
raksa-iocscan scan testdata/clean --fail-on low --format table
# Scan artifacts with custom YARA rules (cached to JSON), hash DB, IoC feed, and SARIF 2.1.0 output
raksa-iocscan scan testdata/suspicious \
--rules examples/custom-rules.yar \
--rules-cache .iocscan-rules.cache.json \
--hash-db examples/sample-ioc-feed.json \
--ioc-feed examples/sample-ioc-feed.json \
--format sarif \
--output iocscan.sarif
# Start continuous incremental watch daemon with SIEM NDJSON export and Prometheus /metrics
raksa-iocscan watch --path ./uploads --interval 2.0 \
--siem-out ./siem-alerts.ndjson \
--metrics-addr 127.0.0.1:9108
# Check a SHA-256 hash online against built-in MalwareBazaar adapter (hash-only query, 6h TTL cache)
raksa-iocscan check-hash --sha256 <64-hex-sha256> --online --online-provider malwarebazaar
# Validate YARA syntax cleanly and populate rule cache before deployment (exit 0 valid, exit 1 syntax error)
raksa-iocscan verify-yara --rules examples/custom-rules.yar --rules-cache .iocscan-rules.cache.json
# Generate and diff a SHA-256 allowlist manifest for release or host drift
raksa-iocscan hash-manifest --path ./release-dir --output allowlist.json
raksa-iocscan check-hash --path ./release-dir --allowlist allowlist.json --fail-on medium
raksa-iocscan diff-allowlist --path ./release-dir --allowlist allowlist.json --fail-on low
# Inspect PE/ELF/Mach-O/Fat headers, Authenticode DER, Imphash, FastCDC fuzzy hash, and entropy
raksa-iocscan inspect-binary --path testdata/suspicious/masquerade.pdf
# Inspect OOXML documents, legacy OLE2 (.doc/.xls), PDFs, LNK shortcuts, HTA, or SVG smuggling payloads
raksa-iocscan inspect-document --path ./invoice.doc --format json
# Statically unwrap nested Base64/UTF-16LE/zlib/hex stagers without execution
raksa-iocscan decode-payload --path ./suspicious_script.ps1 --format json
# Extract deduplicated public IP/domain/URL/hash observables as JSON
raksa-iocscan extract-iocs --path testdata/suspicious/suspicious_dropper.sh --observables
```
Observed output on `testdata/clean`:
```text
raksa-iocscan v0.3.0 | layer: ioc-defense | score: 100/100 (A+) | total: 0 (critical: 0, high: 0, medium: 0, low: 0, info: 0)
No IoC or malware indicators detected.
```
### Subcommand Reference (14 Subcommands)
| Subcommand | Purpose | Key Flags |
| --- | --- | --- |
| `scan` | Run unified hash, Imphash/fuzzy, YARA, static binary/Authenticode/Fat, doc, deobf, IoC, archive, policy scan | `--path`, `--workers`, `--rules`, `--rules-cache`, `--hash-db`, `--allowlist`, `--ioc-feed`, `--online`, `--online-provider`, `--intel-url`, `--policy`, `--baseline`, `--write-baseline`, `--entropy`, `--format`, `--fail-on`, `--output` |
| `scan-yara` | Scan paths using built-in and/or custom YARA rules (`builtin` or `yara-x`) | `--path`, `--rules`, `--rules-cache`, `--no-builtin-rules`, `--yara-engine`, `--workers`, `--policy`, `--baseline`, `--format`, `--fail-on`, `--output` |
| `watch` | Continuously monitor paths and emit deduplicated SIEM NDJSON, webhooks, and `/metrics` | `--path`, `--interval`, `--siem-out`, `--webhook-url`, `--metrics-addr`, `--once`, `--max-cycles`, plus all `scan` flags |
| `check-hash` | Verify files, directories, or a `--sha256` digest against DB/Imphash/fuzzy/allowlist/online feeds | `--path`, `--sha256`, `--hash-db`, `--allowlist`, `--online`, `--online-provider`, `--intel-url`, `--cache-dir`, `--no-cache`, `--format`, `--fail-on`, `--output` |
| `diff-allowlist` | Compare directory, file, or newer manifest against SHA-256 allowlist baseline (`IOC-003`) | `--path`, `--allowlist`, `--target-is-manifest`, `--format`, `--fail-on`, `--output` |
| `inspect-binary` | Inspect PE/ELF/Mach-O/Fat headers, Authenticode DER, Imphash, fuzzy hash, entropy, masquerading | `--path`, `--entropy`, `--workers`, `--policy`, `--baseline`, `--format`, `--fail-on`, `--output` |
| `inspect-document` | Inspect OOXML/OLE2 macros/templates/DDE, PDF active objects, LNK, HTA, SVG | `--path`, `--format`, `--fail-on`, `--output` |
| `decode-payload` | Statically decode nested Base64, UTF-16LE, zlib/gzip, and hex payloads and re-scan | `--path`, `--text`, `--rules`, `--ioc-feed`, `--max-depth`, `--format`, `--fail-on`, `--output` |
| `extract-iocs` | Extract IP/domain/URL/hash observables or evaluate STIX/JSON/CSV IoC feeds | `--path`, `--ioc-feed`, `--observables`, `--workers`, `--policy`, `--baseline`, `--format`, `--fail-on`, `--output` |
| `hash-manifest` | Generate deterministic SHA-256 allowlist JSON manifest | `--path`, `--output` |
| `verify-yara` | Validate `.yar`/`.yara` rule syntax cleanly and optionally warm JSON cache | `--rules`, `--rules-cache`, `--format` (`table` \| `json`) |
| `rules` | List all 27 built-in `IOC-*` rules and MITRE D3FEND mappings | `--format` (`table` \| `json`), `--module` (`hash` \| `yara` \| `static` \| `ioc` \| `archive` \| `policy`) |
| `mcp` | Launch stdio JSON-RPC 2.0 MCP server (10 tools) | reads stdin / writes stdout |
| `version` | Print tool, schema version (`1.0`), and layer (`ioc-defense`) | `--json` |
### Exit Codes
| Exit Code | Meaning |
| --- | --- |
| `0` | Clean run or no remaining findings meet/exceed `--fail-on` severity |
| `1` | CLI usage, file I/O, YARA syntax, online feed validation, or `.iocscan.yml` policy error |
| `2` | Detection gate breached (`>= --fail-on` severity finding remains after waivers/baseline) |
## Rule Catalog (`IOC-001` to `IOC-501`)
| Rule ID | Module | Default Severity | Standard | MITRE D3FEND | Title |
| --- | --- | --- | --- | --- | --- |
| `IOC-001` | `hash` | `critical` | NIST SP 800-83 | `D3-FH` | Cryptographic hash matches known malware blocklist |
| `IOC-002` | `hash` | `high` | NIST SP 800-83 | `D3-FH` | Cryptographic hash matches threat watchlist or online intel feed |
| `IOC-003` | `hash` | `medium` | CIS Controls v8 2.5 | `D3-AL` | File missing from expected cryptographic allowlist manifest |
| `IOC-004` | `hash` | `high` | MITRE ATT&CK / Variant Intel | `D3-FH` | PE Imphash or FastCDC fuzzy hash matches known malware family |
| `IOC-101` | `yara` | `critical` | MITRE ATT&CK / DFIR | `D3-FA` | Critical YARA rule match detected |
| `IOC-102` | `yara` | `high` | MITRE ATT&CK / DFIR | `D3-FA` | High-severity YARA rule match detected |
| `IOC-103` | `yara` | `medium` | MITRE ATT&CK / DFIR | `D3-FA` | Suspicious YARA heuristic or informational signature matched |
| `IOC-201` | `static` | `high` | OWASP MASVS / Binary Triage | `D3-FE` | High Shannon entropy indicates packed, encrypted, or obfuscated binary |
| `IOC-202` | `static` | `high` | CWE-434 / MIME Integrity | `D3-FA` | Executable file magic masquerading behind non-executable extension |
| `IOC-203` | `static` | `high` | CIS / Exploit Mitigation | `D3-BA` | Binary exposes RWX memory section, executable stack, or packer marker |
| `IOC-204` | `static` | `medium` | CWE-94 / Binary Triage | `D3-BA` | Binary imports high-risk process injection or loader API cluster |
| `IOC-205` | `static` | `low` | CIS Build Hardening | `D3-BA` | Binary lacks DEP/ASLR hardening, carries anomalous timestamp, or large overlay |
| `IOC-206` | `static` | `high` | MITRE ATT&CK T1059 | `D3-PSA` | Obfuscated script or encoded remote dropper execution chain detected |
| `IOC-207` | `static` | `high` | MITRE ATT&CK T1566 / T1204 | `D3-FA` | OOXML or legacy OLE2 document contains VBA macro storage, external template link, or DDE trigger |
| `IOC-208` | `static` | `high` | MITRE ATT&CK T1566 / T1059 | `D3-FA` | PDF document embeds active JavaScript, Launch, OpenAction, or embedded executable |
| `IOC-209` | `static` | `high` | MITRE ATT&CK T1204 / T1027 | `D3-FA` | LNK shortcut, HTA, or SVG smuggling payload embeds command or script execution |
| `IOC-210` | `static` | `high` | MITRE ATT&CK T1140 | `D3-PSA` | Multi-stage static deobfuscation uncovered hidden malicious payload |
| `IOC-211` | `static` | `medium` | MITRE ATT&CK T1553 / Code Signing | `D3-BA` | PE Authenticode signature anomaly or unsigned/tampered Mach-O slice detected |
| `IOC-301` | `ioc` | `high` | STIX 2.1 Threat Intel | `D3-DA` | Artifact embeds IPv4/IPv6 indicator matching malicious IoC feed |
| `IOC-302` | `ioc` | `high` | STIX 2.1 Threat Intel | `D3-DA` | Artifact embeds domain or URL matching malicious IoC feed |
| `IOC-303` | `ioc` | `medium` | MITRE ATT&CK T1105 | `D3-NCI` | Suspicious raw-IP download or anonymizing .onion URL embedded |
| `IOC-304` | `ioc` | `medium` | MITRE ATT&CK T1059 / T1053 | `D3-PSA` | Embedded reverse-shell or persistence command indicator detected |
| `IOC-401` | `archive` | `critical` | CWE-22 | `D3-FA` | Archive contains Zip Slip path traversal entry |
| `IOC-402` | `archive` | `high` | CWE-409 | `D3-FA` | Archive triggers decompression bomb size or compression ratio guard |
| `IOC-403` | `archive` | `high` | NIST SP 800-83 | `D3-FA` | Archive encloses suspicious executable, nested limit breach, or IoC match |
| `IOC-404` | `archive` | `high` | NIST SP 800-83 / CWE-409 | `D3-FA` | 7z or RAR archive embeds encrypted payload evasion, executable entry, or unsafe path |
| `IOC-501` | `policy` | `high` | Enterprise Custom Policy | `D3-FA` | Custom organization IoC policy rule violation detected |
## Enterprise Policy (`.iocscan.yml`)
`raksa-iocscan` discovers `.iocscan.yml` / `.iocscan.yaml` / `.iocscan.json` inside the scan root or loads `--policy <file>`. Waivers fail closed unless they specify both an audit `reason` and a future `expires_on` date:
```yaml
min_severity: low
max_file_size_mb: 50
entropy_threshold: 7.3
exclude_globs:
- "*.log"
- "dist/*"
suppressions:
- rule_id: "IOC-205"
target_contains: "legacy/signed_helper.exe"
reason: "Signed legacy internal helper binary pending vendor rebuild"
expires_on: "2027-12-31"
custom_rules:
- id: "ORG-TEST-001"
title: "Disallow unapproved staging marker in production bundle"
severity: medium
pattern: "INTERNAL_STAGING_ONLY"
path_glob: "*.txt"
remediation: "Strip internal staging markers prior to release."
```
See [examples/iocscan-policy.yml](examples/iocscan-policy.yml), [examples/custom-rules.yar](examples/custom-rules.yar), and [examples/sample-ioc-feed.json](examples/sample-ioc-feed.json).
## MCP Server Integration (`raksa-iocscan mcp`)
Connect IDE or AI security workflows directly to `raksa-iocscan` over line-bounded (`2 MiB`) stdio JSON-RPC 2.0:
```json
{
"mcpServers": {
"raksa-iocscan": {
"command": "raksa-iocscan",
"args": ["mcp"]
}
}
}
```
Registered MCP tools (10):
1. `iocscan_list_rules`: Return cataloged `IOC-*` rules (optionally filtered by module).
2. `iocscan_scan_path`: Run unified parallel IoC, YARA (with optional `rules_cache_path`), hash/Imphash/fuzzy reputation, static PE/ELF/Mach-O/Authenticode, document, deobfuscator, archive, and policy scans (with optional `online_provider`).
3. `iocscan_scan_yara`: Scan a path or inline UTF-8 text with built-in and/or custom YARA rules (`builtin` or `yara-x`, optional `rules_cache_path`).
4. `iocscan_check_hash`: Verify files, directories, or a direct SHA-256 hex digest against local hash/variant DBs, allowlists, or cached HTTPS providers (`custom`, `malwarebazaar`, `threatfox`, `circl-nsrl`, `virustotal`).
5. `iocscan_diff_allowlist`: Compare a live directory, file, or newer manifest against a SHA-256 allowlist baseline (`added`, `removed`, `modified` drift -> `IOC-003`).
6. `iocscan_inspect_binary`: Return detailed PE/ELF/Mach-O/Fat headers, Authenticode DER signer metadata, Imphash, FastCDC fuzzy hash, sections, imports, hardening, entropy, and script findings.
7. `iocscan_decode_payload`: Statically decode nested Base64, UTF-16LE, zlib/gzip, and hex payloads and inspect decoded stages for hidden threats.
8. `iocscan_inspect_document`: Statically triage Office OOXML (`.docx`/`.docm`/`.xlsx`/`.pptx`), legacy OLE2 (`.doc`/`.xls`/`.ppt`), PDFs, `.lnk` shortcuts, `.hta`, and `.svg` smuggling payloads.
9. `iocscan_extract_iocs`: Extract deduplicated public IPs, domains, URLs, and hashes from files or inline text with optional STIX/JSON/CSV feed matching.
10. `iocscan_verify_yara`: Validate `.yar`/`.yara` file, directory, or inline rule syntax before use.
## Measured Performance (`v0.3.0`)
Benchmarks measured on `windows/amd64` (`Python 3.11.9`, `11th Gen Intel(R) Core(TM) i5-11400H @ 2.70GHz`) against `v0.3.0` (`raksa_iocscan-0.3.0-py3-none-any.whl`: `105,643` bytes, zero dependencies):
| Benchmark / Workload | Latency | Throughput |
| --- | --- | --- |
| Streaming Multi-Hash (`SHA-256 + SHA-1 + MD5`, `10 MiB` file) | `28.74 ms` avg | `348.0 MB/s` |
| Pure-Python FastCDC Fuzzy Hash (`raksa-fzh1`, `1 MiB` payload) | `336.67 ms` avg | `3.0 MB/s` |
| Pure-Python YARA (`26` built-in rules, `4 KiB` buffer) | `192.9 us/scan` | `5,183.6 files/sec` |
| `250`-Rule YARA Load (`cold compile` vs `warm --rules-cache` JSON) | `38.21 ms` -> `3.61 ms` | `10.6x` speedup |
| Pure-Python YARA Prefilter (`250` anchor rules, `4 KiB` buffer) | `255.4 us/scan` | `3,915.7 files/sec` |
| Static OOXML Inspection (`inspect_document`, clean `.docx`) | `57.5 us/doc` | `17,381.9 docs/sec` |
| Static OLE2 CFBF Inspection (`inspect_document`, clean `.doc`) | `78.6 us/doc` | `12,727.9 docs/sec` |
| Live CLI MCP Stdio 50-Call Burst (`iocscan_scan_path` on `testdata/clean`, incl. spawn) | `avg 7.51 ms/call` (`375.65 ms` total) | `133.1 scans/sec` |
| Live CLI MCP Stdio 50-Call Burst (`iocscan_list_rules`, incl. spawn) | `avg 5.66 ms/call` (`283.12 ms` total) | `176.6 calls/sec` |
| Live CLI MCP Stdio 50-Call Burst (`iocscan_diff_allowlist`, incl. spawn) | `avg 6.19 ms/call` (`309.35 ms` total) | `161.6 calls/sec` |
## Scope & Boundaries
`raksa-iocscan` is designed for fast static artifact triage, CI/CD defense, continuous directory watch streaming, and AI-assisted DFIR workflows:
- All inspection is strictly static and non-executing; it covers host/CI files, PE/Authenticode/ELF/Fat Mach-O binaries, OOXML/OLE2/PDF/LNK/HTA/SVG documents, multi-stage decoded scripts, and ZIP/TAR/7z/RAR containers without acting as a kernel-level EDR driver or running samples inside a dynamic sandbox.
- Note that pure-Python 7z/RAR header inspection flags encryption evasion and unsafe paths/executables without bundling external LZMA2/RAR proprietary decompression binaries, and ASN.1 DER Authenticode inspection validates certificate structures and digest strengths deterministically offline rather than contacting external CA CRL/OCSP responders.
- The built-in pure-Python YARA engine supports literal anchor prefiltering, `$id at`/`in`, `pe.*`, `elf.*`, `math.entropy()`, hex/regex rules, and fingerprint-verified `--rules-cache` JSON persistence with zero C extensions; teams needing full native C-compiled YARA module coverage can optionally install `yara-x` (`--yara-engine yara-x`).
- Online threat intel queries (`--online`) and `watch --webhook-url` enforce HTTPS validation; online hash lookups transmit cryptographic hashes only, never raw files. See [docs/architecture.md](docs/architecture.md) and [docs/threat-model.md](docs/threat-model.md) for resource bounds.
## Raksa Security Suite
`raksa-iocscan` shares **Raksa Finding Schema v1** (`schema_version = "1.0"`) across the modular Raksa ecosystem:
- **Layer 1 (`network-defense`)**: [raksa-netguard](https://github.com/luminariadev/raksa-netguard) (Go) - Exposed port audit and real-time firewall/log anomaly detection.
- **Layer 2 (`host-hardening`)**: [raksa-hostguard](https://github.com/luminariadev/raksa-hostguard) (Rust) - Signed parallel SHA-256 FIM, Linux/SSH/Docker CIS hardening, and MCP server.
- **Layer 3 (`web-defense`)**: [raksa-webshield](https://github.com/luminariadev/raksa-webshield) (TypeScript + Go) - Web & API security auditor, semantic SQLi/XSS WAF sidecar, TypeScript SDK, and MCP server.
- **Layer 4 (`devsecops`)**: [raksa-pipeguard](https://github.com/luminariadev/raksa-pipeguard) (Go) - Secret/diff scanner, CycloneDX & SPDX SBOMs, OSV/KEV/EPSS SCA, container tarball auditor, IaC/CI linters, and MCP server.
- **Layer 5 (`ioc-defense`)**: `raksa-iocscan` (Python) - This repository.
- **Layer 6 (`observability-siem`, planned)**: `raksa-siem` (Python + Go) - Log normalizer, correlation engine, and alert router.
## License
MIT License. See [LICENSE](LICENSE).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues