Skip to main content

Yet anohter radare2 python bindings.

Project description

pyr2

Yet another radare2 python bindings.

Install

pip3 install --upgrade pyr2

No need to install radare2 since all dynamic libraries are bundled with the Python wheels.

Example

import ctypes
from r2 import *

r2c = r_core_new()
r_core_init(r2c)
fh = r_core_file_open(r2c, ctypes.create_string_buffer(b"/bin/ls"), 0b101, 0)
r_core_bin_load(r2c, ctypes.create_string_buffer(b"/bin/ls"), (1<<64) - 1)
r_core_cmd_str(r2c, ctypes.create_string_buffer(b"ieq"))
r_core_cmd_str(r2c, ctypes.create_string_buffer(b"aaa"))
print(ctypes.string_at(r_core_cmd_str(r2c, ctypes.create_string_buffer(b"pdj"))))
r_core_file_close(r2c, fh)

Note that all radare2 APIs are exported as bare ctypes function prototype. Be catious with c-style strings.

Build Instructions

Clone the repository and submodules.

git clone https://github.com/wtdcode/pyr2
cd pyr2
git submodule update --init --recursive

Since radare2 chooses meson as their alternative building system, the first step is install meson.

pip3 install meson

Build the package. Note that on Windows, x64 Native Tools Command Prompt is required to build.

python3 setup.py build

Install and use.

# Or pip3 install -e .
pip3 install .

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

pyr2-1.2.0-py3-none-win_amd64.whl (6.6 MB view hashes)

Uploaded Python 3 Windows x86-64

pyr2-1.2.0-py3-none-manylinux1_x86_64.whl (7.8 MB view hashes)

Uploaded Python 3

pyr2-1.2.0-py3-none-macosx_10_14_x86_64.whl (6.1 MB view hashes)

Uploaded Python 3 macOS 10.14+ x86-64

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