All Projects → radareorg → Radare2 Bindings

radareorg / Radare2 Bindings

Licence: lgpl-3.0
Bindings of the r2 api for Valabind and friends

Programming Languages

python
139335 projects - #7 most used programming language
java
68154 projects - #9 most used programming language
c
50402 projects - #5 most used programming language
lua
6591 projects
perl
6916 projects
vala
323 projects

Projects that are alternatives of or similar to Radare2 Bindings

Wiringpi Python
Unofficial Python-wrapped version of Gordon Henderson's WiringPi version 2.
Stars: ✭ 438 (+338%)
Mutual labels:  swig
Pythonocc Core
Python package for 3D CAD/BIM/PLM/CAM
Stars: ✭ 697 (+597%)
Mutual labels:  swig
Arcore Patch
Attempt to get ARCore Preview 2 running on unsupported devices
Stars: ✭ 74 (-26%)
Mutual labels:  radare2
A Journey Into Radare2
A series of tutorials about radare2 framework from https://www.megabeets.net
Stars: ✭ 473 (+373%)
Mutual labels:  radare2
Awesome Radare2
A curated list of awesome projects, articles and the other materials powered by Radare2
Stars: ✭ 580 (+480%)
Mutual labels:  radare2
Fast Flipdot
Driving a flipdot matrix differently. All dots simultaneously.
Stars: ✭ 35 (-65%)
Mutual labels:  swig
Media Server Go
WebRTC media server for go
Stars: ✭ 362 (+262%)
Mutual labels:  swig
R2m2
radare2 + miasm2 = ♥
Stars: ✭ 86 (-14%)
Mutual labels:  radare2
R2frida
Radare2 and Frida better together.
Stars: ✭ 610 (+510%)
Mutual labels:  radare2
Lsf Python Api
Location for the LSF Python wrapper for controlling all things LSF
Stars: ✭ 69 (-31%)
Mutual labels:  swig
Flapigen Rs
Tool for connecting programs or libraries written in Rust with other languages
Stars: ✭ 473 (+373%)
Mutual labels:  swig
Radare2book
Radare2 official book
Stars: ✭ 502 (+402%)
Mutual labels:  radare2
Pykcs11
PKCS#11 Wrapper for Python
Stars: ✭ 53 (-47%)
Mutual labels:  swig
Simpleitk
SimpleITK: a layer built on top of the Insight Toolkit (ITK), intended to simplify and facilitate ITK's use in rapid prototyping, education and interpreted languages.
Stars: ✭ 458 (+358%)
Mutual labels:  swig
A Text Editor
一款微信文章编辑器_前后端已搭建完整
Stars: ✭ 77 (-23%)
Mutual labels:  swig
Intel Cmt Cat
User space software for Intel(R) Resource Director Technology
Stars: ✭ 400 (+300%)
Mutual labels:  swig
Pymupdf
Python bindings for MuPDF's rendering library.
Stars: ✭ 898 (+798%)
Mutual labels:  swig
Radare2 Pm
Package Manager for Radare2
Stars: ✭ 100 (+0%)
Mutual labels:  radare2
Opencv Swig
SWIG interface files for OpenCV types.
Stars: ✭ 77 (-23%)
Mutual labels:  swig
Python interface cpp
Example code for interfacing with C and C++ from Python using Cython, SWIG, CFFI, PyPy, and pybind11
Stars: ✭ 56 (-44%)
Mutual labels:  swig

radare2 language bindings

Service Badge
TravisCI Build Status

This repository contains the native bindings generated with Valabind to use the radare2 APIs.

The r2pipe implementations has been moved into a separate repository.

Description

This directory contains the code necessary to use the r2 api from your favourite language.

It supports a large list of programming languages:

  • Python
  • JavaScript
  • Java
  • Go
  • Ruby
  • Perl
  • Lua
  • Vala
  • NewLisp
  • Guile
  • OCaml

And some other experimental bindings are for:

  • GIR
  • C++
  • C#

This package also contains the vdoc/ subdirectory which contains the rules used to generate all interactive html documentation.

Dependencies

To build radare2-bindings from repository you need the following programs installed:

  • swig: enables support for python, perl, lua, java and many other
  • vala: if you want to have Vala or Genie bindings
  • valabind: required only in developer mode (not release tarball)

Release tarballs come with all the pregenerated .cxx files, so you have no extra dependencies apart from the language libraries and C++ compiler.

Using r2pm

Fortunely, all those dependencies can be installed with r2pm:

r2pm -i vala swig valabind

Building by hand

To get install all dependencies do the following steps in order:

  • Install swig and git from repository (ensure you don't have vala installed from package)
arch$ sudo pacman -S swig git
deb$ sudo apt install swig git
./configure --prefix=/usr
make
sudo make install
  • Clone vala compiler from git repository:
$ git clone https://gitlab.gnome.org/GNOME/vala
$ cd vala
$ sh autogen.sh --prefix=/usr
$ make
$ sudo make install
  • Fetch valabind from the repository:
$ git clone git://github.com/radare/valabind.git
$ cd valabind
$ make
$ sudo make install PREFIX=/usr

To keep bindings up-to-date

When changes are done in libr an ABI break can occur. The bindings will require to be recompiled to work again.

It's recommendable to keep your system always up to date, and upgrade vala and valabind from git.

$ cd vala
$ git pull
$ make
$ sudo make install

$ cd ../valabind
$ git pull
$ make
$ sudo make install PREFIX=/usr

radare2-bindings

If you compile from the repo you need the latest version of valabind and then:

./configure --prefix=/usr

You can select the languages you want to compile with --enable={list-of-langs}

./configure --prefix=/usr --enable=python

Experimental radare2 bindgen

Introduction

This script allows to generate native bindings for these languages directly from radare2 C headers:

More languages are planned, in particular:

  • Ruby - I wanted to use ffi-gen but it needs revival and update to the modern Ruby and Clang.
  • OCaml - needs to be written
  • Lua - maybe LuaAutoC can be used, I don't know.

Usage

genbind.py -o /tmp/r2bindings-output

The tool required radare2 to be installed and takes the include directory from the output of r2 -H It is possible also specify the particular languages, for example:

genbind.py -o /tmp/r2bindings-output -l go rust python

PYTHON

To select the version of python to compile for use the PYTHON_CONFIG environment variable as follows:

$ ./configure --prefix=/usr --enable-devel
$ cd python
$ PYTHON_CONFIG=python3.2-config make
$ su -
# PYTHON_CONFIG=python3.2-config make install

RANDOM NOTES

The valabind integration forces us to do some changes in the r2 API.

These api changes are for:

  • Avoid keywords in function names

    Every language has its own keywords, r2api should try to workaround all those keywords to avoid collisions for bindings.

    Example: use, del, from, continue, etc..

    TODO: we need to review APIs, find better names for functions using those keywords, etc..

  • Review basic data structures

    Linked lists, hash tables, r_db, arrays, ... must be reviewed to fit with vala and swig basics to be able to use them with simple APIs or integrate them with the syntax sugar of the target language.

    Example:

  foreach (var foo in binls.get_symbols ()) {
	print ("%s 0x%08"PFMT64x"\n", foo.name, foo.offset);
  }
  • Unit testing

    Having bindings for python, perl, ruby, .. is good for unit testing because it hardly simplifies the way to test APIs, find bugs, ...

    TODO: write unit testing frameworks for perl, ruby, python, etc..

  • API unification for all languages

    All the previous development points are meant to reduce code in r2, avoid syntax exceptions, simplify api usage, and much moar ;)

SWIG is not complete, there are still so many bugs to fix and so many unimplemented stuff. Here's a list of the most anoying things of it:

  • unsigned char * : not implemented
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].