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 with fixed size. 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)
In some cases, decompilers may use their built-in functions in the output. Gravitum implements some of them. You can look up from gravitum.decompiler_builtins
.
from gravitum import uint32
from gravitum.decompiler_builtins.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
gravitum-0.1.0.tar.gz
(9.6 kB
view details)
Built Distribution
gravitum-0.1.0-py3-none-any.whl
(10.2 kB
view details)
File details
Details for the file gravitum-0.1.0.tar.gz
.
File metadata
- Download URL: gravitum-0.1.0.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b19ed6c913df22e736aca387087bc516ec495a54e551a88cb7f31c58c8b7c35c |
|
MD5 | 223c22a43bb21c77cd872c99c6f716bd |
|
BLAKE2b-256 | 68d80249c3e421540680f76d25ca76bdf3590c6c69fb4acb90ceb3c97fc6656d |
File details
Details for the file gravitum-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: gravitum-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.2 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 | c9546b399958da91622b80305fb5e40e43b8118afd5a7b879215d52e815dde05 |
|
MD5 | 5ebed993b92f3bdfe682263491185fa9 |
|
BLAKE2b-256 | 7ca9c7cc02148409dfab5b3cbf72ad129b54cecdcce0426fe24796c106094b55 |