forked from Keelrleek/Harbor
re_similar, re_struct_audit; next_functions favours raw functions with a readable near-duplicate
This commit is contained in:
1 parent
2d2f5fe7c5
commit
07a031109b
4 files changed
+65
-4
No files matched your search
+8
-3
@@ -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"])
|
||||
p.add_argument("action", choices=["disasm", "xrefs", "bytes", "lookup", "ghidra", "ghidra-tools", "debugger-tools", "match", "similar", "struct-audit"])
|
||||
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")
|
||||
@@ -684,7 +684,12 @@ def main(argv=None):
|
||||
elif cmd == "re":
|
||||
from .reverse import Ghidra, Reverse
|
||||
r = None if args.action.startswith(("ghidra", "debugger", "match")) else Reverse(harbor.project.reverse)
|
||||
if args.action == "match":
|
||||
if args.action in ("similar", "struct-audit"):
|
||||
from .reverse import run_toolkit
|
||||
res = (run_toolkit(harbor.project.reverse, "similar", [args.target]) if args.action == "similar" else
|
||||
run_toolkit(harbor.project.reverse, "struct_audit", ["--struct", args.target], json_to_file=True))
|
||||
out(res, json.dumps(res, indent=1))
|
||||
elif 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(
|
||||
@@ -717,7 +722,7 @@ def main(argv=None):
|
||||
from .queue import FunctionQueue
|
||||
q = FunctionQueue(harbor)
|
||||
if cmd == "next-functions":
|
||||
rows = q.next_functions(who(), args.n)
|
||||
rows = q.next_functions(who(), args.n, similar_readable=q.similar_readable())
|
||||
out(rows, "\n".join(f"{r['address']:<10} {r['score']:<7} {(r['name'] or r['file'] or ''):<34} {r['why']}"
|
||||
for r in rows))
|
||||
elif cmd == "defer":
|
||||
|
||||
Reference in new issue
Block a user