Git Product home page Git Product logo

Comments (5)

justfoxing avatar justfoxing commented on July 2, 2024

Hi, Tyler, I'm unable to reproduce this problem based on your description. I'll note that ghidra_bridge has no control over the headless analysis restarting - my guess would be that the most likely issue is something to do with the command you're using to run the analyzeHeadless script.

If you can provide the commands you're using to run analyzeHeadless and the bridge, I can attempt to reproduce the problem to see if it is in fact related to ghidra_bridge.

from ghidra_bridge.

TylerKann avatar TylerKann commented on July 2, 2024

ghidra_9.0.1/support/analyzeHeadless ./ headlessRepo -import ./ lebiniou -scriptPath /ghidra_scripts -postscript ghidra_bridge_server.py &

libinou is my binary name
I dont really understand the 'project' part, so i just made a folder called headlessRepo, so that may be the issue

from ghidra_bridge.

TylerKann avatar TylerKann commented on July 2, 2024

@justfoxing On a side note, is there anyway i can integrate that command above into a shell script? Something like
ghidra_9.0.1/support/analyzeHeadless ./ headlessRepo -import ./ lebiniou -scriptPath /ghidra_scripts -postscript ghidra_bridge_server.py &
&& python useBridge.py $1
&& python endBridge.py
Thats what i have but it isnt working too well. Any thoughts on how to improve that?

from ghidra_bridge.

justfoxing avatar justfoxing commented on July 2, 2024

Yeah, this isn't a ghidra_bridge problem, your command as written is incorrect. The problem is with this part: -import ./ lebiniou. Note that you have a space between ./ and lebiniou.

If you look at the documentation for analyzeHeadless (as mentioned in the response to your previous issue), you will see that -import can take multiple arguments to import, and that these can be either files or directories. If you import a directory, it will attempt to import every file it finds in that directory.

Because you have -import ./ lebiniou instead of -import ./lebiniou, you're telling analyzeHeadless to import everything in ./ as well as ./lebiniou a second time. The ghidra_bridge_server gets run for every file that's imported, so when you send shutdown, it's stopping and analyzeHeadless will import the next file and rerun ghidra_bridge_server on it, which is the issue you're seeing.

analyzeHeadless is complex - I really recommend you take the time to read the documentation and play around with it without ghidra_bridge in the mix to understand how it works. As always, hit up the ghidra project for support with it.

from ghidra_bridge.

justfoxing avatar justfoxing commented on July 2, 2024

WRT your second question, here's the relevant lines in the automated test system for this project:

/opt/ghidra/support/analyzeHeadless /tmp TestProject -import /bin/bash -noanalysis -scriptPath /tmp/ghidra_bridge/test_server -preScript ghidra_bridge_server.py >/tmp/script.log 2>/tmp/script.err & # Run the ghidra_bridge_server in a headless ghidra - we use non-background server, otherwise the script would exit before we could test
( tail -f /tmp/script.err & ) | grep -q "_bridge.bridge:serving!" # pause until we see the ghidra_bridge_server start logging messages
python3 -c "import ghidra_bridge; b = ghidra_bridge.GhidraBridge(namespace=globals()); print(getState().getCurrentAddress())" # run a quick test for ghidra_bridge - we do this before nose, because the last nose test shuts down the bridge

The trickiest part is waiting until the bridge server has been started before attempting to connect to it, which is what the tail/grep combo provides.

from ghidra_bridge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.