scientific-method-engine 1.0.0__tar.gz → 1.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-1.0.0 → scientific_method_engine-1.0.1}/PKG-INFO +1 -1
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/pyproject.toml +1 -1
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/x86/machine.py +8 -5
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/tests/test_x86.py +27 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/.gitignore +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/LICENSE +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/README.md +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/__init__.py +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/__main__.py +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/cli.py +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ClearNoReturnFunctions.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/CreateFunctions.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ExportBoundedFlow.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ExportCallEdges.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ExportFunctionFingerprints.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ExportFunctionInventory.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/MergeFallThroughFragment.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/RecoverCitedFunctions.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/RepairReturningCallers.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ReportCallArguments.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ReportCallPaths.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ReportCallSitesWithScalars.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ReportCallsToRange.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ReportConstantFirstArgumentCalls.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ReportDataBytes.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ReportDecompileMatches.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ReportDecompileWindow.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ReportFilePatternInMemory.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ReportFirstArgumentCallSummary.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ReportFunctionScalarConstants.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ReportFunctionSummary.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ReportInstructionContext.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ReportInstructionWindow.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ReportMemoryBlockForFileOffset.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ReportMemoryBlocks.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ReportRandomnessCandidates.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ReportReferences.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ReportScalarConstants.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ReportStringReferences.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/ghidra/ReportSymbolReferences.java +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/x86/__init__.py +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/x86/dispatch.py +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/x86/effect_order.py +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/x86/image.py +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/x86/pcode.py +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/x86/pcode_backend.py +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/x86/pe.py +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/x86/reports.py +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/x86/result_flow.py +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/x86/trace.py +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/src/scientific_method_engine/x86/values.py +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/tests/oracle.py +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/tests/test_dispatch.py +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/tests/test_effect_order.py +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/tests/test_nested_frame_request.py +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/tests/test_oracle.py +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/tests/test_pe.py +0 -0
- {scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/tests/test_table_continuations.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: scientific-method-engine
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.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 = "1.0.
|
|
8
|
+
version = "1.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"
|
|
@@ -67,7 +67,9 @@ class State:
|
|
|
67
67
|
self.assumptions = {}
|
|
68
68
|
self.flags = None
|
|
69
69
|
# Arithmetic flags as values from the last flag-writing instruction's p-code; None when no
|
|
70
|
-
# instruction computed them yet or the last one forgot them.
|
|
70
|
+
# instruction computed them yet or the last one forgot them. Branch conditions run their p-code
|
|
71
|
+
# on these values, and carry_value reads a comparable flag producer's CF from here without
|
|
72
|
+
# running a branch condition.
|
|
71
73
|
self.flag_values = None
|
|
72
74
|
# CF when an instruction sets it without leaving a comparable flag producer; None defers to flags.
|
|
73
75
|
self.carry = None
|
|
@@ -126,10 +128,11 @@ class State:
|
|
|
126
128
|
def carry_value(self):
|
|
127
129
|
"""CF as a one-bit value: from the last comparable flag producer, an explicit carry, or unknown."""
|
|
128
130
|
if self.flags is not None:
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
131
|
+
# The producer's p-code CF, read as JB's CBRANCH reads it: nonzero is set. Reading it here
|
|
132
|
+
# skips running the JB p-code and building the branch report each time CF is read.
|
|
133
|
+
carry = (self.flag_values or {}).get("CF")
|
|
134
|
+
if carry is not None and carry.number is not None:
|
|
135
|
+
return const(int(carry.number != 0), 1, self.flags[3])
|
|
133
136
|
# Name the carry by its producer's operands, so every reading of one comparison shares an assumption.
|
|
134
137
|
a, b, operation, site = self.flags
|
|
135
138
|
return unknown(f"carry:{site}:{(operation, a.term, b.term)!r}", 1, site)
|
|
@@ -1099,6 +1099,33 @@ class ReporterTests(unittest.TestCase):
|
|
|
1099
1099
|
self.assertEqual(report("ba 05 00 21 d8 83 d2 00 c3")["paths"][0]["registers"]["dx"]["value"], 5)
|
|
1100
1100
|
self.assertIn("Operand-size", report("b9 02 00 66 e2 fd c3")["paths"][0]["stop"])
|
|
1101
1101
|
|
|
1102
|
+
def test_carry_reads_the_producers_pcode_carry_without_a_branch_condition(self):
|
|
1103
|
+
from unittest import mock
|
|
1104
|
+
from scientific_method_engine.x86.pcode_backend import Pypcode
|
|
1105
|
+
|
|
1106
|
+
cases = [
|
|
1107
|
+
("b8 01 00 05 ff ff", 6), # ADD AX, 0FFFFh carries.
|
|
1108
|
+
("b8 01 00 05 01 00", 5), # ADD AX, 1 does not.
|
|
1109
|
+
("b8 01 00 bb 02 00 39 d8", 6), # CMP AX, BX borrows.
|
|
1110
|
+
("b8 02 00 bb 01 00 39 d8", 5), # CMP AX, BX does not.
|
|
1111
|
+
("b8 01 00 f7 d8", 6), # NEG of nonzero sets CF.
|
|
1112
|
+
("b8 00 00 f7 d8", 5), # NEG of zero clears it.
|
|
1113
|
+
]
|
|
1114
|
+
with mock.patch.object(Pypcode, "condition", autospec=True, side_effect=Pypcode.condition) as condition:
|
|
1115
|
+
for producer, dx in cases:
|
|
1116
|
+
with self.subTest(producer=producer):
|
|
1117
|
+
# The producer, MOV DX, 5 (flags untouched), ADC DX, 0.
|
|
1118
|
+
r = report(producer + " ba 05 00 83 d2 00 c3")
|
|
1119
|
+
self.assertEqual(r["paths"][0]["registers"]["dx"]["value"], dx)
|
|
1120
|
+
self.assertEqual(events(r, "arithmetic")[-1]["carryIn"]["value"], dx - 5)
|
|
1121
|
+
# An unknown producer's carry stays named by the producer's operands.
|
|
1122
|
+
unresolved = events(report("39 d8 83 d2 00 c3"), "arithmetic")[-1]["carryIn"]
|
|
1123
|
+
self.assertIsNone(unresolved["value"])
|
|
1124
|
+
condition.assert_not_called()
|
|
1125
|
+
# A JB still runs its own condition once; its assumption key reads CF without another.
|
|
1126
|
+
self.assertEqual(len(report("39 d8 72 00 c3")["paths"]), 2)
|
|
1127
|
+
self.assertEqual([call.args[2] for call in condition.call_args_list], ["jb"])
|
|
1128
|
+
|
|
1102
1129
|
def test_incoming_coverage_counts_straddled_segments_scan_limits_and_contested_starts(self):
|
|
1103
1130
|
data = bytes.fromhex("e8 01 00 c3 c3 e8 fc ff c3")
|
|
1104
1131
|
cfg = configuration(data, target=4, controls=[5], segments=[{"name": "code", "start": 0, "end": 6, "evidence": "synthetic segment"}])
|
|
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-1.0.0 → scientific_method_engine-1.0.1}/tests/test_effect_order.py
RENAMED
|
File without changes
|
{scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/tests/test_nested_frame_request.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scientific_method_engine-1.0.0 → scientific_method_engine-1.0.1}/tests/test_table_continuations.py
RENAMED
|
File without changes
|