Strudra
Welcome to Strudra, a way to craft Ghidra structs in python, using ghidra_bridge.
How Studra Works
Strudra loads all structs from the Ghidra
For this to work, you have to setup ghidra_bridge in Ghidra: https://github.com/justfoxing/ghidra_bridge/
Then, you can create instances of these structs, set values in these structs, and edit them. Good if you want to interact with your target.
How to Strud
First, install using pip install --user strudra.
Afterwards, you can init a Strudra object.
For this, you first have to setup and start ghidra_bridge in Ghidra.
Then, you can create a new strudra object.
from strudra import strudra
sd = strudra.Strudra()
You can pass in a custom Ghidra Bridge here, if you like.
By default, it will serialize all data received from ghidra to struds.json, and reload from there, if Ghidra bridge is not available.
You can pass in a different filename to cache to, or None to disable caching.
You can even force_from_file=True, if you don't want any Ghdira interaction in subsequent runs.
We can now use all structs from Ghidra, but let's add one just for this example.
sd.add_struct("struct test{ int test1; char test2[2]; };")
Creating a Strud
Now, we can access the new test struct from ghidra.
We can alread set values in the constructor
test_struct = sd.test(test1=0x1337)
We can use struct members by name or by offset
assert (test_struct.test == test_struct[0x0])
Arrays work, too!
test_struct.test2 = [0x42, 0x42]
Oh, and nested structs are fine as well, just try it! ;)
Reload
After having reversed new Structs in Ghidra, call reload on the Strudra object to get the latest updates.
Serialize
At the end, we can get the serialized bytes back, all members the correct byte order, and use it for example in pwntools.
bytes(test_struct)
Enjoy a new reverse engineering experience.
Metadata
Release files for strudra 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| strudra-0.1.2.tar.gz | 12.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| strudra-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.9 kB
Release files / strudra-0.1.2.tar.gz
| Download URL | strudra-0.1.2.tar.gz |
|---|---|
| Size | 12.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b74cd51e83a1cc0ce15fb9023ec66fb3d6cc0acf48ed18037d812d0a84368711
|
|
BLAKE2b-256 checksum How to use checksums |
7614942735c8d8d1aa8f38fcfe6c6a62de3d7092c97c4b334a631496e778baa6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.6
|
Release files / strudra-0.1.2-py3-none-any.whl
| Download URL | strudra-0.1.2-py3-none-any.whl |
|---|---|
| Size | 11.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eaa6596876ef1b7e728d42bb658bce16e15d24d157d924315b36fac5b9f378fb
|
|
BLAKE2b-256 checksum How to use checksums |
0e9ef263652ebd8f9f1898923584efeb6545094a861454383673ca5815b07282
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/3.7.3 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.6
|