-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Memory.getBytes in Python script #858
Comments
This is an issue with the differences between how Python and Java implement arrays. Our Python environment is Jython, which allows you to easily call into our Java API. When the Java API calls for an array, you have to give it a jarray for things to work like you want it to. |
Ok I see the difference here : it is not Python, it is Jython. |
However, when trying to import jarray, it returns "import jarray import jarray Could someone please let me know what I am doing wrong? bytes_read = bytearray(bb.size) |
@HermanTam This issue for for Jython. I believe you are using Ghidrathon. |
Hello everyone,
I think I have a bug or an understanding issue here. Before filling a bug report I just want to confirm the issue. So a simplified version of the "problem" is the following :
Environment :
Computer : Linux 5.1.2-arch1-1-ARCH #1 SMP PREEMPT x86_64 GNU/Linux
Java version : 11.0.3
Ghidra version : 9.0.2
What I want to achieve :
Displaying bytes of an analyzed program in my console
What I am currently doing :
I wrote a simple Python script which get the first address of the program.
After that, I am displaying the first byte by calling getByte : everything is fine.
But then, I want to grab 4 bytes with getBytes : the problem is here.
As an argument, I am giving getBytes the address and a byte array.
But when I am displaying this byte array, only four '0' are printed.
The return value of getBytes is '4' so this is indicating that '4' bytes have been taken.
What is the expected result:
I want my 4 bytes array to contains the actual 4 bytes of my program starting at the given address.
What I tried :
I tried rewriting the same script but in Java. And even if I have a formatting issue with a byte showing a wrong value (0xffffffa8 instead of 0xa8), I achieve to get my 4 bytes with the getBytes method.
I give you the two used scripts in an attached tar.gz file if you want to have a precise example of what I am trying to achieve.
Feel free to ask me for clarification if you need.
Have a good day.
testGithub.tar.gz
The text was updated successfully, but these errors were encountered: