Different results in bridge and in Jython Shell
See original GitHub issueRunning hex(getState().getCurrentAddress().getOffset())
in the Jython shell gives a different result than running
import ghidra_bridge
b = ghidra_bridge.GhidraBridge()
b.get_flat_api(namespace=globals())
print(hex(getState().getCurrentAddress().getOffset()))
in the bridge.
I have no idea why, if you cant reproduce this on windows I can investigate this further.
Issue Analytics
- State:
- Created 4 years ago
- Comments:17 (16 by maintainers)
Top Results From Across the Web
Jython User Guide
Jython and CPython are two different implementations of the same language. There are naturally some differences between the two implementations, ...
Read more >Results Generation by the Jython Script - ITOM Practitioner Portal
Each Jython script runs on a specific Trigger CI, and ends with results that are returned by the return value of the DiscoveryMain...
Read more >Object Relational Mapping and Using JDBC — Definitive ...
In this chapter we'll focus on using SQLAlchemy with Jython, as well as using Java technologies such as Hibernate. In the end you...
Read more >Jython - Quick Guide - Tutorialspoint
Jython - Quick Guide, Jython is the JVM implementation of the Python programming language. It is designed to run on the Java platform....
Read more >ghidra-bridge - Python Package Health Analysis - Snyk
Learn more about ghidra-bridge: package health score, popularity, security, ... For a better interactive shell like IPython or if you need Python 3 ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Okay, finally had time to take a proper look. Good news is I can replicate it now. Bad news is, I’m pretty sure this is a Ghidra issue, so outside the scope of this project.
What appears to be happening is that when called inside a Python script (but not the python interpreter), getState() is not syncing/updating but is instead returning the same state each time (I assume the initial state variable). See this by running
str(getState())
multiple times. In the interpreter, I get a different state object each time:but in both a script run directly from the script manager, and running across the ghidra_bridge, I get the same state object:
Further, modifications to the state work and are reflected in the GUI - but the moment you call getState() again, it goes back to the original values (and the GUI updates to jump back to them).
Given that this is occurring in a script run directly from the script manager, without the bridge, I’ve got to go with this being a bug in Ghidra. I’ll leave this issue open a little longer in case you’ve got another thought - otherwise, feel free to report the issue to them if you want (I feel like you found the original bug here, so you should get the cred - feel free to use any of my notes). If not, I’ll look into reporting it when I get ghidra_bridge stable.
Uploaded. Grab the latest version and hopefully that’ll do the trick.