red-harness-core 0.1.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 (131) hide show
  1. red_harness_core-0.1.0/LICENSE +202 -0
  2. red_harness_core-0.1.0/NOTICE +6 -0
  3. red_harness_core-0.1.0/PKG-INFO +299 -0
  4. red_harness_core-0.1.0/README.md +257 -0
  5. red_harness_core-0.1.0/THIRD_PARTY_NOTICES.md +127 -0
  6. red_harness_core-0.1.0/licenses/README.md +16 -0
  7. red_harness_core-0.1.0/licenses/capstone-5.0.6-LICENSE.TXT +31 -0
  8. red_harness_core-0.1.0/licenses/cpython-3.12.10-LICENSE.txt +279 -0
  9. red_harness_core-0.1.0/licenses/ghidra-12.1.3-LICENSE.txt +201 -0
  10. red_harness_core-0.1.0/licenses/unicorn-2.1.4-COPYING.txt +339 -0
  11. red_harness_core-0.1.0/pyproject.toml +64 -0
  12. red_harness_core-0.1.0/setup.cfg +4 -0
  13. red_harness_core-0.1.0/src/red_harness_core.egg-info/PKG-INFO +299 -0
  14. red_harness_core-0.1.0/src/red_harness_core.egg-info/SOURCES.txt +129 -0
  15. red_harness_core-0.1.0/src/red_harness_core.egg-info/dependency_links.txt +1 -0
  16. red_harness_core-0.1.0/src/red_harness_core.egg-info/entry_points.txt +2 -0
  17. red_harness_core-0.1.0/src/red_harness_core.egg-info/requires.txt +8 -0
  18. red_harness_core-0.1.0/src/red_harness_core.egg-info/top_level.txt +1 -0
  19. red_harness_core-0.1.0/src/redharness/__init__.py +3 -0
  20. red_harness_core-0.1.0/src/redharness/agent_setup.py +872 -0
  21. red_harness_core-0.1.0/src/redharness/analysis/__init__.py +2 -0
  22. red_harness_core-0.1.0/src/redharness/analysis/antianalysis.py +761 -0
  23. red_harness_core-0.1.0/src/redharness/analysis/build_diff.py +330 -0
  24. red_harness_core-0.1.0/src/redharness/analysis/check_inventory.py +727 -0
  25. red_harness_core-0.1.0/src/redharness/analysis/check_taxonomy.py +259 -0
  26. red_harness_core-0.1.0/src/redharness/analysis/dataflow/__init__.py +11 -0
  27. red_harness_core-0.1.0/src/redharness/analysis/dataflow/eh.py +315 -0
  28. red_harness_core-0.1.0/src/redharness/analysis/dataflow/image.py +55 -0
  29. red_harness_core-0.1.0/src/redharness/analysis/dataflow/seh.py +108 -0
  30. red_harness_core-0.1.0/src/redharness/analysis/dataflow/slicer.py +707 -0
  31. red_harness_core-0.1.0/src/redharness/analysis/dataflow/state.py +269 -0
  32. red_harness_core-0.1.0/src/redharness/analysis/dataflow/x86.py +710 -0
  33. red_harness_core-0.1.0/src/redharness/analysis/engine_disagreement.py +287 -0
  34. red_harness_core-0.1.0/src/redharness/analysis/file_strings.py +294 -0
  35. red_harness_core-0.1.0/src/redharness/analysis/imports_view.py +46 -0
  36. red_harness_core-0.1.0/src/redharness/analysis/pe_dirs.py +441 -0
  37. red_harness_core-0.1.0/src/redharness/analysis/pe_image.py +377 -0
  38. red_harness_core-0.1.0/src/redharness/analysis/pe_profile.py +350 -0
  39. red_harness_core-0.1.0/src/redharness/analysis/protection.py +269 -0
  40. red_harness_core-0.1.0/src/redharness/analysis/section_notes.py +98 -0
  41. red_harness_core-0.1.0/src/redharness/analysis/string_enc.py +40 -0
  42. red_harness_core-0.1.0/src/redharness/analysis/vendors.py +232 -0
  43. red_harness_core-0.1.0/src/redharness/cli.py +190 -0
  44. red_harness_core-0.1.0/src/redharness/compute/__init__.py +8 -0
  45. red_harness_core-0.1.0/src/redharness/compute/evidence.py +66 -0
  46. red_harness_core-0.1.0/src/redharness/compute/rh_boot.py +25 -0
  47. red_harness_core-0.1.0/src/redharness/compute/runner.py +157 -0
  48. red_harness_core-0.1.0/src/redharness/compute/runtime.py +166 -0
  49. red_harness_core-0.1.0/src/redharness/config.py +67 -0
  50. red_harness_core-0.1.0/src/redharness/core/__init__.py +0 -0
  51. red_harness_core-0.1.0/src/redharness/core/_win.py +133 -0
  52. red_harness_core-0.1.0/src/redharness/core/cas.py +133 -0
  53. red_harness_core-0.1.0/src/redharness/core/heavy.py +87 -0
  54. red_harness_core-0.1.0/src/redharness/core/journal.py +212 -0
  55. red_harness_core-0.1.0/src/redharness/core/lock.py +176 -0
  56. red_harness_core-0.1.0/src/redharness/core/premium.py +12 -0
  57. red_harness_core-0.1.0/src/redharness/core/proc.py +384 -0
  58. red_harness_core-0.1.0/src/redharness/core/procinfo.py +42 -0
  59. red_harness_core-0.1.0/src/redharness/core/result.py +19 -0
  60. red_harness_core-0.1.0/src/redharness/deps.py +293 -0
  61. red_harness_core-0.1.0/src/redharness/dynamic/__init__.py +3 -0
  62. red_harness_core-0.1.0/src/redharness/dynamic/backend.py +70 -0
  63. red_harness_core-0.1.0/src/redharness/dynamic/fake.py +60 -0
  64. red_harness_core-0.1.0/src/redharness/dynamic/ingest.py +102 -0
  65. red_harness_core-0.1.0/src/redharness/dynamic/lines.py +75 -0
  66. red_harness_core-0.1.0/src/redharness/dynamic/match.py +75 -0
  67. red_harness_core-0.1.0/src/redharness/dynamic/model.py +389 -0
  68. red_harness_core-0.1.0/src/redharness/dynamic/seal.py +76 -0
  69. red_harness_core-0.1.0/src/redharness/dynamic/validate.py +57 -0
  70. red_harness_core-0.1.0/src/redharness/emulate/__init__.py +10 -0
  71. red_harness_core-0.1.0/src/redharness/emulate/engine.py +330 -0
  72. red_harness_core-0.1.0/src/redharness/emulate/evidence.py +199 -0
  73. red_harness_core-0.1.0/src/redharness/emulate/harden.py +88 -0
  74. red_harness_core-0.1.0/src/redharness/emulate/host.py +76 -0
  75. red_harness_core-0.1.0/src/redharness/emulate/loader.py +187 -0
  76. red_harness_core-0.1.0/src/redharness/emulate/spec.py +500 -0
  77. red_harness_core-0.1.0/src/redharness/emulate/worker.py +73 -0
  78. red_harness_core-0.1.0/src/redharness/engines/__init__.py +9 -0
  79. red_harness_core-0.1.0/src/redharness/engines/_common.py +124 -0
  80. red_harness_core-0.1.0/src/redharness/engines/base.py +270 -0
  81. red_harness_core-0.1.0/src/redharness/engines/ghidra/__init__.py +5 -0
  82. red_harness_core-0.1.0/src/redharness/engines/ghidra/backend.py +575 -0
  83. red_harness_core-0.1.0/src/redharness/engines/ghidra/scripts/RHQuery.java +520 -0
  84. red_harness_core-0.1.0/src/redharness/engines/ida/__init__.py +5 -0
  85. red_harness_core-0.1.0/src/redharness/engines/ida/_worker.py +463 -0
  86. red_harness_core-0.1.0/src/redharness/engines/ida/backend.py +607 -0
  87. red_harness_core-0.1.0/src/redharness/evidence/__init__.py +0 -0
  88. red_harness_core-0.1.0/src/redharness/evidence/compute.py +397 -0
  89. red_harness_core-0.1.0/src/redharness/evidence/control_pair.py +314 -0
  90. red_harness_core-0.1.0/src/redharness/evidence/derivation.py +165 -0
  91. red_harness_core-0.1.0/src/redharness/evidence/emulation.py +52 -0
  92. red_harness_core-0.1.0/src/redharness/evidence/kinds.py +140 -0
  93. red_harness_core-0.1.0/src/redharness/evidence/ledger.py +290 -0
  94. red_harness_core-0.1.0/src/redharness/evidence/model.py +340 -0
  95. red_harness_core-0.1.0/src/redharness/evidence/region_view.py +74 -0
  96. red_harness_core-0.1.0/src/redharness/evidence/terms.py +392 -0
  97. red_harness_core-0.1.0/src/redharness/evidence/values.py +163 -0
  98. red_harness_core-0.1.0/src/redharness/evidence/verifier.py +1291 -0
  99. red_harness_core-0.1.0/src/redharness/jobs/__init__.py +0 -0
  100. red_harness_core-0.1.0/src/redharness/jobs/provenance.py +128 -0
  101. red_harness_core-0.1.0/src/redharness/jobs/stepcache.py +79 -0
  102. red_harness_core-0.1.0/src/redharness/mcp/__init__.py +0 -0
  103. red_harness_core-0.1.0/src/redharness/mcp/availability.py +192 -0
  104. red_harness_core-0.1.0/src/redharness/mcp/check_tool.py +152 -0
  105. red_harness_core-0.1.0/src/redharness/mcp/compute_tool.py +145 -0
  106. red_harness_core-0.1.0/src/redharness/mcp/effects.py +92 -0
  107. red_harness_core-0.1.0/src/redharness/mcp/emulate_tool.py +160 -0
  108. red_harness_core-0.1.0/src/redharness/mcp/engines_tool.py +216 -0
  109. red_harness_core-0.1.0/src/redharness/mcp/kernel_tool.py +59 -0
  110. red_harness_core-0.1.0/src/redharness/mcp/protection_tool.py +442 -0
  111. red_harness_core-0.1.0/src/redharness/mcp/registry.py +115 -0
  112. red_harness_core-0.1.0/src/redharness/mcp/server.py +596 -0
  113. red_harness_core-0.1.0/src/redharness/mcp/session.py +2160 -0
  114. red_harness_core-0.1.0/src/redharness/mcp/toolspec.py +124 -0
  115. red_harness_core-0.1.0/src/redharness/quickstart.py +337 -0
  116. red_harness_core-0.1.0/src/redharness/report/__init__.py +0 -0
  117. red_harness_core-0.1.0/src/redharness/report/render.py +428 -0
  118. red_harness_core-0.1.0/src/redharness/sandbox/__init__.py +8 -0
  119. red_harness_core-0.1.0/src/redharness/sandbox/backend.py +266 -0
  120. red_harness_core-0.1.0/src/redharness/sandbox/evidence.py +105 -0
  121. red_harness_core-0.1.0/src/redharness/sandbox/guest.ps1 +371 -0
  122. red_harness_core-0.1.0/src/redharness/sandbox/hostres.py +244 -0
  123. red_harness_core-0.1.0/src/redharness/sandbox/integrity.py +222 -0
  124. red_harness_core-0.1.0/src/redharness/sandbox/model.py +149 -0
  125. red_harness_core-0.1.0/src/redharness/sandbox/runner.py +1162 -0
  126. red_harness_core-0.1.0/src/redharness/sandbox/support.py +45 -0
  127. red_harness_core-0.1.0/src/redharness/sandbox/windowguard.py +222 -0
  128. red_harness_core-0.1.0/src/redharness/scope/__init__.py +0 -0
  129. red_harness_core-0.1.0/src/redharness/scope/manifest.py +140 -0
  130. red_harness_core-0.1.0/src/redharness/skill/SKILL.md +82 -0
  131. red_harness_core-0.1.0/src/redharness/skill/__init__.py +1 -0
@@ -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.
@@ -0,0 +1,6 @@
1
+ Red Harness
2
+ Copyright 2026 LiebertDev
3
+ Licensed under Apache-2.0 (see LICENSE).
4
+
5
+ Third-party tools that Red Harness can use are not bundled; their licences are listed in THIRD_PARTY_NOTICES.md and
6
+ the upstream licence texts are in licenses/.
@@ -0,0 +1,299 @@
1
+ Metadata-Version: 2.4
2
+ Name: red-harness-core
3
+ Version: 0.1.0
4
+ Summary: Red Harness: a defensive, evidence-bound reverse-engineering analysis harness
5
+ Author: LiebertDev
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/LiebertDev/red-harness
8
+ Project-URL: Source, https://github.com/LiebertDev/red-harness
9
+ Project-URL: Issues, https://github.com/LiebertDev/red-harness/issues
10
+ Project-URL: Changelog, https://github.com/LiebertDev/red-harness/blob/main/CHANGELOG.md
11
+ Project-URL: Security, https://github.com/LiebertDev/red-harness/blob/main/SECURITY.md
12
+ Keywords: reverse-engineering,mcp,ghidra,ida,static-analysis,security,evidence
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Information Technology
17
+ Classifier: Operating System :: Microsoft :: Windows
18
+ Classifier: Operating System :: Microsoft :: Windows :: Windows 10
19
+ Classifier: Operating System :: Microsoft :: Windows :: Windows 11
20
+ Classifier: Programming Language :: Python :: 3
21
+ Classifier: Programming Language :: Python :: 3 :: Only
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Security
24
+ Classifier: Topic :: Software Development :: Disassemblers
25
+ Requires-Python: >=3.12
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ License-File: NOTICE
29
+ License-File: THIRD_PARTY_NOTICES.md
30
+ License-File: licenses/README.md
31
+ License-File: licenses/capstone-5.0.6-LICENSE.TXT
32
+ License-File: licenses/cpython-3.12.10-LICENSE.txt
33
+ License-File: licenses/ghidra-12.1.3-LICENSE.txt
34
+ License-File: licenses/unicorn-2.1.4-COPYING.txt
35
+ Requires-Dist: mcp==1.30.0
36
+ Provides-Extra: dev
37
+ Requires-Dist: pytest>=8; extra == "dev"
38
+ Requires-Dist: jsonschema>=4.20; extra == "dev"
39
+ Provides-Extra: emulate
40
+ Requires-Dist: unicorn==2.1.4; extra == "emulate"
41
+ Dynamic: license-file
42
+
43
+ # Red Harness
44
+
45
+ An evidence-bound static reverse-engineering harness for binaries **you own or are authorized to test**.
46
+
47
+ It is an MCP server (`rh mcp`, stdio) with 18 tools: static analysis through an IDA or Ghidra engine
48
+ (functions, strings, xrefs, decompile, disassemble, raw byte and raw string reading), controlled execution in Windows Sandbox when the
49
+ scope manifest allows it, a sandboxed `compute` tool for the model's own Python, and fix verification. Every claim a
50
+ model records has to cite evidence ids, quotes and addresses; a claim verifier checks them against the
51
+ evidence ledger and rejects or downgrades claims it cannot support. Behavior claims are proven only by a controlled run,
52
+ not by a value appearing in code. Whatever was not examined is reported as unknown, never as "clean".
53
+
54
+ Design notes are in `docs/design/`, the tool surface is in `docs/usage-mcp.md` and `docs/tool-design.md`, and the
55
+ privacy rules for tracked files are in `docs/privacy-guard.md`. Third-party attributions: `NOTICE`; optional third-party components and their licences: `THIRD_PARTY_NOTICES.md`.
56
+
57
+ ## How is this different
58
+ Tool-wrapper MCP servers give an agent reverse-engineering tools and pass the tool output through; nothing checks what the
59
+ agent then says about the binary. Red Harness adds that check:
60
+ - **Every claim is verified against recorded evidence.** A claim cites evidence ids, quotes and addresses. A deterministic
61
+ verifier (no model) re-checks each one against the evidence ledger and rejects or downgrades what the evidence does not
62
+ support. Every status and reason it can give is listed in [`docs/verifier-messages.md`](https://github.com/LiebertDev/red-harness/blob/main/docs/verifier-messages.md).
63
+ - **Behavior is proven only by a run.** "This input is accepted" is never read off the code: it needs a controlled run of the
64
+ target, and static evidence alone leaves such a claim unverified.
65
+ - **Targets run in Windows Sandbox.** Native execution of the target happens only there (network off, output records
66
+ authenticated), and only when the scope manifest allows it.
67
+ - **Unexamined is unknown.** What was not looked at is reported as an unknown with its coverage, never as "clean".
68
+
69
+ ## Quickstart in 5 minutes
70
+ Install the `red-harness-core` package (the command it installs is `rh`; Python 3.12 on Windows):
71
+ ```
72
+ pipx install red-harness-core
73
+ rh deps list # is Ghidra found? if not: rh deps show ghidra; it needs a JDK 21
74
+ rh quickstart C:\Windows\System32\notepad.exe
75
+ ```
76
+ From a checkout instead: `pipx install .` (or build a wheel with `python -m build --wheel` and install the file from `dist`).
77
+ No model and no API key needed. `rh quickstart` checks the prerequisites, writes a scope manifest for the file (use a file you
78
+ own or are authorized to analyse), opens it with Ghidra (else IDA), runs a small static pass through the same code path as the
79
+ MCP tools, records two example claims that quote real evidence, builds the report and prints where it is, a short summary and
80
+ how to connect Claude Code or another MCP client. The first open runs the engine's analysis once (133 s for notepad.exe with
81
+ Ghidra 12.1.3 in our run); a repeat run is served from the cache (1 s).
82
+
83
+ ## Demo
84
+ Real output of `rh quickstart C:\Windows\System32\notepad.exe --engine ghidra` (Ghidra 12.1.3, Windows 10; the data folder
85
+ path is shown as `<DATA_ROOT>`):
86
+ ```
87
+ Static pass with ghidra (the first open analyses the whole binary once; a cached result is reused later)
88
+ target_open x86 64-bit, 498 functions, 557 strings, protection NO_KNOWN_INDICATORS (140s)
89
+ functions_list 498 functions, evidence ev_04e98a81e9b3894d
90
+ imports 301 symbols from 28 DLLs, evidence ev_7e00c8229285bd85
91
+ strings 100 of 557 returned, evidence ev_c01e6dbb5a5ea895
92
+ claim_add SUPPORTED: The target imports GDI32.dll!CreateDCW at 0x140026800.
93
+ claim_add SUPPORTED: The target contains the string Unknown exception at 0x1400273d0.
94
+
95
+ Summary
96
+ target notepad.exe, entry 0x140023bd0, sha256 da5807bb0997cc6b...
97
+ pe profile PE32+ x64 windows_gui 7 sections aslr=yes dep=yes cfg=yes
98
+ claims 2 recorded, 2 verified by the claim verifier
99
+ report 2 findings, 0 hypotheses, 0 unsupported claims in findings (must be 0)
100
+ coverage NO_RECORDED_GAPS; not 'clean': functions listed 200/498, strings 100/557, nothing decompiled
101
+
102
+ Report: <DATA_ROOT>\jobs\job_da5807bb0997cc6b\report\report-8d4209bf00e1cef1.md
103
+ Total time: 142s
104
+ ```
105
+ The generated report is in [`docs/examples/notepad-quickstart-report.md`](https://github.com/LiebertDev/red-harness/blob/main/docs/examples/notepad-quickstart-report.md); each claim
106
+ cites evidence ids and quotes, and the coverage section lists what was not examined. [`docs/examples/README.md`](https://github.com/LiebertDev/red-harness/blob/main/docs/examples/README.md)
107
+ explains each section.
108
+ ## Use from your agent
109
+ One command registers the MCP server (the absolute path of the installed `rh`, with the engine it found) in the AI coding
110
+ clients on this machine and installs the Red Harness skill, so your agent knows the evidence workflow:
111
+ ```
112
+ rh setup --dry-run # shows what would change, with diffs; writes nothing
113
+ rh setup # applies it; restart the client afterwards
114
+ rh setup --client claude-code # only one client: claude-code, codex, cursor, gemini, claude-desktop
115
+ rh setup --print # only prints the configuration snippets, touches nothing
116
+ rh setup --uninstall # removes only the red-harness entry and the skill file it installed
117
+ ```
118
+ Claude Code and Codex CLI are configured through their own `claude mcp add` / `codex mcp add`; Cursor
119
+ (`~/.cursor/mcp.json`), Gemini CLI (`~/.gemini/settings.json`) and Claude Desktop (`claude_desktop_config.json`, classic or
120
+ Microsoft Store install) through their JSON files, merged. The skill goes to `~/.claude/skills/red-harness/` (Claude Code) and
121
+ `~/.agents/skills/red-harness/` (Codex CLI, Gemini CLI); `--no-skill` skips it. Every file is copied to
122
+ `<name>.rh-backup-<timestamp>` before it changes, existing servers and settings are kept, and a second run changes nothing.
123
+ A `red-harness` entry that does not run `rh mcp`, or a skill file you edited, is reported and left alone (`--force`
124
+ overrides that).
125
+ Then ask your agent, for example: "reverse engineer `C:\path\to\tool.exe`; I own it". Use only binaries you own or are
126
+ authorized to test.
127
+
128
+ ## Editions
129
+ This repository is the **Core** edition (Apache-2.0). **Pro** is a separate commercial edition. The MCP tool surface (18 tools)
130
+ is the same in both; Pro adds capabilities behind the same tools and a few extra commands.
131
+
132
+ | | Core (this repo, Apache-2.0) | Pro (commercial) |
133
+ |---|---|---|
134
+ | Static MCP tools (functions, strings, xrefs, decompile, disassemble, `read_bytes`, `file_strings`, `imports`) | yes | yes |
135
+ | Evidence ledger, claim verifier, report | yes | yes |
136
+ | Ghidra and IDA engines | yes | yes |
137
+ | `run_controlled` and `compute` in Windows Sandbox | yes | yes |
138
+ | Protection diagnosis (including vendor attribution) | yes | yes |
139
+ | Check inventory (candidate protection / licensing checks in `target_open`) | yes | yes |
140
+ | Dynamic observation (`run_controlled(observe=...)`: API trace, executable-memory digests) | no | yes |
141
+ | Job bundle export and import (`rh export`, `rh import`) | no | yes |
142
+ | Vendor audit pack (driver facts in `target_open`, driver/service/bundle/workspace triage scripts) | no | yes |
143
+ | Evaluation and benchmark suite (`rh eval`, `rh bench`) | no | yes |
144
+ | Kernel / Phase 2 lab | no | yes |
145
+ | Studio UI | no | planned |
146
+
147
+ In the Core build the Pro-only entry points answer in a fixed way: `run_controlled` with `observe` returns
148
+ `DYNAMIC_BACKEND_UNAVAILABLE` ("premium feature not included in this build"), the Pro CLI commands print a premium notice and
149
+ exit with status 2, and the driver facts in `target_open` are `{"available": false, "note": "premium feature not included in this build"}`.
150
+ To ask about Pro: open a thread in [GitHub Discussions](https://github.com/LiebertDev/red-harness/discussions).
151
+
152
+ ## Requirements
153
+ - **Windows 10 or 11, 64-bit** (developed and tested on Windows 10 Pro). The server, the engines and every static tool run
154
+ on any edition.
155
+ - **Python 3.12** (`py -3.12`). The only runtime dependency is the `mcp` SDK, pinned and installed by pip.
156
+ - **One analysis engine: Ghidra (free) or IDA Pro** (see "Engines"). No MCP tool works without an engine, because
157
+ `target_open` opens the target through it.
158
+ - **Windows Sandbox, only for the two tools that execute the target natively or run model code** (`run_controlled` and
159
+ `compute`). Windows Sandbox is part of Windows 10/11 **Pro, Enterprise and Education** (not Home); it needs hardware
160
+ virtualization enabled in the firmware and the optional Windows feature "Windows Sandbox" switched on (restart
161
+ required). Without it those two tools return `SANDBOX_UNAVAILABLE` and everything else keeps working. The sandbox gets
162
+ 2048 MB of memory by default (`RH_SANDBOX_MEMORY_MB`, 512 to 16384). `emulate` also executes target code, but in a CPU
163
+ emulator inside a restricted host process, not in Windows Sandbox; it is off by default.
164
+ - `compute` also needs a pinned embeddable CPython, installed once: `rh compute-runtime` prints the download address and the
165
+ expected SHA-256, then `rh compute-runtime install python-3.12.10-embed-amd64.zip`.
166
+ - Memory: the Ghidra engine runs a JVM with a 4 GB heap (6 GB job limit); the IDA engine is limited to 6 GB as well.
167
+
168
+ ## Optional components
169
+ Red Harness bundles **no** third-party engine or library. The optional pieces are obtained by you, from their own
170
+ publishers, under their own licences, and none of them is covered by Red Harness's Apache-2.0 licence:
171
+ Unicorn (`emulate`), Capstone, Ghidra, IDA Pro/Home, the CPython embeddable package for `compute`, and Windows Sandbox.
172
+ See `THIRD_PARTY_NOTICES.md` (what each is for, how to get it, its licence and upstream link) and `licenses/README.md`.
173
+
174
+ `rh deps list` shows each component, whether it is present, its licence and its upstream link. `rh deps install emulate`
175
+ (or `capstone`) prints the licence notice, asks for confirmation (`--yes` skips the question) and then runs
176
+ `pip install` for the pinned version; it installs nothing else. Ghidra and IDA are never installed by `rh`: `rh deps show ghidra`
177
+ prints where to get them and which environment variable points Red Harness at them.
178
+
179
+ ## Engines
180
+ Every MCP tool needs an analysis engine; choose one with `rh mcp --engine ghidra` or `rh mcp --engine ida`. Without the flag
181
+ the server starts the IDA engine. A requested engine that is not usable stops the server with the reason on stderr and in the
182
+ error answer to the client's `initialize` request; there is no silent fallback to the other engine.
183
+
184
+ **Ghidra (free).**
185
+ 1. Ghidra 12.1.3 (the version this project is tested with): download the zip from
186
+ <https://github.com/NationalSecurityAgency/ghidra/releases> and extract it anywhere.
187
+ 2. A JDK 21 (for example Eclipse Temurin 21), with `java` on `PATH` or `JAVA_HOME` set. Check with `java -version` in a new terminal.
188
+ 3. Tell the server where Ghidra is: set `RH_GHIDRA_DIR` (or `GHIDRA_INSTALL_DIR`) to the extracted folder, the one that
189
+ contains `support\analyzeHeadless.bat`. Without either variable the server looks for `ghidra_*` on your Desktop, for `ghidra*` in
190
+ your user folder and in `%ProgramFiles%`, and for `C:\ghidra*` (newest name first).
191
+ 4. Start the server with `rh mcp --engine ghidra`. The first open of a target runs Ghidra's full analysis once (minutes for a
192
+ large binary; about two and a half minutes for a 200 KB system program on a desktop PC); the result is cached under the data
193
+ root and later opens and queries reuse it.
194
+
195
+ **IDA.** IDA 9.x with a licence that includes `idalib` (IDA's headless library): the Pro editions. IDA Home and Classroom are listed by Hex-Rays as shipping idalib since 9.4; not yet tested by us. The Python package `idapro` that
196
+ talks to it is deliberately not a dependency of this project (its publisher on PyPI is unverified); install it from the wheel in
197
+ your IDA installation into the same environment as `red-harness-core`:
198
+ ```
199
+ .venv\Scripts\pip install "<IDA>\idalib\python\idapro-0.0.9-py3-none-any.whl"
200
+ ```
201
+ (With a `pipx` install: `pipx inject red-harness-core "<IDA>\idalib\python\idapro-0.0.9-py3-none-any.whl"`.)
202
+ `<IDA>` is for example `C:\Program Files\IDA Professional 9.4`. Use the exact file name you find in that folder (`dir "<IDA>\idalib\python"`);
203
+ pip does not accept a `*` wildcard there. Do not run `py-activate-idalib.py`. The IDA folder is found automatically under
204
+ `%ProgramFiles%\IDA Professional*` or from `RH_IDA_DIR` / `IDADIR`. The engine runs IDA in a separate Python process; if that
205
+ Python is not the one with `idapro`, set `RH_IDA_PYTHON` to it. Without `idapro`, `target_open` fails with `TOOL_MISSING` and
206
+ a message that says exactly this.
207
+
208
+ **What works without any engine:** none of the 18 MCP tools. The standalone scripts in `scripts/` need no engine and execute
209
+ nothing (see "Standalone static CLIs"), and so does `rh compute-runtime`.
210
+
211
+ ## Quickstart
212
+ This walk-through uses Ghidra and runs the same calls a model makes, from a small Python client that ships with the project.
213
+ Use a program you built or are authorized to analyze; below it is `C:\path\to\target.exe`.
214
+ ```
215
+ py -3.12 -m venv .venv
216
+ .venv\Scripts\pip install -e .
217
+ set RH_GHIDRA_DIR=C:\path\to\ghidra_12.1.3_PUBLIC
218
+ ```
219
+ (`set` is for cmd.exe; in PowerShell use `$env:RH_GHIDRA_DIR = "C:\path\to\ghidra_12.1.3_PUBLIC"`. Skip it if Ghidra sits in one
220
+ of the folders listed under "Engines".)
221
+ 1. SHA-256 of the target, lowercase (the manifest rejects upper case):
222
+ ```
223
+ powershell -NoProfile -Command "(Get-FileHash 'C:\path\to\target.exe' -Algorithm SHA256).Hash.ToLower()"
224
+ ```
225
+ 2. Write the scope manifest `scope.json` next to it. The hash binds the manifest to this exact file; `basis` is `owner` or
226
+ `authorized-test`; `allowed_operations` lists what the session may do (`static` is the minimum; `run_controlled` and
227
+ `compute` must be added explicitly); an optional `"expires": "2027-12-31"` limits its lifetime.
228
+ ```json
229
+ {
230
+ "schema": "rh.scope/1",
231
+ "target_sha256": "<the lowercase hash from step 1>",
232
+ "authorization": {
233
+ "declared_by": "Your Name / Your Company",
234
+ "basis": "owner",
235
+ "statement": "This binary belongs to us; static analysis is authorized."
236
+ },
237
+ "allowed_operations": ["static"]
238
+ }
239
+ ```
240
+ 3. Run the client (first open: Ghidra analyses the target once):
241
+ ```
242
+ .venv\Scripts\python scripts\quickstart_client.py C:\path\to\target.exe scope.json --engine ghidra
243
+ ```
244
+ It starts `rh mcp --engine ghidra`, lists the tools and makes five calls: `target_open(target_path, manifest_path)`,
245
+ `strings(limit=20, detail="full")`, `claim_add(kind="observation", text, evidence_ids, atoms)` quoting the first string it got
246
+ back, `coverage()` and `report_build()`. It ends with the path of the Markdown report, under
247
+ `<data root>\jobs\<job id>\report\`. A model client makes exactly these calls with the arguments named above; the
248
+ `claim_add` atoms are `{"type":"quote","evidence_id":"ev_...","text":"<string>"}` and
249
+ `{"type":"address","evidence_id":"ev_...","value":"0x..."}`.
250
+
251
+ ## Connect an MCP client
252
+ Use absolute paths. The server needs the engine settings in its environment.
253
+
254
+ Claude Code: copy `.mcp.json.example` to `.mcp.json` in your project folder, replace the placeholder paths, start Claude Code and
255
+ approve the `red-harness` server with `/mcp`.
256
+ ```json
257
+ {
258
+ "mcpServers": {
259
+ "red-harness": {
260
+ "type": "stdio",
261
+ "command": "C:\\path\\to\\red-harness\\.venv\\Scripts\\rh.exe",
262
+ "args": ["mcp", "--engine", "ghidra"],
263
+ "env": {"RH_GHIDRA_DIR": "C:\\path\\to\\ghidra_12.1.3_PUBLIC", "RH_DATA_ROOT": "C:\\path\\to\\RedHarnessData"}
264
+ }
265
+ }
266
+ }
267
+ ```
268
+ OpenAI Codex CLI (`~/.codex/config.toml`):
269
+ ```toml
270
+ [mcp_servers.red-harness]
271
+ command = 'C:\path\to\red-harness\.venv\Scripts\rh.exe'
272
+ args = ["mcp", "--engine", "ghidra"]
273
+ env = { RH_GHIDRA_DIR = 'C:\path\to\ghidra_12.1.3_PUBLIC', RH_DATA_ROOT = 'C:\path\to\RedHarnessData' }
274
+ ```
275
+ Any other stdio MCP client: run the command `C:\path\to\red-harness\.venv\Scripts\rh.exe` with the arguments `mcp --engine ghidra`
276
+ and the environment variables above. The protocol runs over the process's stdin and stdout (one JSON-RPC message per line), so
277
+ nothing else may write to stdout. `scripts/quickstart_client.py` is a complete example client built on the official `mcp` SDK.
278
+ The server side was verified with that SDK client; the client entries above follow those clients' documented formats.
279
+
280
+ If a client only says "connection closed", start the same command in a terminal: the reason is printed on stderr.
281
+
282
+ ## Development and tests
283
+ Install with the test extra and run the default suite (no engine and no Windows Sandbox needed):
284
+ ```
285
+ py -3.12 -m venv .venv
286
+ .venv\Scripts\pip install -e .[dev]
287
+ .venv\Scripts\python -m pytest -m "not heavy"
288
+ ```
289
+ - `heavy` tests need a real Ghidra/IDA or Windows Sandbox; they are not part of the default run.
290
+ - Unit tests point `RH_DATA_ROOT` at a temp directory; `RedHarnessData` or any other directory need not exist beforehand.
291
+ - Real Windows Sandbox tests run only with `RH_ALLOW_REAL_SANDBOX=1` (otherwise skipped).
292
+ - Engine paths and the `idapro` install are described under "Engines" above and in `docs/usage-mcp.md`.
293
+
294
+ ## Standalone static CLIs
295
+ Read-only helper in `scripts/` that needs no engine, no Windows Sandbox and executes nothing: `file_strings.py` (it prints its usage in its module docstring).
296
+
297
+ ## Scope
298
+ Use it only on targets you own or are explicitly authorized to test. The scope manifest is required, binds the target
299
+ SHA-256 and lists the effects (for example `run_controlled`, `compute`) a session may use.