scientific-method-engine 4.0.0__tar.gz → 4.0.1__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.
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/PKG-INFO +1 -1
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/pyproject.toml +1 -1
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/x86/reports.py +3 -3
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/x86/trace.py +25 -10
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/tests/test_continuation_budget.py +19 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/.gitignore +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/LICENSE +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/README.md +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/__init__.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/__main__.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/cli.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ClearNoReturnFunctions.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/CreateFunctions.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ExportBoundedFlow.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ExportCallEdges.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ExportFunctionFingerprints.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ExportFunctionInventory.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/MergeFallThroughFragment.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/RecoverCitedFunctions.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/RepairReturningCallers.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ReportCallArguments.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ReportCallPaths.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ReportCallSitesWithScalars.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ReportCallsToRange.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ReportConstantFirstArgumentCalls.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ReportDataBytes.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ReportDecompileMatches.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ReportDecompileWindow.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ReportFilePatternInMemory.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ReportFirstArgumentCallSummary.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ReportFunctionScalarConstants.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ReportFunctionSummary.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ReportInstructionContext.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ReportInstructionWindow.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ReportMemoryBlockForFileOffset.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ReportMemoryBlocks.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ReportRandomnessCandidates.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ReportReferences.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ReportScalarConstants.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ReportStringReferences.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/ghidra/ReportSymbolReferences.java +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/x86/__init__.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/x86/argument_frames.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/x86/dispatch.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/x86/effect_order.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/x86/image.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/x86/loops.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/x86/machine.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/x86/memory_scopes.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/x86/pcode.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/x86/pcode_backend.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/x86/pe.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/x86/relational.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/x86/result_flow.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/src/scientific_method_engine/x86/values.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/tests/oracle.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/tests/test_dispatch.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/tests/test_effect_order.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/tests/test_loops.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/tests/test_memory_scopes.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/tests/test_nested_frame_request.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/tests/test_oracle.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/tests/test_pe.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/tests/test_relational_controls.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/tests/test_table_continuations.py +0 -0
- {scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/tests/test_x86.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: scientific-method-engine
|
|
3
|
-
Version: 4.0.
|
|
3
|
+
Version: 4.0.1
|
|
4
4
|
Summary: Bounded instruction-derived x86 evidence reports for segmented MZ/FBOV and PE32/i386 code.
|
|
5
5
|
Project-URL: Source, https://github.com/kibertoad/refurbished-dinosaurs-toolkit/tree/main/packages/scientific-method-engine
|
|
6
6
|
Author: kibertoad
|
|
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "scientific-method-engine"
|
|
7
7
|
# The release workflow writes the published version from the package's release tag.
|
|
8
|
-
version = "4.0.
|
|
8
|
+
version = "4.0.1"
|
|
9
9
|
description = "Bounded instruction-derived x86 evidence reports for segmented MZ/FBOV and PE32/i386 code."
|
|
10
10
|
readme = "README.md"
|
|
11
11
|
requires-python = ">=3.12"
|
|
@@ -12,7 +12,7 @@ from .argument_frames import argument_frames, stack_cleanup
|
|
|
12
12
|
from .result_flow import return_flows
|
|
13
13
|
from .image import Image, integer
|
|
14
14
|
from .trace import (trace, walk, call_target, unsupported_transfer, uncovered, base_mnemonic, OVERLAP_REASON, CONTESTED_REASON,
|
|
15
|
-
RETURNS, INTERRUPTS, PORTS, PORT_INPUTS, port_width)
|
|
15
|
+
RETURNS, INTERRUPTS, PORTS, PORT_INPUTS, port_width, budget_input)
|
|
16
16
|
from .pcode_backend import interrupt_vector
|
|
17
17
|
|
|
18
18
|
|
|
@@ -217,9 +217,9 @@ def uses(image, config):
|
|
|
217
217
|
unverified = {g["site"] for g in gaps if g.get("reason") == OVERLAP_REASON} | set(contested)
|
|
218
218
|
matches, unresolved, unique = [], [], set()
|
|
219
219
|
# Trace each established entry independently; never decode a whole segment as one stream.
|
|
220
|
-
remaining =
|
|
220
|
+
remaining = budget_input(config, "totalSteps")
|
|
221
221
|
# One string iteration budget spans every traced entry, as totalSteps does.
|
|
222
|
-
string_remaining =
|
|
222
|
+
string_remaining = budget_input(config, "stringIterations")
|
|
223
223
|
entry_limit = integer(config.get("entryLimit", 64), 1, 256, "entryLimit")
|
|
224
224
|
# CFG points where value propagation stopped (or never started), with why; operands after them are inventoried below.
|
|
225
225
|
stops = {}
|
|
@@ -280,8 +280,23 @@ def snapshot(state):
|
|
|
280
280
|
|
|
281
281
|
|
|
282
282
|
STRING_BUDGET_STOP = "String iteration budget exhausted"
|
|
283
|
-
|
|
284
|
-
|
|
283
|
+
# The accepted range and default of each ordinary path budget input. continuationBudget takes the
|
|
284
|
+
# same ranges under the names in CONTINUATION_BUDGET_FIELDS, except that its paths may be 0.
|
|
285
|
+
PATH_BUDGET_INPUTS = {"maxPaths": (1, 256, 64), "totalSteps": (1, 100000, 20000), "maxSteps": (1, 10000, 512),
|
|
286
|
+
"visitLimit": (1, 4096, 4), "stringIterations": (0, 65536, 4096)}
|
|
287
|
+
CONTINUATION_BUDGET_FIELDS = {"paths": "maxPaths", "totalSteps": "totalSteps", "maxSteps": "maxSteps",
|
|
288
|
+
"visitLimit": "visitLimit", "stringIterations": "stringIterations"}
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
def budget_input(config, name):
|
|
292
|
+
"""Return the ordinary budget input name from config, or its default, rejecting out-of-range values."""
|
|
293
|
+
low, high, default = PATH_BUDGET_INPUTS[name]
|
|
294
|
+
return integer(config.get(name, default), low, high, name)
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
def continuation_range(field):
|
|
298
|
+
low, high, _ = PATH_BUDGET_INPUTS[CONTINUATION_BUDGET_FIELDS[field]]
|
|
299
|
+
return (0 if field == "paths" else low), high
|
|
285
300
|
|
|
286
301
|
|
|
287
302
|
def validate_continuation_budget(config):
|
|
@@ -289,11 +304,11 @@ def validate_continuation_budget(config):
|
|
|
289
304
|
budget = config.get("continuationBudget", {})
|
|
290
305
|
if not isinstance(budget, dict):
|
|
291
306
|
raise ValueError("continuationBudget must be an object")
|
|
292
|
-
unknown_keys = sorted(set(budget) - set(
|
|
307
|
+
unknown_keys = sorted(set(budget) - set(CONTINUATION_BUDGET_FIELDS))
|
|
293
308
|
if unknown_keys:
|
|
294
|
-
raise ValueError("continuationBudget accepts only " + ", ".join(
|
|
309
|
+
raise ValueError("continuationBudget accepts only " + ", ".join(CONTINUATION_BUDGET_FIELDS)
|
|
295
310
|
+ "; unknown: " + ", ".join(unknown_keys))
|
|
296
|
-
return {key: integer(value, *
|
|
311
|
+
return {key: integer(value, *continuation_range(key), "continuationBudget." + key)
|
|
297
312
|
for key, value in budget.items()}
|
|
298
313
|
|
|
299
314
|
|
|
@@ -311,8 +326,8 @@ def trace(image, config, continue_declared_jumps=True, track_loops=True):
|
|
|
311
326
|
entry = integer(config.get("entry"), 0, len(image.data) - 1, "entry")
|
|
312
327
|
if not any(entry in r["entries"] for r in image.regions):
|
|
313
328
|
raise ValueError("Trace entry must be an established region entry")
|
|
314
|
-
max_steps =
|
|
315
|
-
max_paths =
|
|
329
|
+
max_steps = budget_input(config, "maxSteps")
|
|
330
|
+
max_paths = budget_input(config, "maxPaths")
|
|
316
331
|
max_depth = integer(config.get("maxDepth", 8), 1, 32, "maxDepth")
|
|
317
332
|
integer(config.get("returnBytes", image.bits // 8), 2, 4, "returnBytes")
|
|
318
333
|
if config.get("returnBytes", image.bits // 8) not in ((4,) if image.flat else (2, 4)):
|
|
@@ -356,11 +371,11 @@ def trace(image, config, continue_declared_jumps=True, track_loops=True):
|
|
|
356
371
|
created = 1
|
|
357
372
|
total_steps = 0
|
|
358
373
|
total_string_steps = 0
|
|
359
|
-
string_limit =
|
|
360
|
-
total_limit =
|
|
374
|
+
string_limit = budget_input(config, "stringIterations")
|
|
375
|
+
total_limit = budget_input(config, "totalSteps")
|
|
361
376
|
checkpoints = set(config.get("checkpoints", []))
|
|
362
377
|
# How often one path may pass the same instruction; a loop with a known bound needs it raised.
|
|
363
|
-
visit_limit =
|
|
378
|
+
visit_limit = budget_input(config, "visitLimit")
|
|
364
379
|
# An unset field takes the value of the matching ordinary input.
|
|
365
380
|
continuation_budget = {"paths": max_paths, "totalSteps": total_limit, "maxSteps": max_steps,
|
|
366
381
|
"visitLimit": visit_limit, "stringIterations": string_limit, **explicit_continuation_budget}
|
{scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/tests/test_continuation_budget.py
RENAMED
|
@@ -174,6 +174,25 @@ class ContinuationBudgetTests(unittest.TestCase):
|
|
|
174
174
|
with self.assertRaises(ValueError, msg=budget):
|
|
175
175
|
run_report(data, {**config, "continuationBudget": budget}, "trace")
|
|
176
176
|
|
|
177
|
+
def test_each_field_accepts_the_range_of_its_ordinary_input(self):
|
|
178
|
+
data, config, _ = fan_out(1)
|
|
179
|
+
|
|
180
|
+
def accepted(change):
|
|
181
|
+
try:
|
|
182
|
+
run_report(data, {**config, **change}, "trace")
|
|
183
|
+
return True
|
|
184
|
+
except ValueError:
|
|
185
|
+
return False
|
|
186
|
+
|
|
187
|
+
fields = {"paths": "maxPaths", "totalSteps": "totalSteps", "maxSteps": "maxSteps",
|
|
188
|
+
"visitLimit": "visitLimit", "stringIterations": "stringIterations"}
|
|
189
|
+
for field, ordinary in fields.items():
|
|
190
|
+
for value in (-1, 0, 1, 2, 256, 257, 4096, 4097, 10000, 10001, 65536, 65537, 100000, 100001):
|
|
191
|
+
expected = accepted({ordinary: value}) or (field == "paths" and value == 0)
|
|
192
|
+
self.assertEqual(accepted({"continuationBudget": {field: value}}), expected, (field, value))
|
|
193
|
+
self.assertFalse(accepted({"maxPaths": 0}))
|
|
194
|
+
self.assertTrue(accepted({"continuationBudget": {"paths": 0}}))
|
|
195
|
+
|
|
177
196
|
|
|
178
197
|
if __name__ == "__main__":
|
|
179
198
|
unittest.main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/tests/test_effect_order.py
RENAMED
|
File without changes
|
|
File without changes
|
{scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/tests/test_memory_scopes.py
RENAMED
|
File without changes
|
{scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/tests/test_nested_frame_request.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/tests/test_relational_controls.py
RENAMED
|
File without changes
|
{scientific_method_engine-4.0.0 → scientific_method_engine-4.0.1}/tests/test_table_continuations.py
RENAMED
|
File without changes
|
|
File without changes
|