Comments (3)
Ok, I've answered my own question. THIS IS AMAZING! Truly @justfoxing, amazing project. This works:
[ins] In [1]: import ghidra_bridge
...: b = ghidra_bridge.GhidraBridge(namespace=globals()) # creates the bridge and loads the fl
...: at API into the global namespace
...: print(getState().getCurrentAddress().getOffset())
4196125
[ins] In [2]: module = b.remote_import("ghidra.framework.model")
[ins] In [6]: class MyListener(module.DomainObjectListener):
...: def domainObjectChanged(self, ev):
...: print(ev)
...:
[ins] In [7]: l = MyListener()
[ins] In [8]: l
Out[8]: <_bridged___main__.MyListener('org.python.proxies.__main__$MyListener$7@4082bddb', type=__main__.MyListener, handle=93b68807-cf8e-4a3e-9452-76a43a2198a7)>
[ins] In [9]: currentProgram.addListener(l)
ghidra.framework.model.DomainObjectChangedEvent[source=fauxware - .ProgramDB]
That last line you are seeing is a callback being handled after I changed a name in Ghidra. Wow, I'm honestly amazing.
I did however get one crash on the Ghidra side:
AttributeError: 'ghidra.program.database.ProgramDB' object has no attribute '__module__'
Traceback (most recent call last):
File "/home/mahaloz/ghidra_scripts/jfx_bridge/bridge.py", line 1003, in local_get
result = getattr(target, name)
AttributeError: 'ghidra.program.database.ProgramDB' object has no attribute '__module__'
Traceback (most recent call last):
File "/home/mahaloz/ghidra_scripts/jfx_bridge/bridge.py", line 1003, in local_get
result = getattr(target, name)
AttributeError: 'instancemethod' object has no attribute '_partialmethod'
Traceback (most recent call last):
File "/home/mahaloz/ghidra_scripts/jfx_bridge/bridge.py", line 1003, in local_get
result = getattr(target, name)
AttributeError: 'instancemethod' object has no attribute '__code__'
Traceback (most recent call last):
File "/home/mahaloz/ghidra_scripts/jfx_bridge/bridge.py", line 1003, in local_get
result = getattr(target, name)
AttributeError: 'instancemethod' object has no attribute '__defaults__'
Traceback (most recent call last):
File "/home/mahaloz/ghidra_scripts/jfx_bridge/bridge.py", line 1003, in local_get
result = getattr(target, name)
AttributeError: 'instancemethod' object has no attribute '__kwdefaults__'
Traceback (most recent call last):
File "/home/mahaloz/ghidra_scripts/jfx_bridge/bridge.py", line 1003, in local_get
result = getattr(target, name)
AttributeError: 'instancemethod' object has no attribute '__text_signature__'
from ghidra_bridge.
Yup, you can subclass Java classes remotely, this is super cursed :P Glad you've got your code sorted. Be aware that you may end up with issues if you close your ghidra bridge client while you have a callback like this registered - Ghidra will keep trying to send events to the callback, and the ghidra bridge server will throw exceptions when it finds the connection from the client closed, which can make things very sad if it's a callback that blocks the UI thread. If you do start having problems with that, check out https://github.com/justfoxing/jfx_bridge/#remoteify-and-remote-exec for an example of pushing a custom callback class onto the Ghidra-side to allow you to handle client disconnects safely.
As for the crash - hard to say without seeing the code you're using. Is it actually crashing your code, or is it just logging a bunch of AttributeErrors? IPython in particular queries for a bunch of attributes that may or may not exist as part of its amazing featureset, so a bunch of AttributeErrors are expected there.
from ghidra_bridge.
Yeah @justfoxing, the code I used to trigger this is exactly the code you see above in an IPython instance.
As for the disconnection causing crashes after you disconnect, you are totally right; It does, lol. Thanks for the advice, I'll close the issue since those crashes aren't causing anything bad :).
from ghidra_bridge.
Related Issues (20)
- Memory.getBytes returns empty array HOT 3
- AttributeError: 'instancemethod' object has no attribute '__len__' (bridge.py", line 974) HOT 5
- PyPI description has three sequential steps all numbered "1" HOT 2
- Timeout value is not configurable in `ghidra_bridge_server.py` HOT 1
- Are you able to write to a ghidra project? HOT 1
- findBytes return an empty Array HOT 1
- Unable to stop auto-analysis for script connected via ghidra_bridge HOT 1
- Expose other IPC channels HOT 1
- How to put arguments in remote_eval?
- setComment causes BridgeException HOT 2
- Cannot inherit bridged classes HOT 1
- Unhashable type _bridged_ghidra.program.database.function.FunctionDB HOT 2
- Bad file descriptor HOT 1
- Socket not closed, when GhidraBridge Object gets out of scope HOT 5
- Timeout Condition HOT 6
- How to remote debug with VSCode? HOT 4
- Windows: Binding on low port blocked by firewall HOT 3
- How to pass arguments to the post script HOT 1
- using in IDE with proper auto completion
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ghidra_bridge.