hexharness 1.0.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.
- hexharness-1.0.0/LICENSE +202 -0
- hexharness-1.0.0/NOTICE +12 -0
- hexharness-1.0.0/PKG-INFO +225 -0
- hexharness-1.0.0/README.md +155 -0
- hexharness-1.0.0/hexharness/__init__.py +7 -0
- hexharness-1.0.0/hexharness/__main__.py +214 -0
- hexharness-1.0.0/hexharness/agent/__init__.py +4 -0
- hexharness-1.0.0/hexharness/agent/context.py +19 -0
- hexharness-1.0.0/hexharness/agent/loop.py +203 -0
- hexharness-1.0.0/hexharness/agent/orchestrator.py +143 -0
- hexharness-1.0.0/hexharness/agent/subagents.py +99 -0
- hexharness-1.0.0/hexharness/agent/workflow.py +118 -0
- hexharness-1.0.0/hexharness/client/__init__.py +104 -0
- hexharness-1.0.0/hexharness/control/__init__.py +32 -0
- hexharness-1.0.0/hexharness/control/budget.py +37 -0
- hexharness-1.0.0/hexharness/control/decision.py +33 -0
- hexharness-1.0.0/hexharness/control/hitl.py +41 -0
- hexharness-1.0.0/hexharness/control/kill_switch.py +64 -0
- hexharness-1.0.0/hexharness/control/plane.py +135 -0
- hexharness-1.0.0/hexharness/control/policy.py +73 -0
- hexharness-1.0.0/hexharness/control/pricing.py +30 -0
- hexharness-1.0.0/hexharness/control/roe.py +50 -0
- hexharness-1.0.0/hexharness/control/scope_guard.py +81 -0
- hexharness-1.0.0/hexharness/control/secrets.py +47 -0
- hexharness-1.0.0/hexharness/control/vault.py +125 -0
- hexharness-1.0.0/hexharness/daemon/__init__.py +154 -0
- hexharness-1.0.0/hexharness/engagement.py +99 -0
- hexharness-1.0.0/hexharness/engagement_builder.py +96 -0
- hexharness-1.0.0/hexharness/engine.py +322 -0
- hexharness-1.0.0/hexharness/events/__init__.py +5 -0
- hexharness-1.0.0/hexharness/events/bus.py +29 -0
- hexharness-1.0.0/hexharness/events/store.py +93 -0
- hexharness-1.0.0/hexharness/events/types.py +51 -0
- hexharness-1.0.0/hexharness/evidence/__init__.py +4 -0
- hexharness-1.0.0/hexharness/evidence/findings.py +43 -0
- hexharness-1.0.0/hexharness/evidence/store.py +93 -0
- hexharness-1.0.0/hexharness/knowledge/__init__.py +5 -0
- hexharness-1.0.0/hexharness/knowledge/attack.py +61 -0
- hexharness-1.0.0/hexharness/knowledge/corpus/api_testing.md +19 -0
- hexharness-1.0.0/hexharness/knowledge/corpus/credential_access.md +15 -0
- hexharness-1.0.0/hexharness/knowledge/corpus/network_recon.md +14 -0
- hexharness-1.0.0/hexharness/knowledge/corpus/privilege_escalation.md +14 -0
- hexharness-1.0.0/hexharness/knowledge/corpus/tools_analysis.md +30 -0
- hexharness-1.0.0/hexharness/knowledge/corpus/tools_evidence_reporting.md +21 -0
- hexharness-1.0.0/hexharness/knowledge/corpus/tools_exploitation.md +40 -0
- hexharness-1.0.0/hexharness/knowledge/corpus/tools_meta.md +54 -0
- hexharness-1.0.0/hexharness/knowledge/corpus/tools_osint.md +29 -0
- hexharness-1.0.0/hexharness/knowledge/corpus/tools_recon.md +56 -0
- hexharness-1.0.0/hexharness/knowledge/corpus/web_sqli.md +15 -0
- hexharness-1.0.0/hexharness/knowledge/corpus/web_ssrf.md +17 -0
- hexharness-1.0.0/hexharness/knowledge/corpus/web_xss.md +17 -0
- hexharness-1.0.0/hexharness/knowledge/corpus/workflow_chaining.md +58 -0
- hexharness-1.0.0/hexharness/knowledge/data/attack_techniques.json +699 -0
- hexharness-1.0.0/hexharness/knowledge/data/cwe.json +3878 -0
- hexharness-1.0.0/hexharness/knowledge/rag.py +80 -0
- hexharness-1.0.0/hexharness/knowledge/tool.py +47 -0
- hexharness-1.0.0/hexharness/observability/__init__.py +5 -0
- hexharness-1.0.0/hexharness/observability/otel.py +79 -0
- hexharness-1.0.0/hexharness/protocol/__init__.py +68 -0
- hexharness-1.0.0/hexharness/providers/__init__.py +27 -0
- hexharness-1.0.0/hexharness/providers/anthropic.py +116 -0
- hexharness-1.0.0/hexharness/providers/base.py +28 -0
- hexharness-1.0.0/hexharness/providers/context_window.py +42 -0
- hexharness-1.0.0/hexharness/providers/fake.py +39 -0
- hexharness-1.0.0/hexharness/providers/google.py +140 -0
- hexharness-1.0.0/hexharness/providers/ollama.py +58 -0
- hexharness-1.0.0/hexharness/providers/openai.py +207 -0
- hexharness-1.0.0/hexharness/providers/openai_compatible.py +65 -0
- hexharness-1.0.0/hexharness/providers/router.py +76 -0
- hexharness-1.0.0/hexharness/providers/types.py +91 -0
- hexharness-1.0.0/hexharness/recovery/__init__.py +5 -0
- hexharness-1.0.0/hexharness/recovery/snapshot.py +59 -0
- hexharness-1.0.0/hexharness/reporting/__init__.py +0 -0
- hexharness-1.0.0/hexharness/reporting/build.py +30 -0
- hexharness-1.0.0/hexharness/reporting/generate.py +53 -0
- hexharness-1.0.0/hexharness/reporting/model.py +95 -0
- hexharness-1.0.0/hexharness/reporting/render.py +111 -0
- hexharness-1.0.0/hexharness/reporting/templates/default.html.j2 +55 -0
- hexharness-1.0.0/hexharness/sandbox/__init__.py +3 -0
- hexharness-1.0.0/hexharness/sandbox/docker/Dockerfile +40 -0
- hexharness-1.0.0/hexharness/sandbox/executor.py +200 -0
- hexharness-1.0.0/hexharness/sandbox/image.py +47 -0
- hexharness-1.0.0/hexharness/session.py +52 -0
- hexharness-1.0.0/hexharness/skills/__init__.py +4 -0
- hexharness-1.0.0/hexharness/skills/engine.py +88 -0
- hexharness-1.0.0/hexharness/skills/library/exploitation/playbook.md +38 -0
- hexharness-1.0.0/hexharness/skills/library/exploitation/skill.yaml +6 -0
- hexharness-1.0.0/hexharness/skills/library/reverse-shell-handler/playbook.md +26 -0
- hexharness-1.0.0/hexharness/skills/library/reverse-shell-handler/skill.yaml +6 -0
- hexharness-1.0.0/hexharness/skills/library/sqli-triage/playbook.md +40 -0
- hexharness-1.0.0/hexharness/skills/library/sqli-triage/skill.yaml +6 -0
- hexharness-1.0.0/hexharness/skills/library/subdomain-enumeration/playbook.md +34 -0
- hexharness-1.0.0/hexharness/skills/library/subdomain-enumeration/skill.yaml +6 -0
- hexharness-1.0.0/hexharness/skills/library/workflow-chaining/playbook.md +67 -0
- hexharness-1.0.0/hexharness/skills/library/workflow-chaining/skill.yaml +6 -0
- hexharness-1.0.0/hexharness/skills/slash.py +39 -0
- hexharness-1.0.0/hexharness/skills/tool.py +52 -0
- hexharness-1.0.0/hexharness/tools/__init__.py +4 -0
- hexharness-1.0.0/hexharness/tools/base.py +54 -0
- hexharness-1.0.0/hexharness/tools/mcp.py +208 -0
- hexharness-1.0.0/hexharness/tools/native/__init__.py +5 -0
- hexharness-1.0.0/hexharness/tools/native/binary.py +205 -0
- hexharness-1.0.0/hexharness/tools/native/browser.py +126 -0
- hexharness-1.0.0/hexharness/tools/native/engagement_tools.py +46 -0
- hexharness-1.0.0/hexharness/tools/native/evidence_tools.py +107 -0
- hexharness-1.0.0/hexharness/tools/native/exec.py +54 -0
- hexharness-1.0.0/hexharness/tools/native/exploit.py +103 -0
- hexharness-1.0.0/hexharness/tools/native/extend.py +229 -0
- hexharness-1.0.0/hexharness/tools/native/fs.py +79 -0
- hexharness-1.0.0/hexharness/tools/native/knowledge.py +42 -0
- hexharness-1.0.0/hexharness/tools/native/net.py +74 -0
- hexharness-1.0.0/hexharness/tools/native/osint.py +182 -0
- hexharness-1.0.0/hexharness/tools/native/parallel.py +84 -0
- hexharness-1.0.0/hexharness/tools/native/postman.py +143 -0
- hexharness-1.0.0/hexharness/tools/native/recon.py +208 -0
- hexharness-1.0.0/hexharness/tools/native/report_tools.py +51 -0
- hexharness-1.0.0/hexharness/tools/native/revshell.py +215 -0
- hexharness-1.0.0/hexharness/tools/native/services.py +194 -0
- hexharness-1.0.0/hexharness/tools/native/shodan.py +79 -0
- hexharness-1.0.0/hexharness/tools/native/websearch.py +105 -0
- hexharness-1.0.0/hexharness/tools/native/workflow_tool.py +36 -0
- hexharness-1.0.0/hexharness/tools/registry.py +27 -0
- hexharness-1.0.0/hexharness/transport/__init__.py +99 -0
- hexharness-1.0.0/hexharness/tui/__init__.py +19 -0
- hexharness-1.0.0/hexharness/tui/__main__.py +19 -0
- hexharness-1.0.0/hexharness/tui/app.py +892 -0
- hexharness-1.0.0/hexharness/tui/approver.py +51 -0
- hexharness-1.0.0/hexharness/tui/config.py +100 -0
- hexharness-1.0.0/hexharness/tui/providers.py +183 -0
- hexharness-1.0.0/hexharness/tui/screens.py +915 -0
- hexharness-1.0.0/hexharness/tui/widgets.py +70 -0
- hexharness-1.0.0/hexharness/voice/__init__.py +3 -0
- hexharness-1.0.0/hexharness/voice/dictation.py +142 -0
- hexharness-1.0.0/hexharness.egg-info/PKG-INFO +225 -0
- hexharness-1.0.0/hexharness.egg-info/SOURCES.txt +198 -0
- hexharness-1.0.0/hexharness.egg-info/dependency_links.txt +1 -0
- hexharness-1.0.0/hexharness.egg-info/entry_points.txt +2 -0
- hexharness-1.0.0/hexharness.egg-info/requires.txt +62 -0
- hexharness-1.0.0/hexharness.egg-info/top_level.txt +1 -0
- hexharness-1.0.0/pyproject.toml +94 -0
- hexharness-1.0.0/setup.cfg +4 -0
- hexharness-1.0.0/tests/test_authorize_chokepoint.py +89 -0
- hexharness-1.0.0/tests/test_binary.py +145 -0
- hexharness-1.0.0/tests/test_browser.py +46 -0
- hexharness-1.0.0/tests/test_config_persist.py +32 -0
- hexharness-1.0.0/tests/test_context.py +66 -0
- hexharness-1.0.0/tests/test_custom_provider_persist.py +76 -0
- hexharness-1.0.0/tests/test_daemon_session.py +112 -0
- hexharness-1.0.0/tests/test_engagement.py +33 -0
- hexharness-1.0.0/tests/test_engagement_builder.py +80 -0
- hexharness-1.0.0/tests/test_event_hashchain.py +33 -0
- hexharness-1.0.0/tests/test_exploit.py +68 -0
- hexharness-1.0.0/tests/test_extend.py +130 -0
- hexharness-1.0.0/tests/test_findings_states.py +54 -0
- hexharness-1.0.0/tests/test_fs_exec.py +60 -0
- hexharness-1.0.0/tests/test_knowledge.py +66 -0
- hexharness-1.0.0/tests/test_list_findings.py +25 -0
- hexharness-1.0.0/tests/test_mcp.py +70 -0
- hexharness-1.0.0/tests/test_observability.py +42 -0
- hexharness-1.0.0/tests/test_openai_compatible.py +37 -0
- hexharness-1.0.0/tests/test_openai_streaming.py +115 -0
- hexharness-1.0.0/tests/test_orchestrator.py +96 -0
- hexharness-1.0.0/tests/test_osint.py +114 -0
- hexharness-1.0.0/tests/test_parallel.py +87 -0
- hexharness-1.0.0/tests/test_phase_bypass.py +37 -0
- hexharness-1.0.0/tests/test_postman.py +62 -0
- hexharness-1.0.0/tests/test_prompt.py +108 -0
- hexharness-1.0.0/tests/test_provider_adapters.py +143 -0
- hexharness-1.0.0/tests/test_provider_types.py +51 -0
- hexharness-1.0.0/tests/test_providers_router.py +79 -0
- hexharness-1.0.0/tests/test_recon.py +84 -0
- hexharness-1.0.0/tests/test_record_finding.py +33 -0
- hexharness-1.0.0/tests/test_recovery.py +40 -0
- hexharness-1.0.0/tests/test_report_wiring.py +50 -0
- hexharness-1.0.0/tests/test_reporting.py +116 -0
- hexharness-1.0.0/tests/test_revshell.py +66 -0
- hexharness-1.0.0/tests/test_roe_ceiling.py +50 -0
- hexharness-1.0.0/tests/test_scope_change.py +43 -0
- hexharness-1.0.0/tests/test_scope_fail_closed.py +50 -0
- hexharness-1.0.0/tests/test_scope_in_context.py +39 -0
- hexharness-1.0.0/tests/test_secrets.py +61 -0
- hexharness-1.0.0/tests/test_services.py +136 -0
- hexharness-1.0.0/tests/test_session.py +47 -0
- hexharness-1.0.0/tests/test_shodan_secret.py +47 -0
- hexharness-1.0.0/tests/test_skills.py +52 -0
- hexharness-1.0.0/tests/test_slash.py +40 -0
- hexharness-1.0.0/tests/test_streaming.py +33 -0
- hexharness-1.0.0/tests/test_tui.py +77 -0
- hexharness-1.0.0/tests/test_tui_capabilities.py +101 -0
- hexharness-1.0.0/tests/test_tui_commands.py +33 -0
- hexharness-1.0.0/tests/test_tui_findings.py +100 -0
- hexharness-1.0.0/tests/test_tui_mode_custom.py +106 -0
- hexharness-1.0.0/tests/test_tui_queue.py +46 -0
- hexharness-1.0.0/tests/test_tui_scope.py +53 -0
- hexharness-1.0.0/tests/test_tui_scope_edit.py +150 -0
- hexharness-1.0.0/tests/test_tui_status.py +23 -0
- hexharness-1.0.0/tests/test_vault_persist.py +54 -0
- hexharness-1.0.0/tests/test_voice.py +68 -0
- hexharness-1.0.0/tests/test_websearch.py +51 -0
- hexharness-1.0.0/tests/test_workflow.py +78 -0
hexharness-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
hexharness-1.0.0/NOTICE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
HexHarness
|
|
2
|
+
Copyright 2026 Matias Tillerias
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
HexHarness is a dual-use security tool intended for authorized penetration
|
|
11
|
+
testing and defensive security research only. You are responsible for using it
|
|
12
|
+
only against systems you are explicitly authorized to test.
|
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hexharness
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Agentic pentesting harness with a hard domain control plane (scope, ROE, evidence, budget).
|
|
5
|
+
Author-email: Matias Tillerias <matias.tillerias@securehex.cl>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/Secure-Hex/hexharness
|
|
8
|
+
Project-URL: Repository, https://github.com/Secure-Hex/hexharness
|
|
9
|
+
Project-URL: Issues, https://github.com/Secure-Hex/hexharness/issues
|
|
10
|
+
Keywords: pentesting,security,agent,llm,offensive-security,control-plane,mitre-attack
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Information Technology
|
|
13
|
+
Classifier: Topic :: Security
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Requires-Python: >=3.12
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
License-File: NOTICE
|
|
20
|
+
Requires-Dist: pydantic>=2.6
|
|
21
|
+
Requires-Dist: anthropic>=0.40
|
|
22
|
+
Requires-Dist: pyyaml>=6
|
|
23
|
+
Requires-Dist: ddgs>=6.0
|
|
24
|
+
Requires-Dist: dnspython>=2.6
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
28
|
+
Provides-Extra: openai
|
|
29
|
+
Requires-Dist: openai>=1.40; extra == "openai"
|
|
30
|
+
Provides-Extra: google
|
|
31
|
+
Requires-Dist: google-genai>=0.3; extra == "google"
|
|
32
|
+
Provides-Extra: otel
|
|
33
|
+
Requires-Dist: opentelemetry-sdk>=1.20; extra == "otel"
|
|
34
|
+
Provides-Extra: daemon
|
|
35
|
+
Requires-Dist: websockets>=12; extra == "daemon"
|
|
36
|
+
Provides-Extra: reporting
|
|
37
|
+
Requires-Dist: jinja2>=3; extra == "reporting"
|
|
38
|
+
Requires-Dist: weasyprint>=60; extra == "reporting"
|
|
39
|
+
Requires-Dist: docxtpl>=0.16; extra == "reporting"
|
|
40
|
+
Provides-Extra: mcp
|
|
41
|
+
Requires-Dist: mcp>=1.0; extra == "mcp"
|
|
42
|
+
Provides-Extra: tui
|
|
43
|
+
Requires-Dist: textual>=0.60; extra == "tui"
|
|
44
|
+
Provides-Extra: browser
|
|
45
|
+
Requires-Dist: playwright>=1.40; extra == "browser"
|
|
46
|
+
Provides-Extra: secrets
|
|
47
|
+
Requires-Dist: cryptography>=42; extra == "secrets"
|
|
48
|
+
Provides-Extra: voice
|
|
49
|
+
Requires-Dist: sounddevice>=0.4; extra == "voice"
|
|
50
|
+
Requires-Dist: faster-whisper>=1.0; extra == "voice"
|
|
51
|
+
Requires-Dist: numpy>=1.26; extra == "voice"
|
|
52
|
+
Provides-Extra: search
|
|
53
|
+
Requires-Dist: ddgs>=6.0; extra == "search"
|
|
54
|
+
Provides-Extra: all
|
|
55
|
+
Requires-Dist: openai>=1.40; extra == "all"
|
|
56
|
+
Requires-Dist: google-genai>=0.3; extra == "all"
|
|
57
|
+
Requires-Dist: opentelemetry-sdk>=1.20; extra == "all"
|
|
58
|
+
Requires-Dist: websockets>=12; extra == "all"
|
|
59
|
+
Requires-Dist: jinja2>=3; extra == "all"
|
|
60
|
+
Requires-Dist: weasyprint>=60; extra == "all"
|
|
61
|
+
Requires-Dist: docxtpl>=0.16; extra == "all"
|
|
62
|
+
Requires-Dist: mcp>=1.0; extra == "all"
|
|
63
|
+
Requires-Dist: textual>=0.60; extra == "all"
|
|
64
|
+
Requires-Dist: sounddevice>=0.4; extra == "all"
|
|
65
|
+
Requires-Dist: faster-whisper>=1.0; extra == "all"
|
|
66
|
+
Requires-Dist: numpy>=1.26; extra == "all"
|
|
67
|
+
Requires-Dist: ddgs>=6.0; extra == "all"
|
|
68
|
+
Requires-Dist: cryptography>=42; extra == "all"
|
|
69
|
+
Dynamic: license-file
|
|
70
|
+
|
|
71
|
+
# HexHarness
|
|
72
|
+
|
|
73
|
+
Agentic pentesting harness. The differentiator is not the agent loop (that is standard)
|
|
74
|
+
but a **domain control plane** — scope, ROE, evidence, approvals, budget — that is
|
|
75
|
+
unbreakable by design. Dual-use by nature; what keeps it on the right side is that the
|
|
76
|
+
Scope Guard + ROE are hard gates and everything lands in the hash-chained audit log.
|
|
77
|
+
|
|
78
|
+
## Install
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
python -m venv venv && ./venv/bin/pip install -e '.[dev]'
|
|
82
|
+
./venv/bin/pytest -q # 252 passed, 3 skipped (optional-dep paths)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Core + tests run with no optional dependency installed; every integration is lazy-imported.
|
|
86
|
+
|
|
87
|
+
## Quickstart (TUI)
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
./venv/bin/pip install -e '.[tui]'
|
|
91
|
+
./venv/bin/python -m hexharness tui # start blank — describe a target to configure it
|
|
92
|
+
./venv/bin/python -m hexharness tui --engagement engagements/example.engagement.yaml
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Launched without `--engagement` the TUI starts **unconfigured**: no scope, no resumed
|
|
96
|
+
history. Describe the target and the model drafts an engagement; you approve the scope/ROE
|
|
97
|
+
in a dialog before anything runs. Each turn auto-saves; reopening resumes the session.
|
|
98
|
+
|
|
99
|
+
Key bindings: `Ctrl+P` provider · `Ctrl+E` edit engagement (scope/ROE/budget/sandbox/hardware)
|
|
100
|
+
· `Ctrl+O` mode · `Ctrl+T` capabilities · `Ctrl+F` findings · `Ctrl+G` generate report
|
|
101
|
+
· `Ctrl+R` dictate · `Ctrl+K` kill switch · `Ctrl+X` cancel turn · drag to select, `Ctrl+C` copies.
|
|
102
|
+
|
|
103
|
+
## CLI
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
# run one task against an existing engagement
|
|
107
|
+
ANTHROPIC_API_KEY=sk-... ./venv/bin/python -m hexharness run \
|
|
108
|
+
"Look up CWE-79 and explain it" --engagement engagements/example.engagement.yaml \
|
|
109
|
+
--autonomy interactive --phase recon
|
|
110
|
+
|
|
111
|
+
# draft a new engagement from a natural-language brief, confirm, then run it
|
|
112
|
+
ANTHROPIC_API_KEY=sk-... ./venv/bin/python -m hexharness init \
|
|
113
|
+
"External test of acme.example and 203.0.113.0/24, exclude vpn.acme.example, \
|
|
114
|
+
enumeration only, business hours" --task "Resolve www.acme.example"
|
|
115
|
+
|
|
116
|
+
./venv/bin/python -m hexharness build-image # build the Kali sandbox image (Kali + tools)
|
|
117
|
+
./venv/bin/python -m hexharness verify --engagement <file> # verify the audit log hash chain
|
|
118
|
+
./venv/bin/python -m hexharness report --engagement <file> --out report.html
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
The requested `--autonomy/--phase` are clamped to the engagement's ROE ceiling. The agent
|
|
122
|
+
can never grant itself scope or ROE: `init` drafting writes an inert file, and activation
|
|
123
|
+
is a human step (invariants #3/#4).
|
|
124
|
+
|
|
125
|
+
## The non-negotiable invariants (each has a test)
|
|
126
|
+
|
|
127
|
+
1. The agent loop never calls `tool.run()` directly — always `ControlPlane.authorize()` first.
|
|
128
|
+
2. `authorize()` order: `scope_guard → mode.decide(risk) → roe.cap → budget → HITL → secrets`, fail-closed.
|
|
129
|
+
3. Scope Guard is a hard gate no mode bypasses — not even `bypass`. Out of scope = deny.
|
|
130
|
+
4. ROE sets the engagement's max mode (immutable); active mode = `min(requested, ceiling)`.
|
|
131
|
+
5. Findings enter as CANDIDATE; only CONFIRMED reach the report; REJECTED kept with reason.
|
|
132
|
+
6. Kill switch is out-of-band (signal / trigger file), works client-disconnected, checkpoints first.
|
|
133
|
+
7. Secrets are acquired out-of-band; their values never reach the model or the logs — only names.
|
|
134
|
+
|
|
135
|
+
Audit log, tracing and checkpointing are **projections** of one append-only, hash-chained
|
|
136
|
+
event stream (`hexharness/events/`). `hexharness verify` walks the chain and flags tampering.
|
|
137
|
+
|
|
138
|
+
## Capabilities (tools)
|
|
139
|
+
|
|
140
|
+
The agent drives tools through the control plane; `knowledge_search` and the skills library
|
|
141
|
+
document each one. Current toolset:
|
|
142
|
+
|
|
143
|
+
- **Recon** — `dns_enum`, `dns_lookup`, `whois_lookup`, `port_scan`, `parallel_scan`
|
|
144
|
+
(concurrent multi-host, scope-enforced), `banner_grab`, `ssh_info`, `ftp_check`,
|
|
145
|
+
`http_probe`, `smb_enum`, `browser` (Playwright: interact + screenshots).
|
|
146
|
+
- **OSINT** — `web_search` (DuckDuckGo free / Tavily / Exa), `shodan_host`, `wayback_urls`,
|
|
147
|
+
`github_dork`, `cloud_storage_enum` (S3/Azure/GCS).
|
|
148
|
+
- **Exploitation / C2** — `exec_command` (sandboxed, session-persistent), `exploit_run`
|
|
149
|
+
(scope-checked), `msfvenom_payload`, and the reverse-shell handler
|
|
150
|
+
(`listener_start` / `shell_sessions` / `shell_exec` / `listener_stop`).
|
|
151
|
+
- **Analysis** — `binary_info`, `checksec`, `disassemble`, `postman_list`, `postman_run`.
|
|
152
|
+
- **Evidence / reporting** — `record_finding`, `list_findings`, `generate_report`.
|
|
153
|
+
- **Orchestration / meta** — `run_workflow` (declarative pipeline: templating, `for_each`,
|
|
154
|
+
conditions — every step still passes the control plane), `skill_lookup`, `skill_install`
|
|
155
|
+
(project or global scope), `knowledge_search`, `cwe_lookup`, `mitre_attack_lookup`,
|
|
156
|
+
`mcp_connect`, `engagement_draft`, `file_read`, `file_write`.
|
|
157
|
+
|
|
158
|
+
Offensive tools are `DESTRUCTIVE`/`INTRUSIVE` + `requires_approval` and, where a target is
|
|
159
|
+
involved, scope-sensitive. A caught reverse shell whose peer IP is out of scope is dropped
|
|
160
|
+
on connect.
|
|
161
|
+
|
|
162
|
+
## Sandbox
|
|
163
|
+
|
|
164
|
+
`exec_command` runs in a **long-lived Docker container per session** (installs/state persist
|
|
165
|
+
across calls; only the host-mounted `/workspace` survives after the session ends). The bundled
|
|
166
|
+
image `hexharness/kali:latest` builds from `sandbox/docker/Dockerfile` (ships in the wheel,
|
|
167
|
+
auto-builds on first use): Kali + nmap/smbclient/curl/metasploit-framework/aircrack-ng/etc.
|
|
168
|
+
|
|
169
|
+
`engagement.hardware_access` (opt-in, default off) passes host USB/UART + wireless NICs into
|
|
170
|
+
the session container (`--privileged`, host net) for hardware and WiFi work — it drops the
|
|
171
|
+
sandbox isolation, so it is explicit. Scanners keep ephemeral, hardened containers.
|
|
172
|
+
|
|
173
|
+
## Knowledge base
|
|
174
|
+
|
|
175
|
+
- `mitre_attack_lookup` — the full MITRE ATT&CK Enterprise catalog (~697 techniques).
|
|
176
|
+
- `cwe_lookup` — the full MITRE CWE catalog (~969 weaknesses).
|
|
177
|
+
- `knowledge_search` — TF-IDF RAG over a local markdown corpus (technique playbooks + a
|
|
178
|
+
per-capability tool reference + the workflow guide).
|
|
179
|
+
- Skills library (`skill_lookup`) — runnable playbooks (sqli-triage, subdomain-enumeration,
|
|
180
|
+
workflow-chaining, reverse-shell-handler, exploitation); install more at project or global scope.
|
|
181
|
+
|
|
182
|
+
## Secrets
|
|
183
|
+
|
|
184
|
+
Out-of-band vault: a tool that needs a key (`shodan_host`, `github_dork`, paid web search,
|
|
185
|
+
MCP servers) triggers an operator prompt; the value is stored and reused, **never** shown to
|
|
186
|
+
the model or logged. With the `[secrets]` extra it persists **encrypted at rest** (Fernet,
|
|
187
|
+
per engagement); without it, in-memory only.
|
|
188
|
+
|
|
189
|
+
## Layout
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
hexharness/
|
|
193
|
+
providers/ normalized LLM types + Anthropic/OpenAI/Google/Ollama adapters + router (+ fake)
|
|
194
|
+
agent/ ExecContext, single-agent loop (the chokepoint), workflow engine, orchestrator
|
|
195
|
+
control/ THE control plane: plane, scope_guard, policy(modes), roe, budget, hitl, kill_switch, vault
|
|
196
|
+
events/ append-only log + SHA-256 hash chain + bus
|
|
197
|
+
tools/ Tool base + registry + native tools + MCP client
|
|
198
|
+
sandbox/ Docker executor (hardened; argv list, no shell) + packaged Kali image
|
|
199
|
+
evidence/ findings (candidate/confirmed/rejected) + store
|
|
200
|
+
knowledge/ MITRE ATT&CK + CWE data + TF-IDF RAG corpus
|
|
201
|
+
skills/ skill engine + bundled playbook library
|
|
202
|
+
reporting/ ReportModel (from confirmed findings) + Jinja/DOCX render
|
|
203
|
+
tui/ Textual terminal UI
|
|
204
|
+
observability/ OTel span projection recovery/ snapshot + replay
|
|
205
|
+
protocol/ transport/ daemon/ client/ JSON-RPC client/daemon split (sessions attach/resume)
|
|
206
|
+
engagement.py engagement.yaml -> control-plane objects engine.py composition root
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Optional dependencies
|
|
210
|
+
|
|
211
|
+
```bash
|
|
212
|
+
./venv/bin/pip install -e '.[all]' # everything
|
|
213
|
+
# or pick: tui / openai / google / otel / daemon / reporting / mcp / browser / secrets / voice
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
`browser` also needs `./venv/bin/playwright install chromium`.
|
|
217
|
+
|
|
218
|
+
## Known ceilings (marked `ponytail:` in code)
|
|
219
|
+
|
|
220
|
+
- Orchestrator workers run sequentially (swap to `asyncio.gather` + per-worker providers).
|
|
221
|
+
- Knowledge RAG is a linear TF-IDF scan (fine for a local corpus; add a vector index if it grows).
|
|
222
|
+
- `run_workflow` passes values as text (no structured outputs); `for_each` splits on lines/commas.
|
|
223
|
+
- Reverse-shell output is read by idle-timeout (no PTY/prompt detection); keep commands non-interactive.
|
|
224
|
+
- MCP tools default to INTRUSIVE + requires_approval unless a `classify` override says otherwise.
|
|
225
|
+
- `.md`→PDF and DOCX→PDF need extra converters; HTML→PDF via WeasyPrint is the primary path.
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
# HexHarness
|
|
2
|
+
|
|
3
|
+
Agentic pentesting harness. The differentiator is not the agent loop (that is standard)
|
|
4
|
+
but a **domain control plane** — scope, ROE, evidence, approvals, budget — that is
|
|
5
|
+
unbreakable by design. Dual-use by nature; what keeps it on the right side is that the
|
|
6
|
+
Scope Guard + ROE are hard gates and everything lands in the hash-chained audit log.
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
python -m venv venv && ./venv/bin/pip install -e '.[dev]'
|
|
12
|
+
./venv/bin/pytest -q # 252 passed, 3 skipped (optional-dep paths)
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Core + tests run with no optional dependency installed; every integration is lazy-imported.
|
|
16
|
+
|
|
17
|
+
## Quickstart (TUI)
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
./venv/bin/pip install -e '.[tui]'
|
|
21
|
+
./venv/bin/python -m hexharness tui # start blank — describe a target to configure it
|
|
22
|
+
./venv/bin/python -m hexharness tui --engagement engagements/example.engagement.yaml
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Launched without `--engagement` the TUI starts **unconfigured**: no scope, no resumed
|
|
26
|
+
history. Describe the target and the model drafts an engagement; you approve the scope/ROE
|
|
27
|
+
in a dialog before anything runs. Each turn auto-saves; reopening resumes the session.
|
|
28
|
+
|
|
29
|
+
Key bindings: `Ctrl+P` provider · `Ctrl+E` edit engagement (scope/ROE/budget/sandbox/hardware)
|
|
30
|
+
· `Ctrl+O` mode · `Ctrl+T` capabilities · `Ctrl+F` findings · `Ctrl+G` generate report
|
|
31
|
+
· `Ctrl+R` dictate · `Ctrl+K` kill switch · `Ctrl+X` cancel turn · drag to select, `Ctrl+C` copies.
|
|
32
|
+
|
|
33
|
+
## CLI
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# run one task against an existing engagement
|
|
37
|
+
ANTHROPIC_API_KEY=sk-... ./venv/bin/python -m hexharness run \
|
|
38
|
+
"Look up CWE-79 and explain it" --engagement engagements/example.engagement.yaml \
|
|
39
|
+
--autonomy interactive --phase recon
|
|
40
|
+
|
|
41
|
+
# draft a new engagement from a natural-language brief, confirm, then run it
|
|
42
|
+
ANTHROPIC_API_KEY=sk-... ./venv/bin/python -m hexharness init \
|
|
43
|
+
"External test of acme.example and 203.0.113.0/24, exclude vpn.acme.example, \
|
|
44
|
+
enumeration only, business hours" --task "Resolve www.acme.example"
|
|
45
|
+
|
|
46
|
+
./venv/bin/python -m hexharness build-image # build the Kali sandbox image (Kali + tools)
|
|
47
|
+
./venv/bin/python -m hexharness verify --engagement <file> # verify the audit log hash chain
|
|
48
|
+
./venv/bin/python -m hexharness report --engagement <file> --out report.html
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The requested `--autonomy/--phase` are clamped to the engagement's ROE ceiling. The agent
|
|
52
|
+
can never grant itself scope or ROE: `init` drafting writes an inert file, and activation
|
|
53
|
+
is a human step (invariants #3/#4).
|
|
54
|
+
|
|
55
|
+
## The non-negotiable invariants (each has a test)
|
|
56
|
+
|
|
57
|
+
1. The agent loop never calls `tool.run()` directly — always `ControlPlane.authorize()` first.
|
|
58
|
+
2. `authorize()` order: `scope_guard → mode.decide(risk) → roe.cap → budget → HITL → secrets`, fail-closed.
|
|
59
|
+
3. Scope Guard is a hard gate no mode bypasses — not even `bypass`. Out of scope = deny.
|
|
60
|
+
4. ROE sets the engagement's max mode (immutable); active mode = `min(requested, ceiling)`.
|
|
61
|
+
5. Findings enter as CANDIDATE; only CONFIRMED reach the report; REJECTED kept with reason.
|
|
62
|
+
6. Kill switch is out-of-band (signal / trigger file), works client-disconnected, checkpoints first.
|
|
63
|
+
7. Secrets are acquired out-of-band; their values never reach the model or the logs — only names.
|
|
64
|
+
|
|
65
|
+
Audit log, tracing and checkpointing are **projections** of one append-only, hash-chained
|
|
66
|
+
event stream (`hexharness/events/`). `hexharness verify` walks the chain and flags tampering.
|
|
67
|
+
|
|
68
|
+
## Capabilities (tools)
|
|
69
|
+
|
|
70
|
+
The agent drives tools through the control plane; `knowledge_search` and the skills library
|
|
71
|
+
document each one. Current toolset:
|
|
72
|
+
|
|
73
|
+
- **Recon** — `dns_enum`, `dns_lookup`, `whois_lookup`, `port_scan`, `parallel_scan`
|
|
74
|
+
(concurrent multi-host, scope-enforced), `banner_grab`, `ssh_info`, `ftp_check`,
|
|
75
|
+
`http_probe`, `smb_enum`, `browser` (Playwright: interact + screenshots).
|
|
76
|
+
- **OSINT** — `web_search` (DuckDuckGo free / Tavily / Exa), `shodan_host`, `wayback_urls`,
|
|
77
|
+
`github_dork`, `cloud_storage_enum` (S3/Azure/GCS).
|
|
78
|
+
- **Exploitation / C2** — `exec_command` (sandboxed, session-persistent), `exploit_run`
|
|
79
|
+
(scope-checked), `msfvenom_payload`, and the reverse-shell handler
|
|
80
|
+
(`listener_start` / `shell_sessions` / `shell_exec` / `listener_stop`).
|
|
81
|
+
- **Analysis** — `binary_info`, `checksec`, `disassemble`, `postman_list`, `postman_run`.
|
|
82
|
+
- **Evidence / reporting** — `record_finding`, `list_findings`, `generate_report`.
|
|
83
|
+
- **Orchestration / meta** — `run_workflow` (declarative pipeline: templating, `for_each`,
|
|
84
|
+
conditions — every step still passes the control plane), `skill_lookup`, `skill_install`
|
|
85
|
+
(project or global scope), `knowledge_search`, `cwe_lookup`, `mitre_attack_lookup`,
|
|
86
|
+
`mcp_connect`, `engagement_draft`, `file_read`, `file_write`.
|
|
87
|
+
|
|
88
|
+
Offensive tools are `DESTRUCTIVE`/`INTRUSIVE` + `requires_approval` and, where a target is
|
|
89
|
+
involved, scope-sensitive. A caught reverse shell whose peer IP is out of scope is dropped
|
|
90
|
+
on connect.
|
|
91
|
+
|
|
92
|
+
## Sandbox
|
|
93
|
+
|
|
94
|
+
`exec_command` runs in a **long-lived Docker container per session** (installs/state persist
|
|
95
|
+
across calls; only the host-mounted `/workspace` survives after the session ends). The bundled
|
|
96
|
+
image `hexharness/kali:latest` builds from `sandbox/docker/Dockerfile` (ships in the wheel,
|
|
97
|
+
auto-builds on first use): Kali + nmap/smbclient/curl/metasploit-framework/aircrack-ng/etc.
|
|
98
|
+
|
|
99
|
+
`engagement.hardware_access` (opt-in, default off) passes host USB/UART + wireless NICs into
|
|
100
|
+
the session container (`--privileged`, host net) for hardware and WiFi work — it drops the
|
|
101
|
+
sandbox isolation, so it is explicit. Scanners keep ephemeral, hardened containers.
|
|
102
|
+
|
|
103
|
+
## Knowledge base
|
|
104
|
+
|
|
105
|
+
- `mitre_attack_lookup` — the full MITRE ATT&CK Enterprise catalog (~697 techniques).
|
|
106
|
+
- `cwe_lookup` — the full MITRE CWE catalog (~969 weaknesses).
|
|
107
|
+
- `knowledge_search` — TF-IDF RAG over a local markdown corpus (technique playbooks + a
|
|
108
|
+
per-capability tool reference + the workflow guide).
|
|
109
|
+
- Skills library (`skill_lookup`) — runnable playbooks (sqli-triage, subdomain-enumeration,
|
|
110
|
+
workflow-chaining, reverse-shell-handler, exploitation); install more at project or global scope.
|
|
111
|
+
|
|
112
|
+
## Secrets
|
|
113
|
+
|
|
114
|
+
Out-of-band vault: a tool that needs a key (`shodan_host`, `github_dork`, paid web search,
|
|
115
|
+
MCP servers) triggers an operator prompt; the value is stored and reused, **never** shown to
|
|
116
|
+
the model or logged. With the `[secrets]` extra it persists **encrypted at rest** (Fernet,
|
|
117
|
+
per engagement); without it, in-memory only.
|
|
118
|
+
|
|
119
|
+
## Layout
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
hexharness/
|
|
123
|
+
providers/ normalized LLM types + Anthropic/OpenAI/Google/Ollama adapters + router (+ fake)
|
|
124
|
+
agent/ ExecContext, single-agent loop (the chokepoint), workflow engine, orchestrator
|
|
125
|
+
control/ THE control plane: plane, scope_guard, policy(modes), roe, budget, hitl, kill_switch, vault
|
|
126
|
+
events/ append-only log + SHA-256 hash chain + bus
|
|
127
|
+
tools/ Tool base + registry + native tools + MCP client
|
|
128
|
+
sandbox/ Docker executor (hardened; argv list, no shell) + packaged Kali image
|
|
129
|
+
evidence/ findings (candidate/confirmed/rejected) + store
|
|
130
|
+
knowledge/ MITRE ATT&CK + CWE data + TF-IDF RAG corpus
|
|
131
|
+
skills/ skill engine + bundled playbook library
|
|
132
|
+
reporting/ ReportModel (from confirmed findings) + Jinja/DOCX render
|
|
133
|
+
tui/ Textual terminal UI
|
|
134
|
+
observability/ OTel span projection recovery/ snapshot + replay
|
|
135
|
+
protocol/ transport/ daemon/ client/ JSON-RPC client/daemon split (sessions attach/resume)
|
|
136
|
+
engagement.py engagement.yaml -> control-plane objects engine.py composition root
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Optional dependencies
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
./venv/bin/pip install -e '.[all]' # everything
|
|
143
|
+
# or pick: tui / openai / google / otel / daemon / reporting / mcp / browser / secrets / voice
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
`browser` also needs `./venv/bin/playwright install chromium`.
|
|
147
|
+
|
|
148
|
+
## Known ceilings (marked `ponytail:` in code)
|
|
149
|
+
|
|
150
|
+
- Orchestrator workers run sequentially (swap to `asyncio.gather` + per-worker providers).
|
|
151
|
+
- Knowledge RAG is a linear TF-IDF scan (fine for a local corpus; add a vector index if it grows).
|
|
152
|
+
- `run_workflow` passes values as text (no structured outputs); `for_each` splits on lines/commas.
|
|
153
|
+
- Reverse-shell output is read by idle-timeout (no PTY/prompt detection); keep commands non-interactive.
|
|
154
|
+
- MCP tools default to INTRUSIVE + requires_approval unless a `classify` override says otherwise.
|
|
155
|
+
- `.md`→PDF and DOCX→PDF need extra converters; HTML→PDF via WeasyPrint is the primary path.
|