forked from radareorg/radare2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Previous commits has been reported in the ChangeLog file - hg log has been lost (moved inside ChangeLog) - Old radare1 repository has removed all the libr
- Loading branch information
0 parents
commit c5e588e
Showing
290 changed files
with
67,134 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
all: | ||
cd libr && make | ||
|
||
clean: | ||
cd libr && make clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
____ ___ ____ ___ ____ ___ ______ ____ | ||
| _ \/ \' \/ \ _ \/ _ \ \__ | / \ | ||
| < V . T . V < _/ .--'_/ | () | | ||
|_|\__|_|__|___/|_|_|_|\__\___/ |_____(_)____/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# XXX | ||
PREFIX=/tmp/libr-install | ||
|
||
# Libraries | ||
LIBLIST=io io/plugins util bin macro hash print config flags cons line lib syscall range socket cmd asm search core diff debug reg | ||
|
||
|
||
# Under development | ||
#LIBLIST+=print | ||
#LIBLIST+=util | ||
#LIBLIST+=search | ||
|
||
# TODO : generate single library linking against the rest | ||
#LIBSO=libr.so | ||
#LIBAR=libr.a | ||
|
||
all: | ||
for lib in ${LIBLIST}; do ( cd $${lib} && ${MAKE} all ); done | ||
@echo Build done for: ${LIBLIST} | ||
|
||
install: | ||
# libraries | ||
@mkdir -p ${PREFIX}/lib | ||
@for a in `find * | grep -e '\.so$$'` ; do \ | ||
echo " $$a "; cp $$a ${PREFIX}/lib ; done | ||
# object archives | ||
@for a in `find * | grep -e '\.a$$'` ; do \ | ||
echo " $$a"; cp $$a ${PREFIX}/lib ; done | ||
# includes | ||
@mkdir -p ${PREFIX}/include | ||
cp -f include/* ${PREFIX}/include | ||
# programs | ||
@mkdir -p ${PREFIX}/bin | ||
cp -f util/t/rax2 ${PREFIX}/bin | ||
# test programs | ||
@mkdir -p ${PREFIX}/bin-test | ||
@for a in `find */t -perm /u+x -type f`; \ | ||
do echo " $$a"; cp $$a ${PREFIX}/bin-test ; done | ||
@echo libr aka radare2 has been installed in PREFIX=${PREFIX} | ||
|
||
todo: | ||
grep -re TODO * | ||
|
||
clean: | ||
for lib in ${LIBLIST}; do ( cd $${lib} && ${MAKE} clean ); done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
========================= | ||
libr - codename 'radare2' | ||
========================= | ||
|
||
LibR is the refactoring of the old radare1 core in a set of libraries | ||
defining the APIs of radare2. | ||
|
||
The library 'libr' is composed by different modules, each one implementing | ||
working modules of radare, so then, we get a complete set of libraries for | ||
analyzing code, disassembling bytes, dumping bytes, plugin handling, etc.. | ||
|
||
The 'R' is for refactoring, reversing, radare, ... | ||
|
||
Each module has its own test directory (t/) which contains simple applications | ||
using the upper directory code and linking against the direct dependencies. | ||
|
||
This enables a fine-grained test level for checking all functionalities in | ||
one shot and give us the opportunity to write radare2 as test programs. | ||
|
||
--pancake |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
|
||
____ ___ ____ ___ ____ ___ ______ ____ | ||
| _ \/ \' \/ \ _ \/ _ \ \__ | / \ | ||
| < V . T . V < _/ .--'_/ | () | | ||
|_|\__|_|__|___/|_|_|_|\__\___/ |_____(_)____/ | ||
|
||
----------------------------------------[ todo | ||
|
||
|| asm || | ||
--------- | ||
- Add support for more architectures | ||
- Add lua disassembler | ||
- Add java, dalvik, xtensa achiecture (mm cpu) | ||
- http://git.linux-xtensa.org/cgi-bin/git.cgi?p=buildroot/buildroot-xtensa;a=blob;f=toolchain/binutils/binutils-xtensa_dc232b.tgz;h=214164399158c540a3033e52b3bb9f65c55289af;hb=HEAD | ||
- Vala API should not use State | ||
- Fix cpp issues | ||
- Fix endianess issues | ||
|
||
|| anal || **MISSING** | ||
---------- | ||
- define api, write vapi, integrate in core, etc.. | ||
|
||
|| bin || | ||
--------- | ||
- No Vala api yet | ||
- Add support for PE64, mach0 and java class | ||
- Add dex format support (android) | ||
|
||
|| cmd || | ||
--------- | ||
- long commands not yet tested at all | ||
- added interface to export command list into an autocompletable | ||
argc, argv for dietline | ||
|
||
|| line || | ||
---------- | ||
- make it work with state like teh rest | ||
- add support for readline callbacks | ||
|
||
|| config || | ||
------------ | ||
- missing default callback for int assign | ||
|
||
|| cons || | ||
---------- | ||
- add pipe_to_buffer..not only file descriptors | ||
- major cleanup | ||
- split in multiple files | ||
- get_real_columns() should be renamed to get_columns() | ||
|
||
|| flags || | ||
----------- | ||
- Define a way to iterate flags from vala | ||
- We probably need more methods | ||
|
||
|| hash || | ||
---------- | ||
- Drop State() ? | ||
|
||
|| diff || | ||
---------- | ||
- Needs to fix the delta diffing algorithm | ||
- Reimplement delta diffing in C | ||
|
||
|| sign || | ||
---------- | ||
- Define attributes and weights | ||
- Decide collissions based on these patterns | ||
|
||
|| meta || **MISSING** | ||
---------- | ||
|
||
|| lib || | ||
--------- | ||
- Cleanup and test w32/osx support | ||
|
||
|| debug || | ||
----------- | ||
- define plugin extensions (use vm from here) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
NAME=r_asm | ||
OBJ=asm.o | ||
CFLAGS+=-Iarch/include | ||
# XXX | ||
CFLAGS+=-DLIL_ENDIAN=1 | ||
|
||
# X86 | ||
OBJ+=arch/x86/asm.o | ||
OBJ+=arch/x86/pseudo.o | ||
OBJ+=arch/x86/realloc.o | ||
# udis86 | ||
OBJ+=arch/x86/udis86/syn.o | ||
OBJ+=arch/x86/udis86/input.o | ||
OBJ+=arch/x86/udis86/udis86.o | ||
OBJ+=arch/x86/udis86/decode.o | ||
OBJ+=arch/x86/udis86/itab.o | ||
OBJ+=arch/x86/udis86/syn-intel.o | ||
OBJ+=arch/x86/udis86/syn-att.o | ||
# olly | ||
OBJ+=arch/x86/ollyasm/disasm.o | ||
OBJ+=arch/x86/ollyasm/asmserv.o | ||
OBJ+=arch/x86/ollyasm/assembl.o | ||
|
||
# ARM | ||
OBJ+=arch/arm/asm.o | ||
# gnu arm-dis | ||
OBJ+=arch/arm/gnu/arm-dis.o | ||
|
||
# MIPS | ||
OBJ+=arch/mips/asm.o | ||
# gnu mips-dis | ||
OBJ+=arch/mips/gnu/mips-dis.o | ||
OBJ+=arch/mips/gnu/mips16-opc.o | ||
OBJ+=arch/mips/gnu/mips-opc.o | ||
|
||
# SPARC | ||
OBJ+=arch/sparc/asm.o | ||
# gnu sparc-dis | ||
OBJ+=arch/sparc/gnu/sparc-dis.o | ||
OBJ+=arch/sparc/gnu/sparc-opc.o | ||
|
||
# PPC | ||
OBJ+=arch/ppc/asm.o | ||
# ppc-disasm | ||
OBJ+=arch/ppc/ppc_disasm/ppc_disasm.o | ||
|
||
# BF | ||
OBJ+=arch/bf/asm.o | ||
|
||
include ../rules.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/* radare - LGPL - Copyright 2009 nibble<[email protected]> */ | ||
|
||
#include <stdio.h> | ||
#include <stdarg.h> | ||
#include <string.h> | ||
|
||
#include <r_types.h> | ||
#include <r_util.h> | ||
#include <r_asm.h> | ||
|
||
#include "dis-asm.h" | ||
|
||
|
||
static int arm_mode = 0; | ||
static unsigned long Offset = 0; | ||
static char *buf_global = NULL; | ||
static unsigned char bytes[4]; | ||
|
||
static int arm_buffer_read_memory (bfd_vma memaddr, bfd_byte *myaddr, unsigned int length, struct disassemble_info *info) | ||
{ | ||
memcpy (myaddr, bytes, length); | ||
return 0; | ||
} | ||
|
||
static int symbol_at_address(bfd_vma addr, struct disassemble_info * info) | ||
{ | ||
return 0; | ||
} | ||
|
||
static void memory_error_func(int status, bfd_vma memaddr, struct disassemble_info *info) | ||
{ | ||
//-- | ||
} | ||
|
||
static void print_address(bfd_vma address, struct disassemble_info *info) | ||
{ | ||
char tmp[32]; | ||
if (buf_global == NULL) | ||
return; | ||
sprintf(tmp, "0x%08llx", (u64)address); | ||
strcat(buf_global, tmp); | ||
} | ||
|
||
static int buf_fprintf(void *stream, const char *format, ...) | ||
{ | ||
va_list ap; | ||
char *tmp; | ||
if (buf_global == NULL) | ||
return 0; | ||
va_start(ap, format); | ||
tmp = alloca(strlen(format)+strlen(buf_global)+2); | ||
sprintf(tmp, "%s%s", buf_global, format); | ||
vsprintf(buf_global, tmp, ap); | ||
va_end(ap); | ||
return 0; | ||
} | ||
|
||
int r_asm_arm_disasm(struct r_asm_t *a, u8 *buf, u64 len) | ||
{ | ||
struct disassemble_info disasm_obj; | ||
int ret; | ||
|
||
buf_global = a->buf_asm; | ||
Offset = a->pc; | ||
memcpy(bytes, buf, 4); // TODO handle thumb | ||
r_hex_bin2str(bytes, 4, a->buf_hex); | ||
|
||
/* prepare disassembler */ | ||
memset(&disasm_obj,'\0', sizeof(struct disassemble_info)); | ||
arm_mode = a->bits; | ||
//info.arch = ARM_EXT_V1|ARM_EXT_V4T|ARM_EXT_V5; | ||
disasm_obj.buffer = bytes; | ||
disasm_obj.read_memory_func = &arm_buffer_read_memory; | ||
disasm_obj.symbol_at_address_func = &symbol_at_address; | ||
disasm_obj.memory_error_func = &memory_error_func; | ||
disasm_obj.print_address_func = &print_address; | ||
disasm_obj.endian = !a->big_endian; | ||
disasm_obj.fprintf_func = &buf_fprintf; | ||
disasm_obj.stream = stdout; | ||
|
||
a->buf_asm[0]='\0'; | ||
ret = print_insn_arm((bfd_vma)Offset, &disasm_obj); | ||
|
||
if (ret == -1) | ||
strcpy(a->buf_asm, " (data)"); | ||
|
||
return ret; | ||
} |
Oops, something went wrong.