re_match: byte-match functions with the game's compiler (Visual C++ 2003)

Runs R:/Workspace/Tools/re/match71.py for up to 50 addresses from main or
an agent's worktree; configured by matcher/match_flags in [reverse].
This commit is contained in:
KeelrLeek committed 2026-10-05 13:10:01 -05:00
1 parent 584fabeb74
commit c7e678eacb
5 files changed
+78 -3

No files matched your search

+10 -3
View File
@@ -255,9 +255,10 @@ def build_parser():
p = sub.add_parser("who", help="who has worked on a scope (notes, reviews, claims, messages)")
p.add_argument("scope")
p = sub.add_parser("re", help="reverse-engineering lookups from the project's image and annotations")
p.add_argument("action", choices=["disasm", "xrefs", "bytes", "lookup", "ghidra", "ghidra-tools", "debugger-tools"])
p.add_argument("action", choices=["disasm", "xrefs", "bytes", "lookup", "ghidra", "ghidra-tools", "debugger-tools", "match"])
p.add_argument("target", nargs="?", default="", help="an address (0x4AD850) or a name; for ghidra, the tool")
p.add_argument("arguments", nargs="?", default="{}", help="ghidra: the tool's arguments as JSON")
p.add_argument("--decomp", help="match: the checkout or worktree to compile from")
p.add_argument("--max-bytes", type=int, dest="max_bytes")
p.add_argument("--count", type=int, default=16)
p.add_argument("--as", dest="as_type", default="hex", choices=["hex", "int32", "uint32", "float", "double", "string"])
@@ -675,8 +676,14 @@ def main(argv=None):
out(r, f"summary #{r['id']} pinned to {r['thread']}")
elif cmd == "re":
from .reverse import Ghidra, Reverse
r = None if args.action.startswith(("ghidra", "debugger")) else Reverse(harbor.project.reverse)
if args.action == "debugger-tools":
r = None if args.action.startswith(("ghidra", "debugger", "match")) else Reverse(harbor.project.reverse)
if args.action == "match":
from .reverse import match_functions
res = match_functions(harbor.project.reverse, args.target, args.decomp)
out(res, res["summary"] + "\n" + "\n".join(
f"{x['address']} {x['status']:<9} {x.get('similarity', '')!s:<6} {x['file']} {x.get('note', '')}"
for x in res["results"]))
elif args.action == "debugger-tools":
from .reverse import Debugger
res = Debugger(harbor.project.reverse).tools()
out(res, "\n".join(f"{t['name']:<22} {(t['description'] or '').splitlines()[0][:90] if t['description'] else ''}"