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 details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

Details for the file r2pyapi-0.1.2.tar.gz.

File metadata

  • Download URL: r2pyapi-0.1.2.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.8.2 Darwin/19.6.0

File hashes

Hashes for r2pyapi-0.1.2.tar.gz
Algorithm Hash digest
SHA256 bda8e04446d15f76645b550f01cc68f4308229c596de4fcd59e9c0aae11916ad
MD5 43cb76fe3034276a582dc39a8765291d
BLAKE2b-256 10ff2914950279805d7c1c96bc1940e6cb78f26061d7f0e7dc7786b5ba129e56

See more details on using hashes here.

File details

Details for the file r2pyapi-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: r2pyapi-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 15.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.8.2 Darwin/19.6.0

File hashes

Hashes for r2pyapi-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c1dcdfd38bf9d05b14f31d5a3dbc717ecd8f1edd05efa22b9942206d8f60771f
MD5 796f07baab2050625b6a987fb62b6aad
BLAKE2b-256 e1bab577e50f4463ea00847e41a1246b51c80e01d36a1eeb32efca1fa79f44c9

See more details on using hashes here.

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