Make Binary Ninja integration not dependent on IDA integration to work (#2896)

* get rid of unnecessary call in binja integration

* don't rely on ida to adjust xmlrpc marshaller

* only inject xmlrpc.client in init func

The call to .exe() is removed. Previously, we used it to get the exe base, but since the code uses pwndbg.aglib.proc.binary_base_addr now there's no point in the extra function call.
pull/2908/head
Jason An 8 months ago committed by GitHub
parent 18755282e7
commit 177ff2a2bf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -87,6 +87,9 @@ def init_bn_rpc_client() -> None:
if pwndbg.integration.provider_name.value != "binja":
return
xmlrpc.client.MAXINT = 10**100 # type: ignore[misc]
xmlrpc.client.MININT = -(10**100) # type: ignore[misc]
now = time.time()
if _bn is None and (now - _bn_last_connection_check) < int(bn_timeout) + 5:
return
@ -189,17 +192,11 @@ def can_connect() -> bool:
def l2r(addr: int) -> int:
exe = pwndbg.aglib.elf.exe()
if not exe:
raise Exception("Can't find EXE base")
result = (addr - pwndbg.aglib.proc.binary_base_addr + base()) & pwndbg.aglib.arch.ptrmask
return result
def r2l(addr: int) -> int:
exe = pwndbg.aglib.elf.exe()
if not exe:
raise Exception("Can't find EXE base")
result = (addr - base() + pwndbg.aglib.proc.binary_base_addr) & pwndbg.aglib.arch.ptrmask
return result

@ -42,8 +42,6 @@ ida_rpc_host = pwndbg.config.add_param("ida-rpc-host", "127.0.0.1", "ida xmlrpc
ida_rpc_port = pwndbg.config.add_param("ida-rpc-port", 31337, "ida xmlrpc server port")
ida_timeout = pwndbg.config.add_param("ida-timeout", 2, "time to wait for ida xmlrpc in seconds")
xmlrpc.client.Marshaller.dispatch[int] = lambda _, v, w: w("<value><i8>%d</i8></value>" % v)
_ida: xmlrpc.client.ServerProxy | None = None
@ -65,6 +63,9 @@ def init_ida_rpc_client() -> None:
if pwndbg.integration.provider_name.value != "ida":
return
xmlrpc.client.MAXINT = 10**100 # type: ignore[misc]
xmlrpc.client.MININT = -(10**100) # type: ignore[misc]
now = time.time()
if _ida is None and (now - _ida_last_connection_check) < int(ida_timeout) + 5:
return

Loading…
Cancel
Save