scientific-method-engine 2.1.0__tar.gz → 2.2.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.
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/PKG-INFO +1 -1
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/pyproject.toml +1 -1
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/x86/reports.py +26 -10
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/tests/test_x86.py +71 -4
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/.gitignore +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/LICENSE +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/README.md +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/__init__.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/__main__.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/cli.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ClearNoReturnFunctions.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/CreateFunctions.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ExportBoundedFlow.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ExportCallEdges.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ExportFunctionFingerprints.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ExportFunctionInventory.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/MergeFallThroughFragment.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/RecoverCitedFunctions.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/RepairReturningCallers.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ReportCallArguments.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ReportCallPaths.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ReportCallSitesWithScalars.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ReportCallsToRange.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ReportConstantFirstArgumentCalls.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ReportDataBytes.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ReportDecompileMatches.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ReportDecompileWindow.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ReportFilePatternInMemory.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ReportFirstArgumentCallSummary.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ReportFunctionScalarConstants.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ReportFunctionSummary.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ReportInstructionContext.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ReportInstructionWindow.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ReportMemoryBlockForFileOffset.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ReportMemoryBlocks.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ReportRandomnessCandidates.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ReportReferences.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ReportScalarConstants.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ReportStringReferences.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/ghidra/ReportSymbolReferences.java +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/x86/__init__.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/x86/dispatch.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/x86/effect_order.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/x86/image.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/x86/machine.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/x86/memory_scopes.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/x86/pcode.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/x86/pcode_backend.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/x86/pe.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/x86/result_flow.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/x86/trace.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/src/scientific_method_engine/x86/values.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/tests/oracle.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/tests/test_dispatch.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/tests/test_effect_order.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/tests/test_memory_scopes.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/tests/test_nested_frame_request.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/tests/test_oracle.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/tests/test_pe.py +0 -0
- {scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/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: 2.
|
|
3
|
+
Version: 2.2.0
|
|
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 = "2.
|
|
8
|
+
version = "2.2.0"
|
|
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"
|
|
@@ -1052,19 +1052,22 @@ def _ghidra_call_edges(image, export):
|
|
|
1052
1052
|
return integer(value, 0, len(image.data) - 1, "Ghidra " + label + " file offset")
|
|
1053
1053
|
callers, unmapped, total = {}, [], 0
|
|
1054
1054
|
for function in functions:
|
|
1055
|
-
|
|
1055
|
+
# The script writes every key, with null for an address that has no file bytes. A missing key is a malformed export.
|
|
1056
|
+
if (not isinstance(function, dict) or "entry" not in function or not isinstance(function.get("address"), str)
|
|
1057
|
+
or not isinstance(function.get("edges"), list)):
|
|
1056
1058
|
raise ValueError("Invalid ghidraCallEdges function")
|
|
1057
1059
|
total += len(function["edges"])
|
|
1058
1060
|
if total > 8192:
|
|
1059
1061
|
raise ValueError("ghidraCallEdges holds more than 8192 edges")
|
|
1060
1062
|
rows = []
|
|
1061
1063
|
for edge in function["edges"]:
|
|
1062
|
-
if (not isinstance(edge, dict) or not
|
|
1063
|
-
or not (edge.get("
|
|
1064
|
+
if (not isinstance(edge, dict) or not {"site", "target", "targetAddress"} <= edge.keys()
|
|
1065
|
+
or not isinstance(edge.get("siteAddress"), str) or not isinstance(edge.get("flow"), str)
|
|
1066
|
+
or not (edge["targetAddress"] is None or isinstance(edge["targetAddress"], str))):
|
|
1064
1067
|
raise ValueError("Invalid ghidraCallEdges edge")
|
|
1065
|
-
rows.append({"site": offset(edge
|
|
1066
|
-
"target": offset(edge
|
|
1067
|
-
entry = offset(function
|
|
1068
|
+
rows.append({"site": offset(edge["site"], "site"), "siteAddress": edge["siteAddress"],
|
|
1069
|
+
"target": offset(edge["target"], "target"), "targetAddress": edge["targetAddress"], "flow": edge["flow"]})
|
|
1070
|
+
entry = offset(function["entry"], "entry")
|
|
1068
1071
|
if entry is None:
|
|
1069
1072
|
unmapped.append(function["address"])
|
|
1070
1073
|
elif entry in callers:
|
|
@@ -1094,6 +1097,7 @@ def _ghidra_cross_check(export, nodes, outgoing, omitted):
|
|
|
1094
1097
|
for caller in compared:
|
|
1095
1098
|
ours = outgoing.get(caller, [])
|
|
1096
1099
|
theirs = callers[caller]
|
|
1100
|
+
instructions = nodes[caller]["body"]["instructions"]
|
|
1097
1101
|
# A call neither analysis resolved matches on its site with no target.
|
|
1098
1102
|
flows = {_ghidra_key(g): g["flow"] for g in theirs if g["site"] is not None}
|
|
1099
1103
|
read = {(e["site"], e["target"]) for e in ours}
|
|
@@ -1104,11 +1108,20 @@ def _ghidra_cross_check(export, nodes, outgoing, omitted):
|
|
|
1104
1108
|
for g in theirs:
|
|
1105
1109
|
if g["site"] is not None and _ghidra_key(g) in read:
|
|
1106
1110
|
continue
|
|
1111
|
+
ins = instructions.get(g["site"])
|
|
1112
|
+
if ins is not None and base_mnemonic(ins) in INTERRUPTS and _ghidra_key(g)[1] is None:
|
|
1113
|
+
# SLEIGH lifts INT, INT1, INT3 and INTO to a computed call with no target, while the engine assumes the
|
|
1114
|
+
# interrupt returns to the next instruction and records no edge. At INT1 and INT3 Ghidra's flow is a
|
|
1115
|
+
# terminator that ends the function there.
|
|
1116
|
+
rows.append({"caller": caller, "site": g["site"], "target": None, "siteAddress": g["siteAddress"],
|
|
1117
|
+
"targetAddress": None, "ghidraFlow": g["flow"], "result": "interrupt", "engineEdge": None,
|
|
1118
|
+
"ghidraFallsThrough": "TERMINATOR" not in g["flow"]})
|
|
1119
|
+
continue
|
|
1107
1120
|
# Ghidra's edge is evidence the engine did not check; it never becomes an engine edge.
|
|
1108
1121
|
rows.append({"caller": caller, "site": g["site"], "target": g["target"], "siteAddress": g["siteAddress"],
|
|
1109
1122
|
"targetAddress": g["targetAddress"], "ghidraFlow": g["flow"], "result": "ghidraOnly", "checked": False,
|
|
1110
1123
|
"engineEdge": next((e["id"] for e in ours if g["site"] is not None and e["site"] == g["site"]), None)})
|
|
1111
|
-
counts = {kind: sum(r["result"] == kind for r in rows) for kind in ("agreement", "engineOnly", "ghidraOnly")}
|
|
1124
|
+
counts = {kind: sum(r["result"] == kind for r in rows) for kind in ("agreement", "engineOnly", "ghidraOnly", "interrupt")}
|
|
1112
1125
|
not_compared = {"engineCallers": sorted(nodes.keys() - callers.keys()), "ghidraCallers": sorted(callers.keys() - nodes.keys()),
|
|
1113
1126
|
"unmappedGhidraFunctions": export["unmappedFunctions"], "missingGhidraEntries": export["missingEntries"],
|
|
1114
1127
|
"unreadGhidraFunctions": export["unreadFunctions"],
|
|
@@ -1116,12 +1129,15 @@ def _ghidra_cross_check(export, nodes, outgoing, omitted):
|
|
|
1116
1129
|
# A site agrees only when every edge either analysis read there agrees.
|
|
1117
1130
|
disputed = {r["site"] for r in rows if r["result"] != "agreement"}
|
|
1118
1131
|
return {"comparedCallers": compared, "edges": rows, "counts": counts, "notCompared": not_compared,
|
|
1119
|
-
"agreed": not counts["engineOnly"] and not counts["ghidraOnly"] and not any(not_compared.values())
|
|
1132
|
+
"agreed": (not counts["engineOnly"] and not counts["ghidraOnly"] and not any(not_compared.values())
|
|
1133
|
+
and all(r["ghidraFallsThrough"] for r in rows if r["result"] == "interrupt")),
|
|
1120
1134
|
"agreementSites": {r["site"] for r in rows if r["result"] == "agreement"} - disputed,
|
|
1121
1135
|
"interpretation": "Edges of each caller that both the engine and the Ghidra export read, matched by site and target "
|
|
1122
1136
|
"file offset; an unresolved call matches an unresolved call at its site, and a Ghidra target without a file offset "
|
|
1123
|
-
"matches no engine edge.
|
|
1124
|
-
"
|
|
1137
|
+
"matches no engine edge. An interrupt row is Ghidra's targetless call at an instruction the engine read as an "
|
|
1138
|
+
"interrupt and assumed to return; it counts against agreed only when Ghidra's flow ends the function there. "
|
|
1139
|
+
"A ghidraOnly edge is Ghidra's claim: the engine did not check it and never adds it to its graph. Agreement "
|
|
1140
|
+
"means both analyses read the edge, not that it executes."}
|
|
1125
1141
|
|
|
1126
1142
|
|
|
1127
1143
|
# These branches test CX/ECX (LOOPE/LOOPNE also ZF), so an adjacent CMP/TEST never describes their predicate.
|
|
@@ -406,7 +406,7 @@ class GhidraCrossCheckTests(unittest.TestCase):
|
|
|
406
406
|
# Ghidra's computed target never becomes an engine edge.
|
|
407
407
|
self.assertIsNone(r["edges"][2]["target"])
|
|
408
408
|
self.assertEqual(r["edges"][2]["classification"], "unresolved")
|
|
409
|
-
self.assertEqual(check["counts"], {"agreement": 1, "engineOnly": 2, "ghidraOnly": 1})
|
|
409
|
+
self.assertEqual(check["counts"], {"agreement": 1, "engineOnly": 2, "ghidraOnly": 1, "interrupt": 0})
|
|
410
410
|
self.assertEqual(check["comparedCallers"], [0, b])
|
|
411
411
|
self.assertEqual(check["notCompared"]["engineCallers"], [a])
|
|
412
412
|
self.assertFalse(check["agreed"])
|
|
@@ -420,7 +420,7 @@ class GhidraCrossCheckTests(unittest.TestCase):
|
|
|
420
420
|
r = run_report(data, cfg, "callees")
|
|
421
421
|
check = r["ghidraCrossCheck"]
|
|
422
422
|
self.assertTrue(check["agreed"])
|
|
423
|
-
self.assertEqual(check["counts"], {"agreement": 2, "engineOnly": 0, "ghidraOnly": 0})
|
|
423
|
+
self.assertEqual(check["counts"], {"agreement": 2, "engineOnly": 0, "ghidraOnly": 0, "interrupt": 0})
|
|
424
424
|
# Agreement on an unresolved call leaves the engine's edge unresolved.
|
|
425
425
|
self.assertEqual(r["edges"][1]["classification"], "unresolved")
|
|
426
426
|
|
|
@@ -432,12 +432,64 @@ class GhidraCrossCheckTests(unittest.TestCase):
|
|
|
432
432
|
cfg = configuration(data, ghidraCallEdges=export)
|
|
433
433
|
cfg["regions"][0]["entries"] = [0, 6]
|
|
434
434
|
check = run_report(data, cfg, "callees")["ghidraCrossCheck"]
|
|
435
|
-
self.assertEqual(check["counts"], {"agreement": 1, "engineOnly": 1, "ghidraOnly": 1})
|
|
435
|
+
self.assertEqual(check["counts"], {"agreement": 1, "engineOnly": 1, "ghidraOnly": 1, "interrupt": 0})
|
|
436
436
|
self.assertFalse(check["agreed"])
|
|
437
437
|
cfg["controls"] = {"ghidraAgreementSites": [3]}
|
|
438
438
|
with self.assertRaisesRegex(ValueError, "positive control missed: ghidraAgreementSites"):
|
|
439
439
|
run_report(data, cfg, "callees")
|
|
440
440
|
|
|
441
|
+
def test_interrupts_ghidra_lifts_to_targetless_calls_do_not_break_agreement(self):
|
|
442
|
+
# int 21h; into; call 8; ret; ret. Ghidra's SLEIGH lifts each interrupt to a computed call with no
|
|
443
|
+
# target; the engine assumes each returns to the next instruction and has no edge there.
|
|
444
|
+
data = bytes.fromhex("cd 21 ce e8 01 00 c3 c3")
|
|
445
|
+
edges = [(0, None, "COMPUTED_CALL"), (2, None, "CONDITIONAL_COMPUTED_CALL"), (3, 7, "UNCONDITIONAL_CALL")]
|
|
446
|
+
cfg = configuration(data, ghidraCallEdges=ghidra_export(data, {0: edges, 7: []}), controls={"ghidraAgreementSites": [3]})
|
|
447
|
+
cfg["regions"][0]["entries"] = [0, 7]
|
|
448
|
+
r = run_report(data, cfg, "callees")
|
|
449
|
+
check = r["ghidraCrossCheck"]
|
|
450
|
+
self.assertTrue(check["agreed"])
|
|
451
|
+
self.assertEqual(check["counts"], {"agreement": 1, "engineOnly": 0, "ghidraOnly": 0, "interrupt": 2})
|
|
452
|
+
rows = [e for e in check["edges"] if e["result"] == "interrupt"]
|
|
453
|
+
self.assertEqual([(e["site"], e["ghidraFallsThrough"]) for e in rows], [(0, True), (2, True)])
|
|
454
|
+
self.assertEqual([e["site"] for e in r["edges"]], [3])
|
|
455
|
+
# An interrupt site is never an agreement site.
|
|
456
|
+
cfg["controls"] = {"ghidraAgreementSites": [0]}
|
|
457
|
+
with self.assertRaisesRegex(ValueError, "positive control missed: ghidraAgreementSites"):
|
|
458
|
+
run_report(data, cfg, "callees")
|
|
459
|
+
|
|
460
|
+
def test_an_interrupt_ghidra_ends_the_function_at_leaves_the_graphs_disagreeing(self):
|
|
461
|
+
# int3; call 5; ret; ret, and the same with int1. Ghidra ends the function at the interrupt, so its export
|
|
462
|
+
# stops there, while the engine assumes the interrupt returns and reads the call after it.
|
|
463
|
+
for opcode in ("cc", "f1"):
|
|
464
|
+
with self.subTest(opcode=opcode):
|
|
465
|
+
data = bytes.fromhex(opcode + " e8 01 00 c3 c3")
|
|
466
|
+
cfg = configuration(data, ghidraCallEdges=ghidra_export(data, {0: [(0, None, "COMPUTED_CALL_TERMINATOR")], 5: []}))
|
|
467
|
+
cfg["regions"][0]["entries"] = [0, 5]
|
|
468
|
+
check = run_report(data, cfg, "callees")["ghidraCrossCheck"]
|
|
469
|
+
self.assertEqual(sorted((e["site"], e["result"]) for e in check["edges"]), [(0, "interrupt"), (1, "engineOnly")])
|
|
470
|
+
self.assertFalse(next(e for e in check["edges"] if e["result"] == "interrupt")["ghidraFallsThrough"])
|
|
471
|
+
self.assertFalse(check["agreed"])
|
|
472
|
+
# With nothing after it, the terminator alone still keeps agreed false: the analyses disagree on the extent.
|
|
473
|
+
data = bytes.fromhex("cc c3")
|
|
474
|
+
cfg = configuration(data, ghidraCallEdges=ghidra_export(data, {0: [(0, None, "COMPUTED_CALL_TERMINATOR")]}))
|
|
475
|
+
check = run_report(data, cfg, "callees")["ghidraCrossCheck"]
|
|
476
|
+
self.assertEqual(check["counts"], {"agreement": 0, "engineOnly": 0, "ghidraOnly": 0, "interrupt": 1})
|
|
477
|
+
self.assertFalse(check["agreed"])
|
|
478
|
+
|
|
479
|
+
def test_a_ghidra_target_at_an_interrupt_or_a_targetless_call_elsewhere_stays_ghidra_only(self):
|
|
480
|
+
# int 21h; int 10h; nop; call 8; ret. Ghidra resolves the first interrupt to a file offset and the second to an
|
|
481
|
+
# address without file bytes, and claims a call at the nop.
|
|
482
|
+
data = bytes.fromhex("cd 21 cd 10 90 e8 00 00 c3")
|
|
483
|
+
export = ghidra_export(data, {0: [(0, 8, "COMPUTED_CALL"), (2, None, "COMPUTED_CALL"), (4, None, "COMPUTED_CALL"),
|
|
484
|
+
(5, 8, "UNCONDITIONAL_CALL")], 8: []})
|
|
485
|
+
export["functions"][0]["edges"][1]["targetAddress"] = "0000:0040"
|
|
486
|
+
cfg = configuration(data, ghidraCallEdges=export)
|
|
487
|
+
cfg["regions"][0]["entries"] = [0, 8]
|
|
488
|
+
check = run_report(data, cfg, "callees")["ghidraCrossCheck"]
|
|
489
|
+
self.assertEqual(sorted((e["site"], e["result"]) for e in check["edges"]),
|
|
490
|
+
[(0, "ghidraOnly"), (2, "ghidraOnly"), (4, "ghidraOnly"), (5, "agreement")])
|
|
491
|
+
self.assertFalse(check["agreed"])
|
|
492
|
+
|
|
441
493
|
def test_routes_the_edge_limit_omitted_are_not_compared(self):
|
|
442
494
|
# call 6; call bx; ret; ret. Ghidra misses call bx, and the engine omits it at the edge limit.
|
|
443
495
|
data = bytes.fromhex("e8 03 00 ff d3 c3 c3")
|
|
@@ -445,7 +497,7 @@ class GhidraCrossCheckTests(unittest.TestCase):
|
|
|
445
497
|
cfg["regions"][0]["entries"] = [0, 6]
|
|
446
498
|
r = run_report(data, cfg, "callees")
|
|
447
499
|
check = r["ghidraCrossCheck"]
|
|
448
|
-
self.assertEqual(check["counts"], {"agreement": 1, "engineOnly": 0, "ghidraOnly": 0})
|
|
500
|
+
self.assertEqual(check["counts"], {"agreement": 1, "engineOnly": 0, "ghidraOnly": 0, "interrupt": 0})
|
|
449
501
|
self.assertEqual(check["notCompared"]["omittedEngineRoutes"], [r["omittedRoutes"][0]["id"]])
|
|
450
502
|
self.assertFalse(check["agreed"])
|
|
451
503
|
|
|
@@ -480,6 +532,21 @@ class GhidraCrossCheckTests(unittest.TestCase):
|
|
|
480
532
|
with self.subTest(message=message), self.assertRaisesRegex(ValueError, message):
|
|
481
533
|
run_report(data, configuration(data, ghidraCallEdges=export), "callees")
|
|
482
534
|
|
|
535
|
+
def test_a_missing_offset_key_is_a_malformed_export(self):
|
|
536
|
+
# The script writes null for an address without file bytes; a key it never left out is malformed, never unmapped.
|
|
537
|
+
data = self.code.bytes()
|
|
538
|
+
cases = []
|
|
539
|
+
for key in ("site", "target", "targetAddress"):
|
|
540
|
+
export = ghidra_export(data, {0: [(0, None, "COMPUTED_CALL")]})
|
|
541
|
+
del export["functions"][0]["edges"][0][key]
|
|
542
|
+
cases.append((export, "Invalid ghidraCallEdges edge"))
|
|
543
|
+
export = ghidra_export(data, {0: []})
|
|
544
|
+
del export["functions"][0]["entry"]
|
|
545
|
+
cases.append((export, "Invalid ghidraCallEdges function"))
|
|
546
|
+
for export, message in cases:
|
|
547
|
+
with self.subTest(message=message), self.assertRaisesRegex(ValueError, message):
|
|
548
|
+
run_report(data, configuration(data, ghidraCallEdges=export), "callees")
|
|
549
|
+
|
|
483
550
|
|
|
484
551
|
class OperandCandidateTests(unittest.TestCase):
|
|
485
552
|
def test_prefix_width_and_overlap_candidates_do_not_invent_a_second_use(self):
|
|
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-2.1.0 → scientific_method_engine-2.2.0}/tests/test_effect_order.py
RENAMED
|
File without changes
|
{scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/tests/test_memory_scopes.py
RENAMED
|
File without changes
|
{scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/tests/test_nested_frame_request.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{scientific_method_engine-2.1.0 → scientific_method_engine-2.2.0}/tests/test_table_continuations.py
RENAMED
|
File without changes
|