Import radare2, reverse engineers hex editor, debugger and disassembler.

Only i386/amd64 enabled until we know which arches work/need fixing.

OK sthen@
This commit is contained in:
edd 2011-07-21 01:35:51 +00:00
parent d1536163d4
commit 38d1e86abc
18 changed files with 431 additions and 0 deletions

7
devel/radare2/Makefile Normal file
View File

@ -0,0 +1,7 @@
# $OpenBSD: Makefile,v 1.1.1.1 2011/07/21 01:35:51 edd Exp $
SUBDIR =
SUBDIR += main
SUBDIR += bindings
.include <bsd.port.subdir.mk>

View File

@ -0,0 +1,26 @@
# $OpenBSD: Makefile.inc,v 1.1.1.1 2011/07/21 01:35:51 edd Exp $
# Arches suggested by upstream, unsure which work on OpenBSD for sure.
ONLY_FOR_ARCHS ?= amd64 i386
# We need to figure out which of the following arches work and fix ones
# that don't. We know powerpc is busted.
#ONLY_FOR_ARCHS ?= arm mips64 mips64el powerpc sparc sparc64
V ?= 0.8.1
CATEGORIES ?= devel
HOMEPAGE ?= http://radare.nopcode.org/
MAINTAINER ?= Edd Barrett <edd@openbsd.org>
# LGPLv3
PERMIT_PACKAGE_CDROM ?= Yes
PERMIT_PACKAGE_FTP ?= Yes
PERMIT_DISTFILES_CDROM ?= Yes
PERMIT_DISTFILES_FTP ?= Yes
MASTER_SITES ?= ${HOMEPAGE}/get/
USE_GMAKE ?= Yes
CONFIGURE_STYLE ?= simple
NO_REGRESS ?= Yes

View File

@ -0,0 +1,20 @@
# $OpenBSD: Makefile,v 1.1.1.1 2011/07/21 01:35:51 edd Exp $
COMMENT = Vala bindings for Radare2
DISTNAME = r2-bindings-${V}
PKGNAME = radare-bindings2-${V}
BUILD_DEPENDS = devel/radare2/main>=${V}
RUN_DEPENDS = lang/vala \
devel/radare2/main>=${V}
PKG_ARCH = *
# This would go if we wanted to package other bindings.
NO_BUILD = Yes
# Only install vala bindings for now. Maybe more in the future.
INSTALL_TARGET = install-vapi
.include <bsd.port.mk>

View File

@ -0,0 +1,5 @@
MD5 (r2-bindings-0.8.1.tar.gz) = QDkduBq/3m85e1+qefBHdQ==
RMD160 (r2-bindings-0.8.1.tar.gz) = Sb5T/maJ/zYZQHrBG9it6OOxRNQ=
SHA1 (r2-bindings-0.8.1.tar.gz) = ml24nWgeVtdl1qMXs/jnsGtbLtI=
SHA256 (r2-bindings-0.8.1.tar.gz) = 9ZkWhxdfRAb+S7dpcHZ8eUBN8A8fpwor/vlBzZHDwko=
SIZE (r2-bindings-0.8.1.tar.gz) = 4501335

View File

@ -0,0 +1 @@
Vala bindings for Radare2.

View File

@ -0,0 +1,46 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2011/07/21 01:35:51 edd Exp $
share/vala/
share/vala/vapi/
share/vala/vapi/libr.deps
share/vala/vapi/libr.vapi
share/vala/vapi/r_anal.deps
share/vala/vapi/r_anal.vapi
share/vala/vapi/r_asm.deps
share/vala/vapi/r_asm.vapi
share/vala/vapi/r_bin.deps
share/vala/vapi/r_bin.vapi
share/vala/vapi/r_bp.deps
share/vala/vapi/r_bp.vapi
share/vala/vapi/r_cmd.deps
share/vala/vapi/r_cmd.vapi
share/vala/vapi/r_config.vapi
share/vala/vapi/r_cons.vapi
share/vala/vapi/r_core.deps
share/vala/vapi/r_core.vapi
share/vala/vapi/r_crypto.vapi
share/vala/vapi/r_db.vapi
share/vala/vapi/r_debug.deps
share/vala/vapi/r_debug.vapi
share/vala/vapi/r_diff.vapi
share/vala/vapi/r_flags.deps
share/vala/vapi/r_flags.vapi
share/vala/vapi/r_fs.deps
share/vala/vapi/r_fs.vapi
share/vala/vapi/r_hash.vapi
share/vala/vapi/r_io.deps
share/vala/vapi/r_io.vapi
share/vala/vapi/r_lang.vapi
share/vala/vapi/r_lib.deps
share/vala/vapi/r_lib.vapi
share/vala/vapi/r_line.vapi
share/vala/vapi/r_parse.deps
share/vala/vapi/r_parse.vapi
share/vala/vapi/r_print.vapi
share/vala/vapi/r_reg.deps
share/vala/vapi/r_reg.vapi
share/vala/vapi/r_search.deps
share/vala/vapi/r_search.vapi
share/vala/vapi/r_sign.vapi
share/vala/vapi/r_socket.vapi
share/vala/vapi/r_syscall.vapi
share/vala/vapi/r_util.vapi

View File

@ -0,0 +1 @@
Tests for the Vala API until radare2 gets its own.

View File

@ -0,0 +1,9 @@
VALAC = valac
SRC = rasm
PKGS = --pkg=r_asm
all:
${VALAC} ${VALAC_FLAGS} ${PKGS} ${SRC}.vala
clean:
@rm -f ${SRC}

View File

@ -0,0 +1,14 @@
using Radare;
public static void main(string[] args) {
uint8 buf[3] = {0x49, 0x89, 0xd9};
RAsm st = new RAsm();
st.use("x86");
st.set_bits(64);
RAsm.Op op;
st.disassemble(out op, buf, 3);
print("Disassemble: '%s'\n", op.buf_asm);
}

View File

@ -0,0 +1,20 @@
# $OpenBSD: Makefile,v 1.1.1.1 2011/07/21 01:35:51 edd Exp $
COMMENT = reverse engineers disassembler and debugger
DISTNAME = radare2-${V}
# In radare, all libs have the same version
LIBV = 0.0 # 0.8.1
.for _lib in r_anal r_asm r_bin r_bp r_cmd r_config r_cons r_core r_debug \
r_diff r_flags r_fs r_hash r_io r_lang r_lib r_line r_parse r_print \
r_reg r_search r_sign r_socket r_syscall r_util
SHARED_LIBS+= ${_lib} ${LIBV}
.endfor
WANTLIB = c crypto m pthread ssl
CONFIGURE_ARGS += --with-libversion=${LIBV} \
--mandir=${PREFIX}/man
.include <bsd.port.mk>

View File

@ -0,0 +1,5 @@
MD5 (radare2-0.8.1.tar.gz) = 1ufChjtnxPpZrC6CpBx1cg==
RMD160 (radare2-0.8.1.tar.gz) = m+TA6bBKczmYyFTdr/V5s4RVVho=
SHA1 (radare2-0.8.1.tar.gz) = 8/xLaxCUSHgRy+5qEILYZUmj7QI=
SHA256 (radare2-0.8.1.tar.gz) = jRnQ3uOS/GnioX5xbtuEfVyTLFtKTnVdkboPcj3w+DI=
SIZE (radare2-0.8.1.tar.gz) = 1373078

View File

@ -0,0 +1,13 @@
No lib symlinks
$OpenBSD: patch-libr_Makefile,v 1.1.1.1 2011/07/21 01:35:51 edd Exp $
--- libr/Makefile.orig Wed Jul 20 17:46:48 2011
+++ libr/Makefile Thu Jul 21 01:05:41 2011
@@ -64,7 +64,6 @@ install: install-includes install-pkgconfig
b=`echo $$a|cut -d / -f 2`; \
echo " ${LFX}/$$b.${LIBVERSION}"; \
${INSTALL_LIB} $$a ${LFX}/$$b.${LIBVERSION} ; \
- ( cd ${LFX} ; ln -fs $$b.${LIBVERSION} $$b.0 ; ln -fs $$b.0 $$b ); \
done
# object archives
@for a in `find * -type f | grep -e '\.a$$' | grep -v fs/p` ; do \

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-libr_line_dietline_c,v 1.1.1.1 2011/07/21 01:35:51 edd Exp $
on powerpc and arm, chars default to unsigned, causes an issue here.
--- libr/line/dietline.c.orig Tue Jul 19 09:35:10 2011
+++ libr/line/dietline.c Thu Jul 21 02:52:49 2011
@@ -247,7 +247,7 @@ R_API char *r_line_readline() {
const char *gcomp_line = "";
static int gcomp_idx = 0;
static int gcomp = 0;
- char buf[10];
+ signed char buf[10];
int ch, i; /* grep completion */
I.buffer.index = I.buffer.length = 0;

Binary file not shown.

View File

@ -0,0 +1,12 @@
Opensource tools to disasm, debug, analyze and manipulate binary files.
* Multi-architecture multi-platform
* Highly scriptable
* Hexadecimal editor
* IO is wrapped
* Filesystems support
* Debugger support
* Diffing between two functions or binaries
* Code analysis at opcode, basicblock, function levels
And more...

View File

@ -0,0 +1,76 @@
@comment $OpenBSD: PFRAG.shared,v 1.1.1.1 2011/07/21 01:35:51 edd Exp $
@lib lib/libr_anal.so.${LIBr_anal_VERSION}
@lib lib/libr_asm.so.${LIBr_asm_VERSION}
@lib lib/libr_bin.so.${LIBr_bin_VERSION}
@lib lib/libr_bp.so.${LIBr_bp_VERSION}
@lib lib/libr_cmd.so.${LIBr_cmd_VERSION}
@lib lib/libr_config.so.${LIBr_config_VERSION}
@lib lib/libr_cons.so.${LIBr_cons_VERSION}
@lib lib/libr_core.so.${LIBr_core_VERSION}
@lib lib/libr_debug.so.${LIBr_debug_VERSION}
@lib lib/libr_diff.so.${LIBr_diff_VERSION}
@lib lib/libr_flags.so.${LIBr_flags_VERSION}
@lib lib/libr_fs.so.${LIBr_fs_VERSION}
@lib lib/libr_hash.so.${LIBr_hash_VERSION}
@lib lib/libr_io.so.${LIBr_io_VERSION}
@lib lib/libr_lang.so.${LIBr_lang_VERSION}
@lib lib/libr_lib.so.${LIBr_lib_VERSION}
@lib lib/libr_line.so.${LIBr_line_VERSION}
@lib lib/libr_parse.so.${LIBr_parse_VERSION}
@lib lib/libr_print.so.${LIBr_print_VERSION}
@lib lib/libr_reg.so.${LIBr_reg_VERSION}
@lib lib/libr_search.so.${LIBr_search_VERSION}
@lib lib/libr_sign.so.${LIBr_sign_VERSION}
@lib lib/libr_socket.so.${LIBr_socket_VERSION}
@lib lib/libr_syscall.so.${LIBr_syscall_VERSION}
@lib lib/libr_util.so.${LIBr_util_VERSION}
lib/radare2/0.8.1/anal_arm.so
lib/radare2/0.8.1/anal_avr.so
lib/radare2/0.8.1/anal_csr.so
lib/radare2/0.8.1/anal_dalvik.so
lib/radare2/0.8.1/anal_ppc.so
lib/radare2/0.8.1/anal_sh.so
lib/radare2/0.8.1/anal_x86.so
lib/radare2/0.8.1/anal_x86_simple.so
lib/radare2/0.8.1/asm_arm.so
lib/radare2/0.8.1/asm_avr.so
lib/radare2/0.8.1/asm_bf.so
lib/radare2/0.8.1/asm_csr.so
lib/radare2/0.8.1/asm_dalvik.so
lib/radare2/0.8.1/asm_java.so
lib/radare2/0.8.1/asm_mips.so
lib/radare2/0.8.1/asm_msil.so
lib/radare2/0.8.1/asm_ppc.so
lib/radare2/0.8.1/asm_psosvm.so
lib/radare2/0.8.1/asm_sh.so
lib/radare2/0.8.1/asm_sparc.so
lib/radare2/0.8.1/asm_x86.so
lib/radare2/0.8.1/asm_x86_nasm.so
lib/radare2/0.8.1/asm_x86_olly.so
lib/radare2/0.8.1/bin_dex.so
lib/radare2/0.8.1/bin_elf.so
lib/radare2/0.8.1/bin_elf64.so
lib/radare2/0.8.1/bin_fs.so
lib/radare2/0.8.1/bin_java.so
lib/radare2/0.8.1/bin_mach0.so
lib/radare2/0.8.1/bin_mach064.so
lib/radare2/0.8.1/bin_pe.so
lib/radare2/0.8.1/bin_pe64.so
lib/radare2/0.8.1/bin_xtr_dyldcache.so
lib/radare2/0.8.1/bin_xtr_fatmach0.so
lib/radare2/0.8.1/bp_arm.so
lib/radare2/0.8.1/bp_x86.so
lib/radare2/0.8.1/cmd_dummy.so
lib/radare2/0.8.1/debug_gdb.so
lib/radare2/0.8.1/debug_native.so
lib/radare2/0.8.1/io_debug.so
lib/radare2/0.8.1/io_gdb.so
lib/radare2/0.8.1/io_haret.so
lib/radare2/0.8.1/io_mach.so
lib/radare2/0.8.1/io_malloc.so
lib/radare2/0.8.1/io_procpid.so
lib/radare2/0.8.1/io_ptrace.so
lib/radare2/0.8.1/io_shm.so
lib/radare2/0.8.1/io_w32dbg.so
lib/radare2/0.8.1/parse_mreplace.so
lib/radare2/0.8.1/parse_x86_pseudo.so

View File

@ -0,0 +1,117 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2011/07/21 01:35:51 edd Exp $
%%SHARED%%
bin/r2
@bin bin/rabin2
@bin bin/radare2
@bin bin/radiff2
@bin bin/rafind2
@bin bin/rahash2
@bin bin/ranal2
@bin bin/rarc2
bin/rarc2-tool
@bin bin/rasc2
@bin bin/rasm2
@bin bin/rax2
include/libr/
include/libr/btree.h
include/libr/list.h
include/libr/r.h
include/libr/r_anal.h
include/libr/r_asm.h
include/libr/r_bin.h
include/libr/r_bp.h
include/libr/r_cmd.h
include/libr/r_config.h
include/libr/r_cons.h
include/libr/r_core.h
include/libr/r_crypto.h
include/libr/r_db.h
include/libr/r_debug.h
include/libr/r_diff.h
include/libr/r_flags.h
include/libr/r_flist.h
include/libr/r_fs.h
include/libr/r_hash.h
include/libr/r_io.h
include/libr/r_lang.h
include/libr/r_lib.h
include/libr/r_line.h
include/libr/r_list.h
include/libr/r_parse.h
include/libr/r_print.h
include/libr/r_reg.h
include/libr/r_search.h
include/libr/r_sign.h
include/libr/r_socket.h
include/libr/r_syscall.h
include/libr/r_th.h
include/libr/r_types.h
include/libr/r_types_base.h
include/libr/r_userconf.h
include/libr/r_util.h
lib/pkgconfig/
lib/pkgconfig/r_anal.pc
lib/pkgconfig/r_asm.pc
lib/pkgconfig/r_bin.pc
lib/pkgconfig/r_bp.pc
lib/pkgconfig/r_cmd.pc
lib/pkgconfig/r_config.pc
lib/pkgconfig/r_cons.pc
lib/pkgconfig/r_core.pc
lib/pkgconfig/r_debug.pc
lib/pkgconfig/r_diff.pc
lib/pkgconfig/r_flags.pc
lib/pkgconfig/r_fs.pc
lib/pkgconfig/r_hash.pc
lib/pkgconfig/r_io.pc
lib/pkgconfig/r_lang.pc
lib/pkgconfig/r_lib.pc
lib/pkgconfig/r_line.pc
lib/pkgconfig/r_parse.pc
lib/pkgconfig/r_print.pc
lib/pkgconfig/r_reg.pc
lib/pkgconfig/r_search.pc
lib/pkgconfig/r_sign.pc
lib/pkgconfig/r_socket.pc
lib/pkgconfig/r_syscall.pc
lib/pkgconfig/r_util.pc
lib/radare2/
lib/radare2/0.8.1/
lib/radare2/0.8.1/radare.lua
lib/radare2/0.8.1/radare.py
lib/radare2/0.8.1/radare.rb
@man man/man1/r2.1
@man man/man1/rabin2.1
@man man/man1/radare2.1
@man man/man1/radiff2.1
@man man/man1/rafind2.1
@man man/man1/rahash2.1
@man man/man1/ranal2.1
@man man/man1/rarc2-tool.1
@man man/man1/rarc2.1
@man man/man1/rasc2.1
@man man/man1/rasm2.1
@man man/man1/rax2.1
@man man/man1/rsc2.1
share/doc/pkg-readmes/${FULLPKGNAME}
share/doc/radare2/
share/doc/radare2/bindiff
share/doc/radare2/changes-from-1.x
share/doc/radare2/dospart
share/doc/radare2/fortunes
share/doc/radare2/idc2rdb.idc
share/doc/radare2/idc2rdb.pl
share/doc/radare2/iocache
share/doc/radare2/iphone
share/doc/radare2/lang-plugins
share/doc/radare2/maemo
share/doc/radare2/oo
share/doc/radare2/osx
share/doc/radare2/plugins
share/doc/radare2/releases
share/doc/radare2/rgraph
share/doc/radare2/solaris
share/doc/radare2/static
share/doc/radare2/static-plugins
share/doc/radare2/syntax
share/doc/radare2/windows

View File

@ -0,0 +1,44 @@
$OpenBSD: README,v 1.1.1.1 2011/07/21 01:35:51 edd Exp $
+-----------------------------------------------------------------------
| Running ${FULLPKGNAME} on OpenBSD
+-----------------------------------------------------------------------
Additional Dependencies
=======================
If you need to assemble x86/amd64 asm then you should install nasm
(devel/nasm), although this is not essential to the use of radare2.
NOTE: nasm is not available for all architectures on OpenBSD.
Bindings
========
For now, we have only enabled the Vala bindings (as the radare-bindings2
package). Further languages may be enabled in the future.
Known Issues
============
Backtraces
----------
The 'dbt' command (debug backtrace) is broken.
Arches
------
Some arches have been disabled. Eg. powerpc:
02:03 <sthen_p> needs more work on powerpc ;)
02:03 <sthen_p> $ r2 /bin/ls
02:03 <sthen_p> Cannot use 'unknown' anal plugin.
02:03 <sthen_p> asm.arch: cannot find (unknown)
02:03 <sthen_p> Cannot use 'unknown' anal plugin.
02:03 <sthen_p> r_syscall_setup: Unknown os/arch 'openbsd'/'unknown'
Reporting bugs
--------------
Please file bugs at ${HOMEPAGE}.