khopesh-sec 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. khopesh_sec-1.2.0/LICENSE +21 -0
  2. khopesh_sec-1.2.0/PKG-INFO +156 -0
  3. khopesh_sec-1.2.0/README.md +127 -0
  4. khopesh_sec-1.2.0/khopesh/__init__.py +4 -0
  5. khopesh_sec-1.2.0/khopesh/__main__.py +6 -0
  6. khopesh_sec-1.2.0/khopesh/cli.py +383 -0
  7. khopesh_sec-1.2.0/khopesh/cve_intel.py +458 -0
  8. khopesh_sec-1.2.0/khopesh/data/cve_database.json +2627 -0
  9. khopesh_sec-1.2.0/khopesh/engines/__init__.py +1 -0
  10. khopesh_sec-1.2.0/khopesh/engines/config_engine.py +207 -0
  11. khopesh_sec-1.2.0/khopesh/engines/headers_engine.py +229 -0
  12. khopesh_sec-1.2.0/khopesh/engines/local_net_engine.py +475 -0
  13. khopesh_sec-1.2.0/khopesh/engines/netscan_engine.py +931 -0
  14. khopesh_sec-1.2.0/khopesh/engines/pcap_engine.py +199 -0
  15. khopesh_sec-1.2.0/khopesh/engines/sast_engine.py +601 -0
  16. khopesh_sec-1.2.0/khopesh/engines/sca_engine.py +521 -0
  17. khopesh_sec-1.2.0/khopesh/engines/secrets_engine.py +156 -0
  18. khopesh_sec-1.2.0/khopesh/engines/workflow_engine.py +822 -0
  19. khopesh_sec-1.2.0/khopesh/intel_updater.py +1193 -0
  20. khopesh_sec-1.2.0/khopesh/models.py +164 -0
  21. khopesh_sec-1.2.0/khopesh/orchestrator.py +172 -0
  22. khopesh_sec-1.2.0/khopesh/reporters/__init__.py +1 -0
  23. khopesh_sec-1.2.0/khopesh/reporters/html_reporter.py +235 -0
  24. khopesh_sec-1.2.0/khopesh/reporters/sarif_reporter.py +86 -0
  25. khopesh_sec-1.2.0/khopesh/reporters/sbom_reporter.py +120 -0
  26. khopesh_sec-1.2.0/khopesh/reporters/text_reporter.py +198 -0
  27. khopesh_sec-1.2.0/khopesh/suppression.py +188 -0
  28. khopesh_sec-1.2.0/khopesh/threat_intel.py +207 -0
  29. khopesh_sec-1.2.0/khopesh/versioning.py +129 -0
  30. khopesh_sec-1.2.0/khopesh_sec.egg-info/PKG-INFO +156 -0
  31. khopesh_sec-1.2.0/khopesh_sec.egg-info/SOURCES.txt +46 -0
  32. khopesh_sec-1.2.0/khopesh_sec.egg-info/dependency_links.txt +1 -0
  33. khopesh_sec-1.2.0/khopesh_sec.egg-info/entry_points.txt +2 -0
  34. khopesh_sec-1.2.0/khopesh_sec.egg-info/requires.txt +6 -0
  35. khopesh_sec-1.2.0/khopesh_sec.egg-info/top_level.txt +1 -0
  36. khopesh_sec-1.2.0/pyproject.toml +73 -0
  37. khopesh_sec-1.2.0/setup.cfg +4 -0
  38. khopesh_sec-1.2.0/tests/test_cli_and_reporters.py +157 -0
  39. khopesh_sec-1.2.0/tests/test_cve_intel.py +113 -0
  40. khopesh_sec-1.2.0/tests/test_intel_updater.py +431 -0
  41. khopesh_sec-1.2.0/tests/test_network_engines.py +352 -0
  42. khopesh_sec-1.2.0/tests/test_sast.py +175 -0
  43. khopesh_sec-1.2.0/tests/test_sca_and_config.py +223 -0
  44. khopesh_sec-1.2.0/tests/test_secrets.py +49 -0
  45. khopesh_sec-1.2.0/tests/test_suppression_and_baseline.py +116 -0
  46. khopesh_sec-1.2.0/tests/test_threat_intel_and_sbom.py +238 -0
  47. khopesh_sec-1.2.0/tests/test_versioning.py +51 -0
  48. khopesh_sec-1.2.0/tests/test_workflow_engine.py +519 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Andro Nagy
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,156 @@
1
+ Metadata-Version: 2.4
2
+ Name: khopesh-sec
3
+ Version: 1.2.0
4
+ Summary: Multi-engine security & network vulnerability scanner: IPv4/IPv6 port/service CVE scanner, CISA KEV/EPSS prioritization, SAST, Secrets, SCA, CycloneDX SBOM, GitHub Actions CI/CD, Config, PCAP forensics, Endpoint EDR, and TLS/HTTP Headers.
5
+ Author-email: Andro Nagy <andronagy48@gmail.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://andro-dev.com/
8
+ Project-URL: Repository, https://github.com/andronagy48-sudo/Khopesh
9
+ Keywords: security,vulnerability-scanner,sast,sca,cve,secrets,pcap,network-security,sarif,devsecops,soc
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Environment :: Console
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: Intended Audience :: Information Technology
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Security
20
+ Requires-Python: >=3.11
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest>=8.0; extra == "dev"
25
+ Requires-Dist: pytest-cov>=5.0; extra == "dev"
26
+ Requires-Dist: ruff>=0.6; extra == "dev"
27
+ Requires-Dist: mypy>=1.11; extra == "dev"
28
+ Dynamic: license-file
29
+
30
+ # Khopesh
31
+
32
+ [![CI](https://github.com/andronagy48-sudo/Khopesh/actions/workflows/ci.yml/badge.svg)](https://github.com/andronagy48-sudo/Khopesh/actions/workflows/ci.yml)
33
+ [![Python](https://img.shields.io/badge/python-3.11%2B-blue)](https://www.python.org/)
34
+ [![Engines](https://img.shields.io/badge/engines-9%20NetSec%20%26%20AppSec-8b5cf6)](#nine-detection-engines)
35
+ [![SARIF](https://img.shields.io/badge/output-SARIF%202.1.0%20%7C%20CycloneDX%201.5%20%7C%20HTML-0ea5e9)](#)
36
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)
37
+
38
+ **Khopesh** (`v1.2.0`) is a zero-dependency, 9-engine network, CI/CD, and application vulnerability scanner built in Python 3.11+. Point it at an **authorized IPv4/IPv6 host, CIDR subnet (up to `/16`), packet capture, web URL, or source code repository** — it discovers open ports, fingerprints services across arbitrary ports, prioritizes CVEs with **CISA KEV** and **FIRST EPSS**, audits GitHub Actions workflows, exports **CycloneDX v1.5 SBOMs**, and supports inline suppression (`# khopesh: ignore[...]`) and `--baseline` diffing for CI/CD gates.
39
+
40
+ ---
41
+
42
+ ## Nine Detection Engines
43
+
44
+ ### Network, Infrastructure & SOC Engines
45
+ 1. **Network IPv4/IPv6 Port, Service Version & Hybrid CVE Scanner (`KHOPESH-SCAN-*`):**
46
+ - Scans authorized IPv4/IPv6 hosts, hostnames, or CIDR subnets up to `/16` (IPv4) / `/112` (IPv6) with ICMP/ARP/NDP/OUI/NetBIOS/OS discovery.
47
+ - Performs **port-agnostic multi-stage probing** (server-first greeting + client-first HTTP/TLS fallback on arbitrary ports) and normalized version range comparison (SemVer, PEP 440, OpenSSH `p1`/`p2`, OpenSSL letter suffixes, `last_affected`, and `introduced_exclusive`).
48
+ - **Hybrid Vulnerability & Threat Intelligence (`cve_intel.py`, `intel_updater.py`, `threat_intel.py`):** Loads schema v2 databases refreshed from **NIST NVD CVE API 2.0**, **OSV.dev**, **CISA KEV**, and **FIRST EPSS** via `khopesh update-db` (and weekly GitHub Actions), supplemented online by live NVD CPE 2.3 and FIRST EPSS lookups with 24h local caching.
49
+ 2. **PCAP Network Traffic Forensics Engine (`KHOPESH-NET-*`):**
50
+ - Pure-Python binary `libpcap` (`.pcap` / `.cap`) parser detecting **TCP SYN port scan sweeps** (`CWE-200`), **cleartext FTP/HTTP Basic credentials** (`CWE-319`, redacted), and **SMBv1 negotiations** (`CVE-2017-0144`).
51
+ 3. **Endpoint Socket, Process, Firewall & Reverse-Shell SOC Auditor (`KHOPESH-HOST-*`):**
52
+ - White-box host endpoint auditor (`audit-host`) correlating active sockets with **Process Names & PIDs**, checking **Windows Firewall / UFW** state, flagging exposed admin/DB listeners, and detecting **Bind/Reverse Shells & C2 ports** (MITRE ATT&CK `T1059` / `T1571`).
53
+ 4. **Passive TLS & HTTP Security Headers Auditor (`KHOPESH-WEB-*`):**
54
+ - Single passive TLS & HTTP compliance check verifying TLS version, HSTS, CSP, clickjacking headers, `nosniff`, version banner disclosure, and `Set-Cookie` flags.
55
+
56
+ ### Application, Supply-Chain & CI/CD Engines
57
+ 5. **SAST Engine (`KHOPESH-SAST-*`):**
58
+ - Python AST with intraprocedural variable & taint tracking (`CWE-89`, `CWE-78`, `CWE-95`, `CWE-502`, context-aware `CWE-327`, `CWE-295`, `CWE-377`, `CWE-489`) plus a JavaScript/TypeScript lexical comment & static-literal stripper (`CWE-79`, `CWE-95`, `CWE-78`).
59
+ 6. **Secret & Shannon Entropy Engine (`KHOPESH-SEC-*`):**
60
+ - Signature + Shannon entropy detection (`CWE-798`) with automatic snippet redaction.
61
+ 7. **Dependency CVE / SCA Engine & CycloneDX v1.5 SBOM (`KHOPESH-SCA-*`):**
62
+ - Parses manifests and lockfiles (`requirements.txt`, `pyproject.toml`, `poetry.lock`, `uv.lock`, `Pipfile.lock`, `package.json`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`), queries OSV.dev with CVSS/severity extraction, enriches CVEs with CISA KEV & FIRST EPSS, and exports **CycloneDX v1.5 JSON SBOMs** (`khopesh sbom` or `--sbom`).
63
+ 8. **Container & Config Hardening Engine (`KHOPESH-CFG-*`):**
64
+ - Audits `Dockerfile`, `docker-compose.yml`, and web configs (`next.config.js`, `nginx.conf`, `vercel.json`, `netlify.toml`).
65
+ 9. **GitHub Actions CI/CD Supply-Chain Engine (`KHOPESH-GHA-*`):**
66
+ - Audits `.github/workflows/*.yml` and `action.yml` for dangerous `pull_request_target` / `workflow_run` head checkouts (`KHOPESH-GHA-001`), script injection via untrusted `${{ github.event.* }}` contexts (`KHOPESH-GHA-002`), unpinned actions/reusable workflows/Docker tags (`KHOPESH-GHA-003`), missing or `write-all` permissions (`KHOPESH-GHA-004`), `ACTIONS_ALLOW_UNSECURE_COMMANDS` (`KHOPESH-GHA-005`), `secrets: inherit` (`KHOPESH-GHA-006`), persisted checkout credentials (`KHOPESH-GHA-007`), and `self-hosted` runners exposed to PRs (`KHOPESH-GHA-008`).
67
+
68
+ ---
69
+
70
+ ## Benchmarks (Honest Measurement)
71
+
72
+ Full methodology, corpus fixtures, known biases, and miss/FP breakdowns are published in [`benchmark/README.md`](benchmark/README.md) and run weekly in [`.github/workflows/benchmark.yml`](.github/workflows/benchmark.yml).
73
+
74
+ ### SAST Corpus Results (61 Labeled Files: 48 Python, 13 JS/TS)
75
+
76
+ | Tool | Scope | Files | TP | FP | FN | Precision | Recall | F1 |
77
+ | --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
78
+ | **Khopesh v1.2.0** | All (Python + JS/TS) | 61 | 31 | 3 | 7 | **91.2%** | **81.6%** | **86.1%** |
79
+ | **Khopesh v1.2.0** | Python only | 48 | 24 | 2 | 7 | **92.3%** | **77.4%** | **84.2%** |
80
+ | Bandit 1.9.4 | Python only | 48 | 26 | 17 | 5 | 60.5% | 83.9% | 70.3% |
81
+
82
+ *Known gaps measured by the hard test cases (documented transparently):* interprocedural taint across helper returns, dict/list subscript taint, aliased imports (`from os import system as s`), insecure `random` token detection, and sanitizer recognition (`shlex.quote`, `DOMPurify.sanitize`).
83
+
84
+ ---
85
+
86
+ ## Quick Start
87
+
88
+ ### Installation
89
+
90
+ ```bash
91
+ git clone https://github.com/andronagy48-sudo/Khopesh.git
92
+ cd Khopesh
93
+ pip install -e ".[dev]"
94
+ ```
95
+
96
+ ### Usage Examples
97
+
98
+ ```bash
99
+ # 1. Refresh authoritative CVE, CISA KEV, and FIRST EPSS databases locally
100
+ khopesh update-db
101
+ khopesh db-info
102
+
103
+ # 2. Scan an IPv4/IPv6 host or CIDR subnet (up to /16) for open ports, versions, KEV/EPSS CVEs
104
+ khopesh netscan 192.168.1.10 --html net_report.html
105
+ khopesh netscan 2001:db8::1 --ports 22,80,443,8080
106
+
107
+ # 3. Scan a repository (SAST + Secrets + SCA + Config + GitHub Actions CI/CD + PCAP)
108
+ # with inline `# khopesh: ignore[RULE-ID]`, `.khopeshignore`, `--baseline`, SARIF, and CycloneDX SBOM
109
+ khopesh scan ./my-app --sarif results.sarif --sbom bom.cdx.json --fail-on high
110
+ khopesh scan ./my-app --baseline previous.json --exclude "vendor/**" --fail-on medium
111
+
112
+ # 4. Export a standalone CycloneDX v1.5 JSON SBOM
113
+ khopesh sbom ./my-app -o bom.cdx.json
114
+
115
+ # 5. Audit local endpoint sockets, PIDs, firewall state, and C2/reverse-shell indicators
116
+ khopesh audit-host --html host_edr.html
117
+
118
+ # 6. Analyze a packet capture (.pcap) or passively audit a URL's TLS & HTTP headers
119
+ khopesh pcap ./traffic.pcap --html pcap_report.html
120
+ khopesh headers https://andro-dev.com --html web_headers.html
121
+ ```
122
+
123
+ ### Use as a GitHub Action
124
+
125
+ ```yaml
126
+ - name: Run Khopesh
127
+ uses: andronagy48-sudo/Khopesh@main
128
+ with:
129
+ path: "."
130
+ fail-on: "high"
131
+ sarif-file: "khopesh.sarif"
132
+ sbom-file: "bom.cdx.json"
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Quality Gates (Lint, Strict Typecheck & Coverage)
138
+
139
+ ```bash
140
+ ruff check khopesh tests benchmark
141
+ mypy khopesh
142
+ pytest -v --cov=khopesh --cov-report=term-missing --cov-fail-under=80
143
+ ```
144
+
145
+ ---
146
+
147
+ ## Responsible Use
148
+
149
+ Khopesh is an **authorized vulnerability assessment, hardening, and SOC analysis framework**. Only run `netscan` / `headers` against hosts, lab environments, and networks that you own or have explicit permission to assess.
150
+
151
+ ---
152
+
153
+ ## Author
154
+
155
+ **Andro Nagy** — Aspiring SOC Analyst & Cybersecurity Student
156
+ Portfolio: [https://andro-dev.com/](https://andro-dev.com/) · LinkedIn: [Andro Nagy](https://www.linkedin.com/in/andro-nagy-a302b8334) · TryHackMe: [Andro48](https://tryhackme.com/p/Andro48)
@@ -0,0 +1,127 @@
1
+ # Khopesh
2
+
3
+ [![CI](https://github.com/andronagy48-sudo/Khopesh/actions/workflows/ci.yml/badge.svg)](https://github.com/andronagy48-sudo/Khopesh/actions/workflows/ci.yml)
4
+ [![Python](https://img.shields.io/badge/python-3.11%2B-blue)](https://www.python.org/)
5
+ [![Engines](https://img.shields.io/badge/engines-9%20NetSec%20%26%20AppSec-8b5cf6)](#nine-detection-engines)
6
+ [![SARIF](https://img.shields.io/badge/output-SARIF%202.1.0%20%7C%20CycloneDX%201.5%20%7C%20HTML-0ea5e9)](#)
7
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE)
8
+
9
+ **Khopesh** (`v1.2.0`) is a zero-dependency, 9-engine network, CI/CD, and application vulnerability scanner built in Python 3.11+. Point it at an **authorized IPv4/IPv6 host, CIDR subnet (up to `/16`), packet capture, web URL, or source code repository** — it discovers open ports, fingerprints services across arbitrary ports, prioritizes CVEs with **CISA KEV** and **FIRST EPSS**, audits GitHub Actions workflows, exports **CycloneDX v1.5 SBOMs**, and supports inline suppression (`# khopesh: ignore[...]`) and `--baseline` diffing for CI/CD gates.
10
+
11
+ ---
12
+
13
+ ## Nine Detection Engines
14
+
15
+ ### Network, Infrastructure & SOC Engines
16
+ 1. **Network IPv4/IPv6 Port, Service Version & Hybrid CVE Scanner (`KHOPESH-SCAN-*`):**
17
+ - Scans authorized IPv4/IPv6 hosts, hostnames, or CIDR subnets up to `/16` (IPv4) / `/112` (IPv6) with ICMP/ARP/NDP/OUI/NetBIOS/OS discovery.
18
+ - Performs **port-agnostic multi-stage probing** (server-first greeting + client-first HTTP/TLS fallback on arbitrary ports) and normalized version range comparison (SemVer, PEP 440, OpenSSH `p1`/`p2`, OpenSSL letter suffixes, `last_affected`, and `introduced_exclusive`).
19
+ - **Hybrid Vulnerability & Threat Intelligence (`cve_intel.py`, `intel_updater.py`, `threat_intel.py`):** Loads schema v2 databases refreshed from **NIST NVD CVE API 2.0**, **OSV.dev**, **CISA KEV**, and **FIRST EPSS** via `khopesh update-db` (and weekly GitHub Actions), supplemented online by live NVD CPE 2.3 and FIRST EPSS lookups with 24h local caching.
20
+ 2. **PCAP Network Traffic Forensics Engine (`KHOPESH-NET-*`):**
21
+ - Pure-Python binary `libpcap` (`.pcap` / `.cap`) parser detecting **TCP SYN port scan sweeps** (`CWE-200`), **cleartext FTP/HTTP Basic credentials** (`CWE-319`, redacted), and **SMBv1 negotiations** (`CVE-2017-0144`).
22
+ 3. **Endpoint Socket, Process, Firewall & Reverse-Shell SOC Auditor (`KHOPESH-HOST-*`):**
23
+ - White-box host endpoint auditor (`audit-host`) correlating active sockets with **Process Names & PIDs**, checking **Windows Firewall / UFW** state, flagging exposed admin/DB listeners, and detecting **Bind/Reverse Shells & C2 ports** (MITRE ATT&CK `T1059` / `T1571`).
24
+ 4. **Passive TLS & HTTP Security Headers Auditor (`KHOPESH-WEB-*`):**
25
+ - Single passive TLS & HTTP compliance check verifying TLS version, HSTS, CSP, clickjacking headers, `nosniff`, version banner disclosure, and `Set-Cookie` flags.
26
+
27
+ ### Application, Supply-Chain & CI/CD Engines
28
+ 5. **SAST Engine (`KHOPESH-SAST-*`):**
29
+ - Python AST with intraprocedural variable & taint tracking (`CWE-89`, `CWE-78`, `CWE-95`, `CWE-502`, context-aware `CWE-327`, `CWE-295`, `CWE-377`, `CWE-489`) plus a JavaScript/TypeScript lexical comment & static-literal stripper (`CWE-79`, `CWE-95`, `CWE-78`).
30
+ 6. **Secret & Shannon Entropy Engine (`KHOPESH-SEC-*`):**
31
+ - Signature + Shannon entropy detection (`CWE-798`) with automatic snippet redaction.
32
+ 7. **Dependency CVE / SCA Engine & CycloneDX v1.5 SBOM (`KHOPESH-SCA-*`):**
33
+ - Parses manifests and lockfiles (`requirements.txt`, `pyproject.toml`, `poetry.lock`, `uv.lock`, `Pipfile.lock`, `package.json`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`), queries OSV.dev with CVSS/severity extraction, enriches CVEs with CISA KEV & FIRST EPSS, and exports **CycloneDX v1.5 JSON SBOMs** (`khopesh sbom` or `--sbom`).
34
+ 8. **Container & Config Hardening Engine (`KHOPESH-CFG-*`):**
35
+ - Audits `Dockerfile`, `docker-compose.yml`, and web configs (`next.config.js`, `nginx.conf`, `vercel.json`, `netlify.toml`).
36
+ 9. **GitHub Actions CI/CD Supply-Chain Engine (`KHOPESH-GHA-*`):**
37
+ - Audits `.github/workflows/*.yml` and `action.yml` for dangerous `pull_request_target` / `workflow_run` head checkouts (`KHOPESH-GHA-001`), script injection via untrusted `${{ github.event.* }}` contexts (`KHOPESH-GHA-002`), unpinned actions/reusable workflows/Docker tags (`KHOPESH-GHA-003`), missing or `write-all` permissions (`KHOPESH-GHA-004`), `ACTIONS_ALLOW_UNSECURE_COMMANDS` (`KHOPESH-GHA-005`), `secrets: inherit` (`KHOPESH-GHA-006`), persisted checkout credentials (`KHOPESH-GHA-007`), and `self-hosted` runners exposed to PRs (`KHOPESH-GHA-008`).
38
+
39
+ ---
40
+
41
+ ## Benchmarks (Honest Measurement)
42
+
43
+ Full methodology, corpus fixtures, known biases, and miss/FP breakdowns are published in [`benchmark/README.md`](benchmark/README.md) and run weekly in [`.github/workflows/benchmark.yml`](.github/workflows/benchmark.yml).
44
+
45
+ ### SAST Corpus Results (61 Labeled Files: 48 Python, 13 JS/TS)
46
+
47
+ | Tool | Scope | Files | TP | FP | FN | Precision | Recall | F1 |
48
+ | --- | --- | ---: | ---: | ---: | ---: | ---: | ---: | ---: |
49
+ | **Khopesh v1.2.0** | All (Python + JS/TS) | 61 | 31 | 3 | 7 | **91.2%** | **81.6%** | **86.1%** |
50
+ | **Khopesh v1.2.0** | Python only | 48 | 24 | 2 | 7 | **92.3%** | **77.4%** | **84.2%** |
51
+ | Bandit 1.9.4 | Python only | 48 | 26 | 17 | 5 | 60.5% | 83.9% | 70.3% |
52
+
53
+ *Known gaps measured by the hard test cases (documented transparently):* interprocedural taint across helper returns, dict/list subscript taint, aliased imports (`from os import system as s`), insecure `random` token detection, and sanitizer recognition (`shlex.quote`, `DOMPurify.sanitize`).
54
+
55
+ ---
56
+
57
+ ## Quick Start
58
+
59
+ ### Installation
60
+
61
+ ```bash
62
+ git clone https://github.com/andronagy48-sudo/Khopesh.git
63
+ cd Khopesh
64
+ pip install -e ".[dev]"
65
+ ```
66
+
67
+ ### Usage Examples
68
+
69
+ ```bash
70
+ # 1. Refresh authoritative CVE, CISA KEV, and FIRST EPSS databases locally
71
+ khopesh update-db
72
+ khopesh db-info
73
+
74
+ # 2. Scan an IPv4/IPv6 host or CIDR subnet (up to /16) for open ports, versions, KEV/EPSS CVEs
75
+ khopesh netscan 192.168.1.10 --html net_report.html
76
+ khopesh netscan 2001:db8::1 --ports 22,80,443,8080
77
+
78
+ # 3. Scan a repository (SAST + Secrets + SCA + Config + GitHub Actions CI/CD + PCAP)
79
+ # with inline `# khopesh: ignore[RULE-ID]`, `.khopeshignore`, `--baseline`, SARIF, and CycloneDX SBOM
80
+ khopesh scan ./my-app --sarif results.sarif --sbom bom.cdx.json --fail-on high
81
+ khopesh scan ./my-app --baseline previous.json --exclude "vendor/**" --fail-on medium
82
+
83
+ # 4. Export a standalone CycloneDX v1.5 JSON SBOM
84
+ khopesh sbom ./my-app -o bom.cdx.json
85
+
86
+ # 5. Audit local endpoint sockets, PIDs, firewall state, and C2/reverse-shell indicators
87
+ khopesh audit-host --html host_edr.html
88
+
89
+ # 6. Analyze a packet capture (.pcap) or passively audit a URL's TLS & HTTP headers
90
+ khopesh pcap ./traffic.pcap --html pcap_report.html
91
+ khopesh headers https://andro-dev.com --html web_headers.html
92
+ ```
93
+
94
+ ### Use as a GitHub Action
95
+
96
+ ```yaml
97
+ - name: Run Khopesh
98
+ uses: andronagy48-sudo/Khopesh@main
99
+ with:
100
+ path: "."
101
+ fail-on: "high"
102
+ sarif-file: "khopesh.sarif"
103
+ sbom-file: "bom.cdx.json"
104
+ ```
105
+
106
+ ---
107
+
108
+ ## Quality Gates (Lint, Strict Typecheck & Coverage)
109
+
110
+ ```bash
111
+ ruff check khopesh tests benchmark
112
+ mypy khopesh
113
+ pytest -v --cov=khopesh --cov-report=term-missing --cov-fail-under=80
114
+ ```
115
+
116
+ ---
117
+
118
+ ## Responsible Use
119
+
120
+ Khopesh is an **authorized vulnerability assessment, hardening, and SOC analysis framework**. Only run `netscan` / `headers` against hosts, lab environments, and networks that you own or have explicit permission to assess.
121
+
122
+ ---
123
+
124
+ ## Author
125
+
126
+ **Andro Nagy** — Aspiring SOC Analyst & Cybersecurity Student
127
+ Portfolio: [https://andro-dev.com/](https://andro-dev.com/) · LinkedIn: [Andro Nagy](https://www.linkedin.com/in/andro-nagy-a302b8334) · TryHackMe: [Andro48](https://tryhackme.com/p/Andro48)
@@ -0,0 +1,4 @@
1
+ """Khopesh — Zero-dependency multi-engine vulnerability & network security scanner."""
2
+
3
+ __version__ = "1.2.0"
4
+ __all__ = ["__version__"]
@@ -0,0 +1,6 @@
1
+ """Allow executing Khopesh via `python -m khopesh`."""
2
+
3
+ from khopesh.cli import main
4
+
5
+ if __name__ == "__main__":
6
+ raise SystemExit(main())