Skip to main content

High level radare2 python API

Project description

r2pyapi

High level radare2 python API

Installation

$ pip install r2pyapi

You also need to install radare2. radare2 can be easily installed by the instruction described here.

Usage

import r2pipe
from r2pyapi import R2Surface, R2Seeker, R2Reader

r2 = r2pipe.open("test.exe")

# instruction search
with R2Seeker(r2) as seeker:
    results = seeker.seek_instructions("push ebp")
    print(next(result))
    # R2Instruction(offset=4288663, len=2, code='push ebp')

# read byte sequences
with R2Reader(r2) as reader:
    bytes_read = reader.read_bytes_at(0x0401000, 4)
    # [85, 139, 236, 131]

# get sections
r2_surf = R2Surface(r2)
print(r2_surf.sections)
# [R2Section(vaddr=4198400, paddr=1024, size=51200, vsize=53248, name='.text', perm='-r-x'), ... ]

# get import
print(r2_surf.find_import("MessageBoxA"))
# R2Import(ordinal=1, bind='NONE', type='FUNC', name='MessageBoxA', libname='USER32.dll', plt=4251916)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

r2pyapi-0.1.2.tar.gz (10.1 kB view hashes)

Uploaded Source

Built Distribution

r2pyapi-0.1.2-py3-none-any.whl (15.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page