Craft Ghidra structs in python
Project description
Strudra
Welcome to Strudra, a way to craft Ghidra structs in python, using ghidra_bridge.
Example
First, init Strudra - you can pass in a custom Ghidra Bridge here, if you like.
from strudra import strudra
sd = strudra.Strudra()
We can use all structs from Ghidra, but let's add one just for this example.
sd.add_struct("struct test{ int test1; char test2[2]; };")
Create 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]
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)
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file strudra-0.1.0.tar.gz.
File metadata
- Download URL: strudra-0.1.0.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2e8fd2746abbea390fea3592ded73469d60039eeb2dccff023af30688f4ab20
|
|
| MD5 |
6c16c5b5d6a2f5f46901e19d14a4cc3b
|
|
| BLAKE2b-256 |
940a6cefd5d188a83acf4c1118bbd82b3bbd27242b02e63447bdca0c516eba3d
|
File details
Details for the file strudra-0.1.0-py3-none-any.whl.
File metadata
- Download URL: strudra-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7eb5b2a0414054de0d80f327f6487b0986c7aefbccb5d6740a5b530b80b6f9cc
|
|
| MD5 |
ccd4081075bdfbf9b70b36ddbfd9d554
|
|
| BLAKE2b-256 |
e0a4e9211fefed65dece37168ed785e19f0c65a8dc2bfa7f30908a096a20684b
|