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
@@ -38,6 +38,8 @@ review queue, presence and stop flags. Protocol:
|
||||
10. Before your session ends or your allowance runs out, write handoff(): finished, in flight, next.
|
||||
11. To read the original machine code use re_disassemble, re_xrefs, re_bytes and re_lookup: they read the project's
|
||||
own image with the team's current names, so do not write your own disassembler or offset maths.
|
||||
re_summary(address) gives the overview in one call: name, prototype, size, convention, readable status,
|
||||
callers and callees with their status, globals, strings, vtable slots and the Mac/Xbox hints.
|
||||
For Ghidra's view (decompiler, p-code, stack frames, struct field references, types) use ghidra_tools() once,
|
||||
then ghidra(tool, arguments): one shared read-only Ghidra session holding the team's annotations.
|
||||
To check a value in the running game (x87 control word, `this`, struct fields), use debugger_tools() and
|
||||
@@ -563,6 +565,14 @@ def re_lookup(target: str) -> dict:
|
||||
return _re(lambda r: r.lookup(target))
|
||||
|
||||
|
||||
@mcp.tool
|
||||
def re_summary(target: str) -> dict:
|
||||
"""One call before starting on a function: its current name and prototype, size and calling convention (read
|
||||
from the bytes), whether it is readable on main, its callers and callees with their names and whether each is
|
||||
readable on main, the globals and strings it uses, the vtable slots it fills, and the Mac/Xbox name hints."""
|
||||
return _re(lambda r: r.summary(target))
|
||||
|
||||
|
||||
_ghidra = {}
|
||||
|
||||
|
||||
@@ -692,6 +702,17 @@ def ghidra_tools() -> list:
|
||||
return _gh(lambda g: g.tools())
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
def ghidra_check() -> dict:
|
||||
"""Is the shared Ghidra session serving our program? Compares its address range with the project image's base
|
||||
and size, the SHA-256 of the file it imported with ours, and sample bytes; ok is false when any differs."""
|
||||
try:
|
||||
from .reverse import ghidra_check as check
|
||||
return check(harbor().project.reverse)
|
||||
except (HarborError, projects.ProjectError) as error:
|
||||
raise ToolError(str(error)) from None
|
||||
|
||||
|
||||
@mcp.tool()
|
||||
def ghidra(tool: str, arguments: dict | None = None) -> str:
|
||||
"""Run one tool in the shared read-only Ghidra session, e.g. ghidra('get_code', {'function': 'GetFogLevel',
|
||||
|
||||
Reference in new issue
Block a user