Library for implementing decompiled code.
Project description
Gravitum
Gravitum is a library for implementing decompiled code with Python.
Requirements
- Python 3.6+
Installation
$ pip install gravitum
Usage
Gravitum defines some interger types based on the types of numpy. You can use shorthand functions (int8
, int16
, int32
, int64
, uint8
, uint16
, uint32
, uint64
) to create them.
from gravitum import uint8
v = uint8(0x53)
Pointer operations are common in the decompiled code.
unsigned __int8 data[8] = {71, 114, 97, 118, 105, 116, 117, 109};
unsigned __int8 *p = data;
unsigned __int8 v = p[4];
*((unsigned __int32 *)p + 1) = v;
So Gravitum provides vptr
.
from gravitum import vptr
data = bytearray([71, 114, 97, 118, 105, 116, 117, 109])
p = vptr(data, 'uint8')
v = p.add(4).read()
p.cast('uint32').add(1).write(v)
For IDA, Gravitum implements some functions (rol*
, ror*
, byte*
, word*
, bswap*
, clz
, etc.) that are often used in its output. You can import them from gravitum.decompiler.ida
.
from gravitum import uint32
from gravitum.decompiler.ida import ror4
v = uint32(0x53683477)
v = ror4(v, 2)
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
File details
Details for the file gravitum-0.0.6.tar.gz
.
File metadata
- Download URL: gravitum-0.0.6.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 180a57507e182baea647f90da33730f6a426f37091bb35a0f2f2eb50b87bb505 |
|
MD5 | b77145da58a94fa21b917080a5e89e1e |
|
BLAKE2b-256 | 57b47eab845f93aed2185e91c9d74eefaca41df5dfa22eb5c4476272535f8b78 |
File details
Details for the file gravitum-0.0.6-py3-none-any.whl
.
File metadata
- Download URL: gravitum-0.0.6-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7cc8caaf3ca060566eb2aff7534998d39a52ed885e0dba139db94a07aa094888 |
|
MD5 | 4f8f0edeafd53b9f6c0fade5a02d6825 |
|
BLAKE2b-256 | 5bb9465de52ae4ff012980d6cb6ca487f81c18bc30aad178f0f5db9e6955661e |