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

Question: How to analyze a big file using ghidra_bridge, without a timeout exception? #48

Closed
TylerKann opened this issue Jul 4, 2020 · 3 comments

Comments

@TylerKann
Copy link

In ghidra_bridge I tried the following commands:

import ghidra_bridge b = ghidra_bridge.GhidraBridge(namespace=globals()) analyze(currentProgram)
Although this does start the analysis, I get a timeout before it completes it (its a big file). Is there any way I can do analysis remotely without a timeout?

Thanks!

@justfoxing
Copy link
Owner

So, you've got two options (now).

Either you can create your bridge with a specific response_timeout value in seconds (e.g., b = ghidra_bridge.GhidraBridge(namespace=globals(), response_timeout=<value>)) to control the timeout for every command in the script, or you can use remote_eval with the timeout_override argument to just affect the one command (e.g., b.bridge.remote_eval("analyze(currentProgram)", timeout_override=<value>)).

Like you suggest, analyze() can take arbitrarily long based on program size, so I've just added functionality in jfx_bridge version 0.3.3 (the RPC package ghidra_bridge is built on), so you can specify -1 for the response_timeout/timeout_override values. This will disable the timeout and cause the bridge to wait forever until it gets a response.

You'll need to make sure you've updated jfx_bridge in your client environment (you don't need to update the code on the Ghidra side for this to work), so do pip install jfx_bridge --upgrade and make sure you've got version 0.3.3.

As a side note, I noticed analyze() behave a little weirdly as I was testing, just mentioning so it doesn't catch you out: The first call to analyze() will block until analysis is complete as you expect, but if you call it again without saving the changes or closing and re-opening the program, calling analyze() will start the analysis, but return immediately before it finishes. No idea why, #justGhidraThings.

@TylerKann
Copy link
Author

Yeah that analyze behavior is quite frustrating

@TylerKann
Copy link
Author

Thanks a lot for the -1 update

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

2 participants