trproof 0.1.0__py3-none-any.whl
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.
- trproof/__init__.py +1 -0
- trproof/cli.py +342 -0
- trproof/collectors/__init__.py +30 -0
- trproof/collectors/ad.py +873 -0
- trproof/collectors/entra.py +762 -0
- trproof/graph/__init__.py +1 -0
- trproof/graph/edges.py +219 -0
- trproof/keys/default_ed25519_priv.pem +3 -0
- trproof/keys/default_ed25519_pub.pem +3 -0
- trproof/models.py +76 -0
- trproof/report/__init__.py +1 -0
- trproof/report/html.py +222 -0
- trproof/report/signing.py +121 -0
- trproof/scoring/__init__.py +1 -0
- trproof/scoring/engine.py +50 -0
- trproof-0.1.0.dist-info/METADATA +165 -0
- trproof-0.1.0.dist-info/RECORD +21 -0
- trproof-0.1.0.dist-info/WHEEL +5 -0
- trproof-0.1.0.dist-info/entry_points.txt +3 -0
- trproof-0.1.0.dist-info/licenses/LICENSE +21 -0
- trproof-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""Weighted risk scoring engine (Phase 4)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import List
|
|
6
|
+
|
|
7
|
+
from trproof.models import AttackPath, Finding, Severity
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
SEVERITY_WEIGHTS = {
|
|
11
|
+
Severity.HIGH: 10,
|
|
12
|
+
Severity.MEDIUM: 4,
|
|
13
|
+
Severity.LOW: 1,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
_SEVERITY_ORDER = {
|
|
17
|
+
Severity.CRITICAL: 0,
|
|
18
|
+
Severity.HIGH: 1,
|
|
19
|
+
Severity.MEDIUM: 2,
|
|
20
|
+
Severity.LOW: 3,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def compute_verdict(findings: List[Finding], paths: List[AttackPath]) -> Severity:
|
|
25
|
+
"""Return the overall verdict using worst-first rules and a weighted score."""
|
|
26
|
+
if any(finding.severity == Severity.CRITICAL for finding in findings):
|
|
27
|
+
return Severity.CRITICAL
|
|
28
|
+
|
|
29
|
+
score = sum(SEVERITY_WEIGHTS.get(finding.severity, 0) for finding in findings)
|
|
30
|
+
score += min(15, 5 * len(paths))
|
|
31
|
+
|
|
32
|
+
high_count = sum(1 for finding in findings if finding.severity == Severity.HIGH)
|
|
33
|
+
|
|
34
|
+
if score >= 25 or high_count >= 3:
|
|
35
|
+
return Severity.HIGH
|
|
36
|
+
if score >= 8 or high_count >= 1:
|
|
37
|
+
return Severity.MEDIUM
|
|
38
|
+
return Severity.LOW
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def sort_findings(findings: List[Finding]) -> List[Finding]:
|
|
42
|
+
"""Sort findings by severity, affected count descending, then id ascending."""
|
|
43
|
+
return sorted(
|
|
44
|
+
findings,
|
|
45
|
+
key=lambda finding: (
|
|
46
|
+
_SEVERITY_ORDER[finding.severity],
|
|
47
|
+
-finding.affected_count,
|
|
48
|
+
finding.id,
|
|
49
|
+
),
|
|
50
|
+
)
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: trproof
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Read-only CLI security assessment tool for on-premises AD and Microsoft Entra ID identity attack surfaces.
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
Requires-Python: >=3.10
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: click>=8.1
|
|
10
|
+
Requires-Dist: rich>=13.7
|
|
11
|
+
Requires-Dist: ldap3>=2.9.1
|
|
12
|
+
Requires-Dist: msal>=1.28
|
|
13
|
+
Requires-Dist: requests>=2.31
|
|
14
|
+
Requires-Dist: cryptography>=42.0
|
|
15
|
+
Requires-Dist: pydantic>=2.6
|
|
16
|
+
Provides-Extra: dev
|
|
17
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
18
|
+
Requires-Dist: bandit>=1.7; extra == "dev"
|
|
19
|
+
Requires-Dist: pip-audit>=2.7; extra == "dev"
|
|
20
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
# TrProof
|
|
26
|
+
|
|
27
|
+
[](LICENSE)
|
|
28
|
+
|
|
29
|
+
**TrProof** is a read-only, command-line security assessment tool for on-premises Active Directory and Microsoft Entra ID identity attack surfaces. It runs in under 10 minutes, requires no agents, and produces a cryptographically signed, self-contained one-page report that auditors and cyber-insurance reviewers can verify offline.
|
|
30
|
+
|
|
31
|
+
## Elevator pitch
|
|
32
|
+
|
|
33
|
+
- **Zero agents, zero database.** A single lightweight CLI.
|
|
34
|
+
- **Read-only.** Never writes, modifies passwords, or disables accounts.
|
|
35
|
+
- **Offline-capable for AD.** Works against a domain controller you can reach over LDAP/LDAPS.
|
|
36
|
+
- **Hybrid.** Unifies on-prem AD and Entra ID in an in-memory shortest-path attack graph.
|
|
37
|
+
- **Auditor-ready.** Ed25519-signed JSON + self-contained HTML, verifiable with `trproof-verify`.
|
|
38
|
+
|
|
39
|
+
## Safety & Ethics
|
|
40
|
+
|
|
41
|
+
- **Read-only guarantee.** TrProof only reads directory data. It never writes, modifies passwords, disables accounts, or installs agents.
|
|
42
|
+
- **Authorization required.** You must own or have explicit written authorization to audit the target environment. The CLI prompts for confirmation unless `--yes` is supplied.
|
|
43
|
+
- **Zero telemetry.** No data is sent anywhere. Collection happens in-memory and is written only to the output files you choose.
|
|
44
|
+
- **In-memory credentials only.** Passwords and tokens are held in process memory for the duration of the scan and are never persisted to disk by TrProof.
|
|
45
|
+
|
|
46
|
+
## Quickstart
|
|
47
|
+
|
|
48
|
+
### Linux / macOS one-liner
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
curl -sSL https://raw.githubusercontent.com/ebanatrm100/trproof/main/scripts/install.sh | bash
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Windows PowerShell one-liner
|
|
55
|
+
|
|
56
|
+
```powershell
|
|
57
|
+
irm https://raw.githubusercontent.com/ebanatrm100/trproof/main/scripts/install.ps1 | iex
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### pip
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pip install trproof
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Docker
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
docker run --rm -v "$PWD:/out" trproof scan --mock --yes -o /out
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## CLI Examples
|
|
73
|
+
|
|
74
|
+
Scan on-premises AD:
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
trproof scan --ad --ldap dc01.corp.local -u audit-reader
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Scan Microsoft Entra ID:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
trproof scan --entra --tenant-id <tenant-id>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Hybrid AD + Entra scan:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
trproof scan --ad --ldap dc01.corp.local -u audit-reader --entra --tenant-id <tenant-id>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Verify a report:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
trproof-verify report.json
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Use a custom signing key:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
trproof scan --mock --yes --signing-key ./my_ed25519_priv.pem -o ./out
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Mock scan (no network):
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
trproof scan --mock --yes
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Required least-privilege permissions
|
|
111
|
+
|
|
112
|
+
### Active Directory (read-only)
|
|
113
|
+
|
|
114
|
+
| Role / Account | Permissions |
|
|
115
|
+
|---|---|
|
|
116
|
+
| Standard Domain User or dedicated `audit-reader` | Read access to AD objects (users, groups, computers, OUs, ACLs, SPNs). No write, reset, or admin rights required. |
|
|
117
|
+
| Network | LDAPS (port 636) or LDAP (port 389) read-only connectivity to a domain controller. |
|
|
118
|
+
|
|
119
|
+
### Microsoft Entra ID (read-only Microsoft Graph scopes)
|
|
120
|
+
|
|
121
|
+
| Scope | Purpose |
|
|
122
|
+
|---|---|
|
|
123
|
+
| `User.Read.All` | Read user profiles and authentication methods |
|
|
124
|
+
| `Group.Read.All` | Read group membership |
|
|
125
|
+
| `Directory.Read.All` | Read directory roles and assignments |
|
|
126
|
+
| `RoleManagement.Read.Directory` | Read privileged role assignments |
|
|
127
|
+
| `Application.Read.All` | Read service principals and app registrations |
|
|
128
|
+
|
|
129
|
+
All scopes are **read-only**. TrProof never requests write scopes.
|
|
130
|
+
|
|
131
|
+
## Sample report preview
|
|
132
|
+
|
|
133
|
+
Terminal verdict and top-5 paths:
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
┌────────────────────────────── TrProof Verdict ──────────────────────────────â”
|
|
137
|
+
│ Your identity attack surface: CRITICAL │
|
|
138
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
139
|
+
Top 5 Ways a Phished Employee Could Reach Domain Admin / Global Admin:
|
|
140
|
+
Path 1 (3 steps): j.smith (no phishing-resistant MFA) → member of 'HelpDesk' →
|
|
141
|
+
HelpDesk can reset passwords of 'svc-backup' → svc-backup is Domain Admin.
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
Signed one-page report layout:
|
|
145
|
+
|
|
146
|
+

|
|
147
|
+
|
|
148
|
+
## Prior Art & Acknowledgments
|
|
149
|
+
|
|
150
|
+
TrProof builds on the foundational work of the AD and Entra ID security assessment community. We respectfully credit:
|
|
151
|
+
|
|
152
|
+
- **PingCastle** — pioneering AD security scoring and health checks.
|
|
153
|
+
- **Purple Knight** — comprehensive AD/Entra security assessment benchmarks.
|
|
154
|
+
- **EntraFalcon** — Entra ID-focused security assessment and reporting.
|
|
155
|
+
- **Guerrilla** — identity attack-path research and tooling.
|
|
156
|
+
|
|
157
|
+
What TrProof adds:
|
|
158
|
+
|
|
159
|
+
1. **Verdict-first plain-language UX** tailored for small-business sysadmins and non-specialists.
|
|
160
|
+
2. **Cryptographically signed (Ed25519), self-contained one-page HTML/JSON report** verifiable offline via `trproof-verify` for cyber-insurance and compliance audits.
|
|
161
|
+
3. **Unified hybrid on-premises AD + Entra ID in-memory shortest-path attack graph** in a single lightweight CLI with zero database dependencies.
|
|
162
|
+
|
|
163
|
+
## License
|
|
164
|
+
|
|
165
|
+
MIT. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
trproof/__init__.py,sha256=kUR5RAFc7HCeiqdlX36dZOHkUI5wI6V_43RpEcD8b-0,22
|
|
2
|
+
trproof/cli.py,sha256=xWBhAo1xEWifkehPNKoN3bcmdG7OPoH9T7GjEQUsijs,11991
|
|
3
|
+
trproof/models.py,sha256=XCPuxzoBZXJD-foWRpgtK7WX_GcP0Y2ArTPWtPfCXBI,1759
|
|
4
|
+
trproof/collectors/__init__.py,sha256=GdIjXXmmrlXCramtqqhadMDUXDgng7rSB9dO8zw5-YU,830
|
|
5
|
+
trproof/collectors/ad.py,sha256=CTw_LGQmaeWleT8RZD_V3JO2ZzXa2DheMjkFrr8Rs6E,34875
|
|
6
|
+
trproof/collectors/entra.py,sha256=1GDGY_kYYa_QqJ9e-Vx1E4dYNkSaeA4jMLD-eWiTHig,30152
|
|
7
|
+
trproof/graph/__init__.py,sha256=LvFscCYBtUv2u5dTTWv3duMiRTy3RFTZEUg9s98WsB0,32
|
|
8
|
+
trproof/graph/edges.py,sha256=VOOtnzNR3OxwEy2mGrC7jsLgZZshxFyEpUtrkvBpDwI,8177
|
|
9
|
+
trproof/keys/default_ed25519_priv.pem,sha256=DJM1KbfMJjfINRvTRK4DKDHb_VAsFhEJgwhUbrzODq0,119
|
|
10
|
+
trproof/keys/default_ed25519_pub.pem,sha256=KlXSsvIypDdvATkMW_jeanqb9pOevJ7hkBgw0YcJ6eA,113
|
|
11
|
+
trproof/report/__init__.py,sha256=ZlT4O7yaPJTXvJ5EQu3cUu0piya9zQ2xRRk-n46JkLM,33
|
|
12
|
+
trproof/report/html.py,sha256=98iWXvs21N-vEPxScVkQC50PHivGWnvml6Xfl3Aop7s,5596
|
|
13
|
+
trproof/report/signing.py,sha256=A6dhtbMn3lbdV_SeDq9Knj41YmMMC3MqVA9A5xala4M,4337
|
|
14
|
+
trproof/scoring/__init__.py,sha256=xVK8FawFE0l1r1M1G4GQraly-G619L6MEfFPP_QNxvo,34
|
|
15
|
+
trproof/scoring/engine.py,sha256=cKaK_Y2vDajsjXhS-IDn_iryAFgVoea7-0t4jG6jW8M,1357
|
|
16
|
+
trproof-0.1.0.dist-info/licenses/LICENSE,sha256=3kcJmVlt2DtP_uYmUh9hp_lStbWmwRTiKtCjAIatJGY,1077
|
|
17
|
+
trproof-0.1.0.dist-info/METADATA,sha256=j94fKrfswm_YVeAgeXh5zGpitaDg6yURzpFs5Zq5Nq4,6840
|
|
18
|
+
trproof-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
19
|
+
trproof-0.1.0.dist-info/entry_points.txt,sha256=Uann366f3LBr33Il0ur0ZC4L9ngSn-uNouFoTefz_sM,86
|
|
20
|
+
trproof-0.1.0.dist-info/top_level.txt,sha256=q264_28J3DJ2fqZVQ84PerYszwZV0h9WVil3AwlfRVA,8
|
|
21
|
+
trproof-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 TrProof Contributors
|
|
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 @@
|
|
|
1
|
+
trproof
|