Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to put arguments in remote_eval? #60

Open
Animeshz opened this issue Jul 9, 2021 · 0 comments
Open

How to put arguments in remote_eval? #60

Animeshz opened this issue Jul 9, 2021 · 0 comments

Comments

@Animeshz
Copy link

Animeshz commented Jul 9, 2021

This does not run as expected:

import ghidra_bridge

with ghidra_bridge.GhidraBridge(namespace=globals()) as bridge:
    symbol_type = bridge.remote_import('ghidra.program.model.symbol.SymbolType')

    regex = re.compile(r'^PTR_(?:FUN|DAT|LOOP)_\d+$')
    symbols = currentProgram.getSymbolTable().getAllSymbols(True)

    symbols = bridge.remote_eval("next((sym for sym in symbols if sym.getSymbolType() == SymbolType.LABEL and r.match(sym.getName())), False)", symbols=symbols, SymbolType=symbol_type, r=regex)

Following exception occurs when tried to run it:

jfx_bridge.bridge.BridgeException: ("global name 'SymbolType' is not defined", <_bridged_exceptions.NameError('NameError("global name 'SymbolType' is not defined",)', type=exceptions.NameError, handle=6a1e7a2e-374e-4a81-8303-f6c5deac146d)>)

# if changed SymbolType to qualified ghidra.program.model.symbol.SymbolType in remote_eval()
jfx_bridge.bridge.BridgeException: ("global name 'r' is not defined", <_bridged_exceptions.NameError('NameError("global name 'r' is not defined",)', type=exceptions.NameError, handle=a55f35e3-47a1-4071-92f9-26b04a055a7f)>)

How to properly send arguments to evals, also is there a way to put multiple lines in remote_eval? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant