forked from Keelrleek/Harbor
re_summary: one call for a function's name, prototype, size, convention, readable status, callers and callees with their status, globals, strings, vtable slots and Mac/Xbox hints (harbor re summary); ghidra_check: confirm the shared Ghidra server serves our image (address range, byte samples, SHA-256 when the imported file is readable) (harbor re ghidra-check)
This commit is contained in:
1 parent
57fb31f2d6
commit
21b7fedb6f
4 files changed
+366
-1
No files matched your search
+16
-1
@@ -255,7 +255,7 @@ 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", "match", "similar", "struct-audit", "behaviour"])
|
||||
p.add_argument("action", choices=["disasm", "xrefs", "bytes", "lookup", "summary", "ghidra", "ghidra-tools", "ghidra-check", "debugger-tools", "match", "similar", "struct-audit", "behaviour"])
|
||||
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")
|
||||
@@ -722,6 +722,21 @@ def main(argv=None):
|
||||
elif args.action == "ghidra-tools":
|
||||
res = Ghidra(harbor.project.reverse).tools()
|
||||
out(res, "\n".join(f"{t['name']:<26} {t['description'].splitlines()[0][:90]}" for t in res))
|
||||
elif args.action == "ghidra-check":
|
||||
from .reverse import ghidra_check
|
||||
res = ghidra_check(harbor.project.reverse)
|
||||
mark = lambda ok: "ok " if ok else ("?? " if ok is None else "FAIL")
|
||||
out(res, "\n".join(
|
||||
[f"{'Ghidra serves our program' if res['ok'] else 'Ghidra does NOT serve our program'}: "
|
||||
f"{res['program']} ({res['functions_in_ghidra']} functions); image {res['image_base']}, "
|
||||
f"{res['image_size']} bytes, sha256 {res['image_sha256'][:16]}..."] +
|
||||
[f" {mark(c['ok'])} {c['check']}: " + (f"expected {c['expected']}, Ghidra {c['ghidra']}" if "ghidra" in c
|
||||
else ("differs at " + ", ".join(c["differ_at"]) if c.get("differ_at") else "all equal"))
|
||||
for c in res["checks"]]))
|
||||
elif args.action == "summary":
|
||||
from .reverse import format_summary
|
||||
res = r.summary(args.target)
|
||||
out(res, format_summary(res))
|
||||
elif args.action == "ghidra":
|
||||
text = Ghidra(harbor.project.reverse).call(args.target, json.loads(args.arguments))
|
||||
out({"result": text}, text)
|
||||
|
||||
Reference in new issue
Block a user