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 int types (int8
, int16
, int32
, int64
, uint8
, uint16
, uint32
, uint64
) which based on the int types of numpy, and fixed the type conversion problem caused by the operation between numpy int and base int.
from gravitum.types import int8, uint8, uint16, uint32
v1 = int8(1)
v2 = uint8(2)
v3 = uint16(3)
# int8
type(v1 + 1)
# uint8
type(v1 + v2)
# uint16
type(v1 + v3)
# cast type
v3 = uint32(v3)
Function ptr
is provided to wrap bytearray
, then you can operate like a pointer.
For a C program:
unsigned __int8 v[12] = {1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12};
*((unsigned __int32 *)(v + 2) + 1) = 1;
You can write with Gravitum:
from gravitum import uint8, uint32, ptr
v = bytearray([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
p = ptr(v, uint8)
p.add(2).cast(uint32).add(1).write(1)
Gravitum also implemented some functions (ror4
, rol4
, byte1
, low_byte
, high_byte
, etc.) which are used in the code decompiled by IDA. You can reference them from gravitum.defs
.
from gravitum import uint32
from gravitum.defs import ror4
v = uint32(1)
v = ror4(v, 8)
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.3.tar.gz
.
File metadata
- Download URL: gravitum-0.0.3.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.2.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2cfdc6cad5d5a161b7d2b8b876bec602428b14d03a34875b567db61d2954363 |
|
MD5 | 5c674ea34de251dd1a91d3562212861b |
|
BLAKE2b-256 | 6898397dc0eb866ce60bfd84fdd814d4223dd9ab061f6d0824988343a16bf0a9 |
File details
Details for the file gravitum-0.0.3-py3-none-any.whl
.
File metadata
- Download URL: gravitum-0.0.3-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.2.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b75c346dea0fd5bbd4c7d0b9b511683834c59eeafcba9e73940a5bcaa0ad20e |
|
MD5 | 169a272afc0aa00894561f7c2cab8e7c |
|
BLAKE2b-256 | a9e7c61e54b6d99c2d2a5cbcbc6435058ed650a11bc9e55312fc161ed388ca68 |