* Fix make w32dist
* Update manpages * Added r2 -H for env and files help * Add rarun2 -h * Show assembler/disassembler features in rasm2 -L * Add opcode 'mov dword [ebp-12],4' to x86.nz - Make t/test.nz work with x86.olly (32bit only atm) * Fix unknown os issue with tiny-pe files in r_bin * Fix some plugin names build fails in mingw32 * MAGICPATH renamed to R_MAGIC_PATH * Add another experimental way to generate gir files - Added dummy test.js for nodejs * Build python-dist in farm --HG-- rename : man/rarc2-tool.1 => binr/old.rarc2/rarc2-tool.1 rename : man/rarc2.1 => binr/old.rarc2/rarc2.1
This commit is contained in:
parent
19b8fd3120
commit
e9d1dcb4ec
31 changed files with 472 additions and 151 deletions
1
Makefile
1
Makefile
|
|
@ -55,6 +55,7 @@ w32dist:
|
|||
for a in `find binr | grep -e exe$$`; do cp $$a w32dist ; done
|
||||
rm w32dist/plugin.dll
|
||||
mv w32dist radare2-w32-${VERSION}
|
||||
rm -f radare2-w32-${VERSION}.zip
|
||||
zip -r radare2-w32-${VERSION}.zip radare2-w32-${VERSION}
|
||||
|
||||
w32beta: w32dist
|
||||
|
|
|
|||
16
TODO
16
TODO
|
|
@ -5,9 +5,15 @@
|
|||
|
||||
------8<-------------------8<--------------------8<-----------------8<----------
|
||||
|
||||
* 'ao' must be for bytes count, not bytes
|
||||
|
||||
====[[ 0.8.6 ]]====
|
||||
* check bindings and apis
|
||||
|
||||
====[[ 0.9 ]]====
|
||||
|
||||
* Add support for 'expect' like foo in rarun2
|
||||
- add support for exectimeout in rarun2
|
||||
* TODO: make elf/pe get_os() and others return const and not strdup
|
||||
* 'ao' must be for bytes count, not bytes
|
||||
* asm.pseudo for brainfuck
|
||||
* implement 'ax' to get/set xrefs (better than afl <addr>)
|
||||
* shell encoder - get x86-64 one from twitter
|
||||
|
|
@ -16,9 +22,6 @@
|
|||
* use centralized pubsub or memcached to sync data
|
||||
* rabin2 -z /dev/sda1 TAKES TOO LONG. opening r2 /tmp/fs is SLOW as shit.
|
||||
* Implement differential distance signature search
|
||||
|
||||
====[[ 0.9 ]]====
|
||||
|
||||
* Add support for classes (useful for c++, dex, objc, ...)
|
||||
- command to add new classes
|
||||
|
||||
|
|
@ -29,6 +32,7 @@ OSX
|
|||
|
||||
Other stuff
|
||||
===========
|
||||
* implement code analysis using udis86.. is this necessary.. x86im works fine?
|
||||
* code analysis for msil
|
||||
* rax2 -k by default?
|
||||
* Optimize /m
|
||||
|
|
@ -53,7 +57,6 @@ Other stuff
|
|||
- pe64
|
||||
- plan9 bins
|
||||
|
||||
|
||||
TODO
|
||||
====
|
||||
* Implement r_flag_unset_i () ftw
|
||||
|
|
@ -94,7 +97,6 @@ To wipe:
|
|||
- imho we should not implement this:
|
||||
- Implement BLOCK in r_core_sysenv_begin|end ()
|
||||
|
||||
|
||||
pancake
|
||||
-------
|
||||
* check search multiple keywords and signatures
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@ static int threaded = 0;
|
|||
static struct r_core_t r;
|
||||
|
||||
static int main_help(int line) {
|
||||
printf ("Usage: radare2 [-dDwnLqv] [-P patch] [-p prj] [-s addr] [-b bsz] [-c cmd] [-e k=v] [file]\n");
|
||||
if (line<2)
|
||||
printf ("Usage: radare2 [-dDwntLqv] [-P patch] [-p prj]"
|
||||
" [-s addr] [-b bsz] [-c cmd] [-e k=v] [file]\n");
|
||||
if (!line) printf (
|
||||
" -d use 'file' as a program to debug\n"
|
||||
" -D [backend] enable debug mode (e cfg.debug=true)\n"
|
||||
|
|
@ -35,7 +37,14 @@ static int main_help(int line) {
|
|||
#endif
|
||||
" -L list supported IO plugins\n"
|
||||
" -e k=v evaluate config var\n"
|
||||
" -c \"cmd..\" execute radare command\n"
|
||||
" -c 'cmd..' execute radare command\n"
|
||||
" -h show this help\n"
|
||||
" -H show extended help (files and environment)\n");
|
||||
if (line==2)
|
||||
printf (
|
||||
"Files:\n"
|
||||
" RCFILE ~/.radare2rc\n"
|
||||
" MAGICPATH "R_MAGIC_PATH"\n"
|
||||
"Environment:\n"
|
||||
" R_DEBUG if defined, show error messages and crash signal\n"
|
||||
" LIBR_PLUGINS path to plugins directory\n"
|
||||
|
|
@ -113,7 +122,7 @@ int main(int argc, char **argv) {
|
|||
return main_help (1);
|
||||
r_core_init (&r);
|
||||
|
||||
while ((c = getopt (argc, argv, "wfhe:ndqvs:p:b:Lui:l:P:c:D:"
|
||||
while ((c = getopt (argc, argv, "wfhHe:ndqvs:p:b:Lui:l:P:c:D:"
|
||||
#if USE_THREADS
|
||||
"t"
|
||||
#endif
|
||||
|
|
@ -152,6 +161,8 @@ int main(int argc, char **argv) {
|
|||
case 'e':
|
||||
r_config_eval (r.config, optarg);
|
||||
break;
|
||||
case 'H':
|
||||
return main_help (2);
|
||||
case 'h':
|
||||
return main_help (0);
|
||||
case 'f':
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ static void parseline (char *b) {
|
|||
char *e = strchr (b, '=');
|
||||
if (!e) return;
|
||||
if (*b=='#') return;
|
||||
*e++=0;
|
||||
*e++ = 0;
|
||||
if (*e=='$') e = r_sys_getenv (e);
|
||||
if (e == NULL) return;
|
||||
if (!strcmp (b, "program")) _program = strdup (e);
|
||||
|
|
@ -117,8 +117,8 @@ static int runfile () {
|
|||
int main(int argc, char **argv) {
|
||||
FILE *fd;
|
||||
char *file, buf[1024];
|
||||
if (argc==1) {
|
||||
printf ("Usage: rarun2 script\n");
|
||||
if (argc==1 || !strcmp (argv[1], "-h")) {
|
||||
printf ("Usage: rarun2 [script.rr2]\n");
|
||||
return 1;
|
||||
}
|
||||
file = argv[1];
|
||||
|
|
|
|||
|
|
@ -16,8 +16,13 @@ static int coutput = R_FALSE;
|
|||
static void r_asm_list(RAsm *a) {
|
||||
RAsmPlugin *h;
|
||||
RListIter *iter;
|
||||
r_list_foreach (a->plugins, iter, h)
|
||||
printf ("asm %-10s\t %s\n", h->name, h->desc);
|
||||
r_list_foreach (a->plugins, iter, h) {
|
||||
const char *feat="---";
|
||||
if (h->assemble && h->disassemble) feat = "ad";
|
||||
if (h->assemble && !h->disassemble) feat = "a_";
|
||||
if (!h->assemble && h->disassemble) feat = "_d";
|
||||
printf ("%s %-8s %s\n", feat, h->name, h->desc);
|
||||
}
|
||||
}
|
||||
|
||||
static int rasm_show_help() {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@ static int getnum(const char *s);
|
|||
static int isnum(const char *str);
|
||||
static ut8 getreg(const char *s);
|
||||
#if 0
|
||||
TODO
|
||||
mov [esp+4], N
|
||||
mov [esp+4], reg
|
||||
BLA:
|
||||
Add support for AND, OR, ..
|
||||
0x100000ec5 1 4883e4f0 and rsp, 0xfffffffffffffff0
|
||||
#endif
|
||||
|
|
@ -73,6 +77,8 @@ static int assemble(RAsm *a, RAsmOp *ao, const char *str) {
|
|||
strncpy (op, str, sizeof (op)-1);
|
||||
arg = strstr (op, "dword ptr");
|
||||
if (arg) strcpy (arg, arg+strlen ("dword ptr"));
|
||||
arg = strstr (op, "dword ");
|
||||
if (arg) strcpy (arg, arg+strlen ("dword "));
|
||||
|
||||
if (!memcmp (op, "rep ", 4)) {
|
||||
data[l++] = 0xf3;
|
||||
|
|
@ -105,8 +111,14 @@ static int assemble(RAsm *a, RAsmOp *ao, const char *str) {
|
|||
if (*arg == '[' || *arg2=='[') {
|
||||
eprintf ("xchg with memory access not yet implemented\n");
|
||||
} else {
|
||||
data[l++] = 0x87;
|
||||
data[l++] = 0xc0 | getreg (arg) | getreg (arg2)<<3;
|
||||
int reg1 = getreg (arg);
|
||||
int reg2 = getreg (arg2);
|
||||
if (reg1 == reg2) {
|
||||
data[l++] = 0x90;
|
||||
} else {
|
||||
data[l++] = 0x87;
|
||||
data[l++] = 0xc0 | reg1 | reg2<<3;
|
||||
}
|
||||
return l;
|
||||
}
|
||||
} else {
|
||||
|
|
@ -471,6 +483,25 @@ static int assemble(RAsm *a, RAsmOp *ao, const char *str) {
|
|||
//if (!delta) delta = strchr (arg, '-'); // XXX: TODO: handle negative off
|
||||
if (delta) {
|
||||
*delta++ = 0;
|
||||
} else {
|
||||
delta = strchr (arg, '-');
|
||||
if (delta) {
|
||||
ut32 n = -getnum (delta+1);
|
||||
ut8 *N = (ut8*)&n;
|
||||
*delta++ = 0;
|
||||
data[l++] = 0xc7;
|
||||
data[l++] = 0x80 | getreg (arg);
|
||||
data[l++] = N[0];
|
||||
data[l++] = N[1];
|
||||
data[l++] = N[2];
|
||||
data[l++] = N[3];
|
||||
n = getnum (arg2);
|
||||
data[l++] = N[0];
|
||||
data[l++] = N[1];
|
||||
data[l++] = N[2];
|
||||
data[l++] = N[3];
|
||||
return l;
|
||||
}
|
||||
}
|
||||
pfx = 0;
|
||||
} else pfx = 0xc0;
|
||||
|
|
@ -510,6 +541,7 @@ static int assemble(RAsm *a, RAsmOp *ao, const char *str) {
|
|||
return l;
|
||||
pfx = 0;
|
||||
} //else pfx = 0xc0;
|
||||
|
||||
arg0 = getreg (arg); // hack to make is64 work
|
||||
if (isnum (arg)) {
|
||||
int num = getnum (arg);
|
||||
|
|
@ -543,9 +575,12 @@ static int assemble(RAsm *a, RAsmOp *ao, const char *str) {
|
|||
if (delta) {
|
||||
int n = getnum (delta);
|
||||
data[l++] = 0xc7;
|
||||
if (n>127 || n<-127) {
|
||||
if (1||n>127 || n<-127) { // XXX
|
||||
int reg = getreg (arg);
|
||||
ut8 *ptr = (ut8 *)&n;
|
||||
data[l++] = 0x80 | getreg (arg);
|
||||
data[l++] = 0x80 | reg;
|
||||
if (reg == 4) // reg=ESP
|
||||
data[l++] = ptr[0] | 0x20;
|
||||
data[l++] = ptr[0];
|
||||
data[l++] = ptr[1];
|
||||
data[l++] = ptr[2];
|
||||
|
|
@ -561,7 +596,7 @@ static int assemble(RAsm *a, RAsmOp *ao, const char *str) {
|
|||
if (r==4) { //ESP
|
||||
data[l++] = 0x04;
|
||||
data[l++] = 0x24;
|
||||
} else if (r== 5) { // EBP
|
||||
} else if (r==5) { // EBP
|
||||
data[l++] = 0x75;
|
||||
data[l++] = 0;
|
||||
} else data[l++] = r;
|
||||
|
|
|
|||
|
|
@ -1,11 +1,28 @@
|
|||
#!/bin/sh
|
||||
|
||||
AS=x86.as
|
||||
AS=x86.olly
|
||||
|
||||
foo() {
|
||||
A=$(rasm2 -a ${AS} -b ${BITS} "$1")
|
||||
B=$(rasm2 -a x86.nz -b ${BITS} "$1")
|
||||
D=$(rasm2 -b ${BITS} -d "$A")
|
||||
D=$(rasm2 -b ${BITS} -a x86.olly -d "$A" |sed -e 's, ptr,,')
|
||||
Q=$(echo "$D" | sed -e 's,dword ,,g' -e 's,\+0x0,,g' -e 's,\+0x4,+4,g' -e s,0x1,1,g -e 's,0x29[A|a],666,g' -e s,0x3,3, -e s,0x8,8, -e 's/,\ /,/' -e s,0x21,33,g -e s,0x2,2,)
|
||||
Q2=$(echo "$1" | sed -e 's,dword ,,g' -e 's,\+0x0,,g' -e 's,\+0x4,+4,g' -e s,0x1,1,g -e 's,0x29[A|a],666,g' -e s,0x3,3, -e s,0x8,8, -e 's/,\ /,/' -e s,0x21,33,g -e s,0x2,2,)
|
||||
if [ 0 = 1 ]; then
|
||||
echo "D=$D"
|
||||
echo "Q=$Q"
|
||||
echo "Q2=$Q2"
|
||||
echo A=rasm2 -a ${AS} -b ${BITS} "$1"
|
||||
echo B=rasm2 -a x86.nz -b ${BITS} "$1"
|
||||
echo "Q=$Q"
|
||||
echo A=$A
|
||||
echo B=$B
|
||||
echo D=$D
|
||||
fi
|
||||
if [ "$Q" = "$Q2" ]; then
|
||||
B=$A
|
||||
#echo "QEQA"
|
||||
fi
|
||||
if [ "${A}" = "${B}" ]; then
|
||||
printf "OK %12s.as %12s.nz %20s = $D\n" "$A" "$B" "$1"
|
||||
else
|
||||
|
|
@ -31,7 +48,7 @@ foo 'xchg ecx,ebx'
|
|||
|
||||
if true ; then
|
||||
AS=x86.olly
|
||||
foo 'jl patata'
|
||||
#foo 'jl patata'
|
||||
foo 'jl 0x8049300'
|
||||
foo 'jl 0x8048010'
|
||||
foo 'jle 0x8049300'
|
||||
|
|
@ -51,11 +68,11 @@ foo 'jg 0x8049300'
|
|||
|
||||
fi
|
||||
|
||||
AS=x86.as
|
||||
AS=x86.olly
|
||||
|
||||
BITS=64
|
||||
foo "test rdx, rsi"
|
||||
foo "test rax, rbx"
|
||||
#BITS=64
|
||||
#foo "test rdx, rsi"
|
||||
#foo "test rax, rbx"
|
||||
BITS=32
|
||||
foo "test edx, esi"
|
||||
foo "test eax, ebx"
|
||||
|
|
@ -68,31 +85,33 @@ foo "push [esi+4]"
|
|||
foo "push [eax+8]"
|
||||
# exit 0
|
||||
|
||||
foo "sub dword ptr [eax], 1"
|
||||
foo "add dword ptr [eax], 1"
|
||||
foo "add dword ptr [ebx], 1"
|
||||
foo "add dword ptr [ebp+4], 1"
|
||||
foo "add dword ptr [ebp+8], 1"
|
||||
foo "sub dword [eax], 1"
|
||||
foo "add dword [eax], 1"
|
||||
foo "add dword [ebx], 1"
|
||||
foo "add dword [ebp+4], 1"
|
||||
foo "add dword [ebp+8], 1"
|
||||
|
||||
foo "add dword ptr [esp+8], 1"
|
||||
foo "add dword ptr [eax+8], 1"
|
||||
foo "add dword [esp+8], 1"
|
||||
foo "add dword [eax+8], 1"
|
||||
foo "add eax, 1"
|
||||
foo "add dword ptr [ebx+8], 1"
|
||||
foo "add dword [ebx+8], 1"
|
||||
|
||||
#exit
|
||||
|
||||
foo "sub dword ptr [ebx], 1"
|
||||
foo "sub dword [ebx], 1"
|
||||
foo "sub eax, 666"
|
||||
foo "sub ebx, 666"
|
||||
foo "sub ecx, 666"
|
||||
foo "sub eax, 3"
|
||||
foo "sub dword ptr [eax], 666"
|
||||
foo "sub dword ptr [eax+4], 666"
|
||||
foo "sub dword [eax], 666"
|
||||
foo "sub dword [eax+4], 666"
|
||||
|
||||
|
||||
foo "sub dword ptr [ebp+4], 1"
|
||||
foo "mov dword ptr [ebp+4], 1"
|
||||
foo "mov dword ptr [eax+4], 1"
|
||||
foo "mov dword [ebp+4], 1"
|
||||
foo "mov dword [esp+4], 1"
|
||||
foo "sub dword [ebp+4], 1"
|
||||
foo "mov dword [ebp+4], 1"
|
||||
foo "mov dword [eax+4], 1"
|
||||
foo "mov dword ptr [eax+4], 666"
|
||||
foo "mov dword ptr [eax], 666"
|
||||
|
||||
|
|
@ -108,13 +127,12 @@ foo "mov eax, 0x8049000"
|
|||
|
||||
foo "mov dword ptr[esi+4], 33"
|
||||
foo "mov [eax+eax], eax"
|
||||
foo "mov [eax+ebx], eax"
|
||||
foo "mov [ebx+eax], eax"
|
||||
foo "mov [eax+ecx], eax"
|
||||
foo "mov [ebx+eax], eax"
|
||||
foo "mov [eax+eax], ebx"
|
||||
foo "mov [eax+eax], ecx"
|
||||
foo "mov [eax+eax], eax"
|
||||
foo "mov [eax+ebx], ebx"
|
||||
foo "mov [eax+2], ebx"
|
||||
foo "mov [ebx+2], ebx"
|
||||
|
||||
|
|
@ -182,9 +200,9 @@ foo "lea eax, [4]"
|
|||
foo "lea ebx, [4]"
|
||||
|
||||
|
||||
BITS=64
|
||||
foo "test rdx, rsi"
|
||||
foo "test rax, rbx"
|
||||
#BITS=64
|
||||
#foo "test rdx, rsi"
|
||||
#foo "test rax, rbx"
|
||||
BITS=32
|
||||
foo "test edx, esi"
|
||||
foo "test eax, ebx"
|
||||
|
|
@ -256,6 +274,11 @@ foo "test edx, esi"
|
|||
foo "test eax, ebx"
|
||||
fi
|
||||
|
||||
exit 0
|
||||
# olly doesnt supports 64bits
|
||||
|
||||
AS=x86.as
|
||||
|
||||
# 64 bit tests #
|
||||
# ============ #
|
||||
BITS=64
|
||||
|
|
@ -291,4 +314,5 @@ foo "cmp rbx, rax"
|
|||
foo "cmp rdx, rsi"
|
||||
foo "test rdx, rsi"
|
||||
foo "test rax, rbx"
|
||||
foo "mov dword [ebp-12], 1"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -408,8 +408,7 @@ struct r_bin_pe_import_t* PE_(r_bin_pe_get_imports)(struct PE_(r_bin_pe_obj_t) *
|
|||
return imports;
|
||||
}
|
||||
|
||||
struct r_bin_pe_lib_t* PE_(r_bin_pe_get_libs)(struct PE_(r_bin_pe_obj_t) *bin)
|
||||
{
|
||||
struct r_bin_pe_lib_t* PE_(r_bin_pe_get_libs)(struct PE_(r_bin_pe_obj_t) *bin) {
|
||||
struct r_bin_pe_lib_t *libs = NULL;
|
||||
int import_dirs_count = PE_(r_bin_pe_get_import_dirs_count)(bin);
|
||||
int delay_import_dirs_count = PE_(r_bin_pe_get_delay_import_dirs_count)(bin);
|
||||
|
|
@ -449,13 +448,12 @@ struct r_bin_pe_lib_t* PE_(r_bin_pe_get_libs)(struct PE_(r_bin_pe_obj_t) *bin)
|
|||
return libs;
|
||||
}
|
||||
|
||||
int PE_(r_bin_pe_get_image_size)(struct PE_(r_bin_pe_obj_t)* bin)
|
||||
{
|
||||
int PE_(r_bin_pe_get_image_size)(struct PE_(r_bin_pe_obj_t)* bin) {
|
||||
return bin->nt_headers->optional_header.SizeOfImage;
|
||||
}
|
||||
|
||||
char* PE_(r_bin_pe_get_machine)(struct PE_(r_bin_pe_obj_t)* bin)
|
||||
{
|
||||
// TODO: make it const! like in elf
|
||||
char* PE_(r_bin_pe_get_machine)(struct PE_(r_bin_pe_obj_t)* bin) {
|
||||
char *machine;
|
||||
|
||||
switch (bin->nt_headers->file_header.Machine) {
|
||||
|
|
@ -546,12 +544,11 @@ char* PE_(r_bin_pe_get_machine)(struct PE_(r_bin_pe_obj_t)* bin)
|
|||
default:
|
||||
machine = strdup("unknown");
|
||||
}
|
||||
|
||||
return machine;
|
||||
}
|
||||
|
||||
char* PE_(r_bin_pe_get_os)(struct PE_(r_bin_pe_obj_t)* bin)
|
||||
{
|
||||
// TODO: make it const! like in elf
|
||||
char* PE_(r_bin_pe_get_os)(struct PE_(r_bin_pe_obj_t)* bin) {
|
||||
char *os;
|
||||
|
||||
switch (bin->nt_headers->optional_header.Subsystem) {
|
||||
|
|
@ -561,29 +558,29 @@ char* PE_(r_bin_pe_get_os)(struct PE_(r_bin_pe_obj_t)* bin)
|
|||
case PE_IMAGE_SUBSYSTEM_WINDOWS_GUI:
|
||||
case PE_IMAGE_SUBSYSTEM_WINDOWS_CUI:
|
||||
case PE_IMAGE_SUBSYSTEM_WINDOWS_CE_GUI:
|
||||
os = strdup("windows");
|
||||
os = strdup ("windows");
|
||||
break;
|
||||
case PE_IMAGE_SUBSYSTEM_POSIX_CUI:
|
||||
os = strdup("posix");
|
||||
os = strdup ("posix");
|
||||
break;
|
||||
case PE_IMAGE_SUBSYSTEM_EFI_APPLICATION:
|
||||
case PE_IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER:
|
||||
case PE_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER:
|
||||
case PE_IMAGE_SUBSYSTEM_EFI_ROM:
|
||||
os = strdup("efi");
|
||||
os = strdup ("efi");
|
||||
break;
|
||||
case PE_IMAGE_SUBSYSTEM_XBOX:
|
||||
os = strdup("xbox");
|
||||
os = strdup ("xbox");
|
||||
break;
|
||||
default:
|
||||
os = strdup("unknown");
|
||||
// XXX: this is unknown
|
||||
os = strdup ("windows");
|
||||
}
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
char* PE_(r_bin_pe_get_class)(struct PE_(r_bin_pe_obj_t)* bin)
|
||||
{
|
||||
// TODO: make it const
|
||||
char* PE_(r_bin_pe_get_class)(struct PE_(r_bin_pe_obj_t)* bin) {
|
||||
char *class;
|
||||
|
||||
switch (bin->nt_headers->optional_header.Magic) {
|
||||
|
|
@ -599,8 +596,7 @@ char* PE_(r_bin_pe_get_class)(struct PE_(r_bin_pe_obj_t)* bin)
|
|||
return class;
|
||||
}
|
||||
|
||||
int PE_(r_bin_pe_get_bits)(struct PE_(r_bin_pe_obj_t)* bin)
|
||||
{
|
||||
int PE_(r_bin_pe_get_bits)(struct PE_(r_bin_pe_obj_t)* bin) {
|
||||
int bits;
|
||||
|
||||
switch (bin->nt_headers->optional_header.Magic) {
|
||||
|
|
@ -620,8 +616,7 @@ int PE_(r_bin_pe_get_section_alignment)(struct PE_(r_bin_pe_obj_t)* bin) {
|
|||
return bin->nt_headers->optional_header.SectionAlignment;
|
||||
}
|
||||
|
||||
struct r_bin_pe_section_t* PE_(r_bin_pe_get_sections)(struct PE_(r_bin_pe_obj_t)* bin)
|
||||
{
|
||||
struct r_bin_pe_section_t* PE_(r_bin_pe_get_sections)(struct PE_(r_bin_pe_obj_t)* bin) {
|
||||
struct r_bin_pe_section_t *sections = NULL;
|
||||
PE_(image_section_header) *shdr = bin->section_header;
|
||||
int i, sections_count = bin->nt_headers->file_header.NumberOfSections;
|
||||
|
|
@ -644,8 +639,7 @@ struct r_bin_pe_section_t* PE_(r_bin_pe_get_sections)(struct PE_(r_bin_pe_obj_t)
|
|||
return sections;
|
||||
}
|
||||
|
||||
char* PE_(r_bin_pe_get_subsystem)(struct PE_(r_bin_pe_obj_t)* bin)
|
||||
{
|
||||
char* PE_(r_bin_pe_get_subsystem)(struct PE_(r_bin_pe_obj_t)* bin) {
|
||||
char *subsystem;
|
||||
|
||||
switch (bin->nt_headers->optional_header.Subsystem) {
|
||||
|
|
@ -685,60 +679,44 @@ char* PE_(r_bin_pe_get_subsystem)(struct PE_(r_bin_pe_obj_t)* bin)
|
|||
return subsystem;
|
||||
}
|
||||
|
||||
int PE_(r_bin_pe_is_dll)(struct PE_(r_bin_pe_obj_t)* bin)
|
||||
{
|
||||
int PE_(r_bin_pe_is_dll)(struct PE_(r_bin_pe_obj_t)* bin) {
|
||||
return bin->nt_headers->file_header.Characteristics & PE_IMAGE_FILE_DLL;
|
||||
}
|
||||
|
||||
int PE_(r_bin_pe_is_big_endian)(struct PE_(r_bin_pe_obj_t)* bin)
|
||||
{
|
||||
int PE_(r_bin_pe_is_big_endian)(struct PE_(r_bin_pe_obj_t)* bin) {
|
||||
return bin->nt_headers->file_header.Characteristics & PE_IMAGE_FILE_BYTES_REVERSED_HI;
|
||||
}
|
||||
|
||||
int PE_(r_bin_pe_is_stripped_relocs)(struct PE_(r_bin_pe_obj_t)* bin)
|
||||
{
|
||||
int PE_(r_bin_pe_is_stripped_relocs)(struct PE_(r_bin_pe_obj_t)* bin) {
|
||||
return bin->nt_headers->file_header.Characteristics & PE_IMAGE_FILE_RELOCS_STRIPPED;
|
||||
}
|
||||
|
||||
int PE_(r_bin_pe_is_stripped_line_nums)(struct PE_(r_bin_pe_obj_t)* bin)
|
||||
{
|
||||
int PE_(r_bin_pe_is_stripped_line_nums)(struct PE_(r_bin_pe_obj_t)* bin) {
|
||||
return bin->nt_headers->file_header.Characteristics & PE_IMAGE_FILE_LINE_NUMS_STRIPPED;
|
||||
}
|
||||
|
||||
int PE_(r_bin_pe_is_stripped_local_syms)(struct PE_(r_bin_pe_obj_t)* bin)
|
||||
{
|
||||
int PE_(r_bin_pe_is_stripped_local_syms)(struct PE_(r_bin_pe_obj_t)* bin) {
|
||||
return bin->nt_headers->file_header.Characteristics & PE_IMAGE_FILE_LOCAL_SYMS_STRIPPED;
|
||||
}
|
||||
|
||||
int PE_(r_bin_pe_is_stripped_debug)(struct PE_(r_bin_pe_obj_t)* bin)
|
||||
{
|
||||
int PE_(r_bin_pe_is_stripped_debug)(struct PE_(r_bin_pe_obj_t)* bin) {
|
||||
return bin->nt_headers->file_header.Characteristics & PE_IMAGE_FILE_DEBUG_STRIPPED;
|
||||
}
|
||||
|
||||
void* PE_(r_bin_pe_free)(struct PE_(r_bin_pe_obj_t)* bin)
|
||||
{
|
||||
if (!bin)
|
||||
return NULL;
|
||||
if (bin->dos_header)
|
||||
free(bin->dos_header);
|
||||
if (bin->nt_headers)
|
||||
free(bin->nt_headers);
|
||||
if (bin->section_header)
|
||||
free(bin->section_header);
|
||||
if (bin->export_directory)
|
||||
free(bin->export_directory);
|
||||
if (bin->import_directory)
|
||||
free(bin->import_directory);
|
||||
if (bin->delay_import_directory)
|
||||
free(bin->delay_import_directory);
|
||||
if (bin->b)
|
||||
r_buf_free(bin->b);
|
||||
free(bin);
|
||||
void* PE_(r_bin_pe_free)(struct PE_(r_bin_pe_obj_t)* bin) {
|
||||
if (!bin) return NULL;
|
||||
free (bin->dos_header);
|
||||
free (bin->nt_headers);
|
||||
free (bin->section_header);
|
||||
free (bin->export_directory);
|
||||
free (bin->import_directory);
|
||||
free (bin->delay_import_directory);
|
||||
r_buf_free (bin->b);
|
||||
free (bin);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct PE_(r_bin_pe_obj_t)* PE_(r_bin_pe_new)(const char* file)
|
||||
{
|
||||
struct PE_(r_bin_pe_obj_t)* PE_(r_bin_pe_new)(const char* file) {
|
||||
struct PE_(r_bin_pe_obj_t) *bin;
|
||||
ut8 *buf;
|
||||
|
||||
|
|
@ -757,8 +735,7 @@ struct PE_(r_bin_pe_obj_t)* PE_(r_bin_pe_new)(const char* file)
|
|||
return bin;
|
||||
}
|
||||
|
||||
struct PE_(r_bin_pe_obj_t)* PE_(r_bin_pe_new_buf)(struct r_buf_t *buf)
|
||||
{
|
||||
struct PE_(r_bin_pe_obj_t)* PE_(r_bin_pe_new_buf)(struct r_buf_t *buf) {
|
||||
struct PE_(r_bin_pe_obj_t) *bin;
|
||||
|
||||
if (!(bin = malloc(sizeof(struct PE_(r_bin_pe_obj_t)))))
|
||||
|
|
|
|||
|
|
@ -94,6 +94,9 @@ LIBSO=${LIB}.${EXT_SO}
|
|||
ifeq (${OSTYPE},android)
|
||||
libname=-shared -o $1.${EXT_SO} ${LDFLAGS_SONAME}$1.${EXT_SO}
|
||||
else
|
||||
ifeq (${OSTYPE},windows)
|
||||
libname=-shared -o $1.${EXT_SO}
|
||||
else
|
||||
libname=-shared -o $1.${EXT_SO} ${LDFLAGS_SONAME}$1.${EXT_SO}.${LIBVERSION}
|
||||
endif
|
||||
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@
|
|||
#include <stdarg.h>
|
||||
|
||||
static int magicdepth = 99; //XXX: do not use global var here
|
||||
#define MAGICPATH PREFIX"/lib/radare2/"R2_VERSION"/magic"
|
||||
|
||||
static int printzoomcallback(void *user, int mode, ut64 addr, ut8 *bufz, ut64 size) {
|
||||
RCore *core = (RCore *) user;
|
||||
|
|
@ -1599,8 +1598,8 @@ static void r_core_magic_at(RCore *core, const char *file, ut64 addr, int depth,
|
|||
return;
|
||||
}
|
||||
} else {
|
||||
if (r_magic_load (ck, MAGICPATH) == -1)
|
||||
eprintf ("failed r_magic_load ("MAGICPATH") %s\n", r_magic_error (ck));
|
||||
if (r_magic_load (ck, R_MAGIC_PATH) == -1)
|
||||
eprintf ("failed r_magic_load ("R_MAGIC_PATH") %s\n", r_magic_error (ck));
|
||||
}
|
||||
//if (v) r_cons_printf (" %d # pm %s @ 0x%"PFMT64x"\n", depth, file? file: "", addr);
|
||||
str = r_magic_buffer (ck, core->block, core->blocksize);
|
||||
|
|
@ -1837,7 +1836,7 @@ return 0;
|
|||
" foo@0x40 # use 'foo' magic file on address 0x40\n"
|
||||
" @0x40 # use current magic file on address 0x40\n"
|
||||
" \\n # append newline\n"
|
||||
" MAGICPATH = "MAGICPATH"\n"
|
||||
" R_MAGIC_PATH = "R_MAGIC_PATH"\n"
|
||||
);
|
||||
} else r_core_magic (core, input+1, R_TRUE);
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ static int config_asmarch_callback(void *user, void *data) {
|
|||
if (!r_syscall_setup (core->anal->syscall, node->value,
|
||||
r_config_get (core->config, "asm.os"),
|
||||
core->anal->bits))
|
||||
eprintf ("asm.arch: Cannot setup syscall os/arch for '%s'\n", node->value);
|
||||
eprintf ("asm.arch: Cannot setup syscall os/arch for '%s/%s'\n", node->value, r_config_get (core->config, "asm.os"));
|
||||
//if (!strcmp (node->value, "bf"))
|
||||
// r_config_set (core->config, "dbg.backend", "bf");
|
||||
return R_TRUE;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
#define MAGIC "/etc/magic"
|
||||
#endif
|
||||
|
||||
#define R_MAGIC_PATH PREFIX"/lib/radare2/"R2_VERSION"/magic"
|
||||
|
||||
#ifdef __EMX__
|
||||
#define PATHSEP ';'
|
||||
#else
|
||||
|
|
|
|||
23
man/rabin2.1
23
man/rabin2.1
|
|
@ -6,19 +6,26 @@
|
|||
.Nd Binary program info extractor
|
||||
.Sh SYNOPSIS
|
||||
.Nm rabin2
|
||||
.Op Fl eoicsSlrvz
|
||||
.Op Fl @eoicsSlMrvxz
|
||||
.Op Fl h
|
||||
.Op Fl c Ar fmt:C:[D]
|
||||
.Op Fl f Ar subbin
|
||||
.Op Fl L Ar library
|
||||
.Op Fl m Ar addr
|
||||
.Op file
|
||||
.Sh DESCRIPTION
|
||||
This program allows you to get information about ELF/PE/MZ and CLASS files in a simple way.
|
||||
.Bl -tag -width Fl
|
||||
.It Fl @
|
||||
Show information (symbol, section, import) of the given address
|
||||
.It Fl e
|
||||
Show entrypoints for disk and on-memory
|
||||
.It Fl M
|
||||
Show address of 'main' symbol
|
||||
.It Fl i
|
||||
Show imports (symbols imported from libraries
|
||||
.It Fl c
|
||||
Show header checksum (if exist)
|
||||
.It Fl c Ar [fmt:C[:D]]
|
||||
Create [elf,mach0,pe] for arm and x86-32/64 tiny binaries where 'C' is an hexpair list of the code bytes and ':D' is an optional concatenation to describe the bytes for the data section.
|
||||
.It Fl s
|
||||
Show exported symbols
|
||||
.It Fl o
|
||||
|
|
@ -27,8 +34,14 @@ Show other symbols (not import/export)
|
|||
Show sections
|
||||
.It Fl l
|
||||
List linked libraries to the binary
|
||||
.It Fl f Ar subbin
|
||||
Select sub-binary architecture. Useful for fat-mach0 binaries
|
||||
.It Fl x
|
||||
Extract all sub binaries from a fat binary (f.ex: fatmach0)
|
||||
.It Fl L Ar library
|
||||
Show the base address of a library loaded in memory
|
||||
.It Fl m Ar addr
|
||||
Show source line reference from a given address (like add2line)
|
||||
.It Fl r
|
||||
Show output in radare format
|
||||
.It Fl z
|
||||
|
|
@ -48,8 +61,8 @@ Show usage help message.
|
|||
.Xr rasm2(1) ,
|
||||
.Xr rax2(1) ,
|
||||
.Xr rsc2(1) ,
|
||||
.Xr rarc2(1) ,
|
||||
.Xr rarc2-tool(1) ,
|
||||
.Xr ragg2(1) ,
|
||||
.Xr rarun2(1) ,
|
||||
.Xr rasc2(1) ,
|
||||
.Sh AUTHORS
|
||||
.Pp
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.Dd Mar 11, 2010
|
||||
.Dd Oct 11, 2011
|
||||
.Dt RADARE2 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
|
@ -6,11 +6,13 @@
|
|||
.Nd Advanced commandline hexadecimal editor
|
||||
.Sh SYNOPSIS
|
||||
.Nm radare2
|
||||
.Op Fl s Ar addr
|
||||
.Op Fl b Ar bsize
|
||||
.Op Fl e Ar k=v
|
||||
.Op Fl c Ar cmd
|
||||
.Op Fl dDwnLV
|
||||
.Op Fl e Ar k=v
|
||||
.Op Fl p Ar project
|
||||
.Op Fl P Ar patch
|
||||
.Op Fl s Ar addr
|
||||
.Op Fl dDwntLV
|
||||
.Ar file
|
||||
.Sh DESCRIPTION
|
||||
radare2 is a commandline hexadecimal editor.
|
||||
|
|
@ -21,28 +23,32 @@ This manpage is not updated yet. Feel free to contribute.
|
|||
.Pp
|
||||
The options are:
|
||||
.Bl -tag -width Fl
|
||||
.It Fl s Ar addr
|
||||
Start seeking at this address.
|
||||
.It Fl b Ar bsize
|
||||
Set block size
|
||||
.It Fl e Ar k=v
|
||||
Set configuration eval variable key=value. For example -e scr.color=false
|
||||
.It Fl c Ar cmd
|
||||
Execute the given command before giving prompt
|
||||
.It Fl e Ar k=v
|
||||
Set configuration eval variable key=value. For example -e scr.color=false
|
||||
.It Fl s Ar addr
|
||||
Start seeking at this address
|
||||
.It Fl f
|
||||
Blocksize = file size.
|
||||
Blocksize = file size
|
||||
.It Fl d
|
||||
Start in debugger mode.
|
||||
.It Fl D
|
||||
Start in debugger mode
|
||||
.It Fl D Ar dbg.backend
|
||||
Enable debug mode. Set cfg.debug=true
|
||||
.It Fl w
|
||||
Open in write mode.
|
||||
Open in write mode
|
||||
.It Fl u
|
||||
Unknown file size. (Do not limit to file boundaries)
|
||||
.It Fl n
|
||||
Do not load ~/.radarerc or ./radarerc
|
||||
Do not load r_bin information and ~/.radare2rc
|
||||
.It Fl t
|
||||
Get binary information using a thread
|
||||
.It Fl l Ar plugfile
|
||||
Load given plugin file
|
||||
.It Fl L
|
||||
list supported IO plugins.
|
||||
List supported IO plugins.
|
||||
.It Fl V
|
||||
Show version information and exits.
|
||||
.It Fl h
|
||||
|
|
@ -68,8 +74,8 @@ path to the current working file
|
|||
.Xr ranal2(1) ,
|
||||
.Xr rasm2(1) ,
|
||||
.Xr rax2(1) ,
|
||||
.Xr rarc2(1) ,
|
||||
.Xr rarc2-tool(1) ,
|
||||
.Xr ragg2(1) ,
|
||||
.Xr rarun2(1) ,
|
||||
.Xr rasc2(1) ,
|
||||
.Sh AUTHORS
|
||||
.Pp
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ Show usage help message.
|
|||
.Xr rabin2(1) ,
|
||||
.Xr ranal2(1) ,
|
||||
.Xr rasm2(1) ,
|
||||
.Xr rarc2(1) ,
|
||||
.Xr rarc2-tool(1) ,
|
||||
.Xr ragg2(1) ,
|
||||
.Xr rarun2(1) ,
|
||||
.Xr rasc2(1) ,
|
||||
.Xr rax2(1) ,
|
||||
.Sh AUTHORS
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
.Dd Jun 18, 2010
|
||||
.Dd Oct 18, 2011
|
||||
.Dt RAFIND2 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
|
|
@ -46,8 +46,8 @@ Specify the target adddress
|
|||
.Xr ranal2(1) ,
|
||||
.Xr radiff2(1) ,
|
||||
.Xr rasm2(1) ,
|
||||
.Xr rarc2(1) ,
|
||||
.Xr rarc2-tool(1) ,
|
||||
.Xr ragg2(1) ,
|
||||
.Xr rarun2(1) ,
|
||||
.Xr rasc2(1) ,
|
||||
.Xr rax2(1) ,
|
||||
.Sh AUTHORS
|
||||
|
|
|
|||
77
man/ragg2.1
Normal file
77
man/ragg2.1
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
.Dd Oct 11, 2011
|
||||
.Dt RAGG2 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm ragg2
|
||||
.Nd radare2 utility to run programs in exotic environments
|
||||
.Sh SYNOPSIS
|
||||
.Nm ragg2
|
||||
.Op Fl a Ar arch
|
||||
.Op Fl b Ar bits
|
||||
.Op Fl k Ar kernel
|
||||
.Op Fl f Ar format
|
||||
.Op Fl o Ar file
|
||||
.Op Fl FOIsxXh
|
||||
.Sh DESCRIPTION
|
||||
ragg2 is a frontend for r_egg, it allows to compile programs into tiny binaries for x86-32/64 and arm.
|
||||
.Pp
|
||||
This tool is experimental and it is a rewrite of the old rarc2 and rarc2-tool programs as a library and integrated with r_asm and r_bin.
|
||||
.Pp
|
||||
Programs generated by r_egg are relocatable and can be injected in a running process or on-disk binary file.
|
||||
.Sh DIRECTIVES
|
||||
.Pp
|
||||
The rr2 (ragg2) configuration file accepts the following directives, described as key=value entries and comments defined as lines starting with '#'.
|
||||
.Bl -tag -width Fl
|
||||
.It Fl a Ar arch
|
||||
set architecture x86, arm
|
||||
.It Fl b Ar bits
|
||||
32 or 64
|
||||
.It Fl k Ar kernel
|
||||
windows, linux or osx
|
||||
.It Fl f Ar format
|
||||
select binary format (pe, elf, mach0)
|
||||
.It Fl o Ar file
|
||||
output file to write result of compilation
|
||||
.It Fl F
|
||||
autodetect native file format (osx=mach0, linux=elf, ..)
|
||||
.It Fl O
|
||||
use default output file (filename without extension or a.out)
|
||||
.It Fl I
|
||||
add include path
|
||||
.It Fl s
|
||||
show assembler code
|
||||
.It Fl x
|
||||
show hexpairs (default)
|
||||
.It Fl X
|
||||
execute (just-in-time)
|
||||
.El
|
||||
.Sh EXAMPLE
|
||||
.Pp
|
||||
$ cat hi.r
|
||||
/* hello world in r_egg */
|
||||
write@syscall(4);
|
||||
exit@syscall(1);
|
||||
|
||||
main@global(128) {
|
||||
.var0 = "hi!\n";
|
||||
write(1,.var0, 4);
|
||||
exit(0);
|
||||
}
|
||||
$ ragg2 -O -F hi.r
|
||||
$ ./hi
|
||||
hi!
|
||||
.Pp
|
||||
.Sh SEE ALSO
|
||||
.Pp
|
||||
.Xr radare2(1) ,
|
||||
.Xr rahash2(1) ,
|
||||
.Xr rafind2(1) ,
|
||||
.Xr rabin2(1) ,
|
||||
.Xr rafind2(1) ,
|
||||
.Xr ranal2(1) ,
|
||||
.Xr radiff2(1) ,
|
||||
.Xr rasc2(1) ,
|
||||
.Xr rasm2(1) ,
|
||||
.Sh AUTHORS
|
||||
.Pp
|
||||
pancake <pancake@nopcode.org>
|
||||
|
|
@ -43,8 +43,8 @@ Show usage help message.
|
|||
.Xr ranal2(1) ,
|
||||
.Xr radiff2(1) ,
|
||||
.Xr rasm2(1) ,
|
||||
.Xr rarc2(1) ,
|
||||
.Xr rarc2-tool(1) ,
|
||||
.Xr ragg2(1) ,
|
||||
.Xr rarun2(1) ,
|
||||
.Xr rasc2(1) ,
|
||||
.Xr rax2(1) ,
|
||||
.Sh AUTHORS
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ Show usage help message
|
|||
.Xr rahash2(1) ,
|
||||
.Xr rabin2(1) ,
|
||||
.Xr radiff2(1) ,
|
||||
.Xr rarc2(1) ,
|
||||
.Xr rarc2-tool(1) ,
|
||||
.Xr ragg2(1) ,
|
||||
.Xr rarun2(1) ,
|
||||
.Xr rasm2(1) ,
|
||||
.Xr rasc2(1) ,
|
||||
.Xr rax2(1) ,
|
||||
|
|
|
|||
71
man/rarun2.1
Normal file
71
man/rarun2.1
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
.Dd Oct 11, 2011
|
||||
.Dt RARUN2 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm rarun2
|
||||
.Nd radare2 utility to run programs in exotic environments
|
||||
.Sh SYNOPSIS
|
||||
.Nm rarun2
|
||||
.Op [script.rr2]
|
||||
.Sh DESCRIPTION
|
||||
This program is used as a launcher for running programs with different environment, arguments, permissions, directories and overriden default filedescriptors.
|
||||
.Pp
|
||||
The program just accepts a single argument which is the filename of the configuration file to run the program.
|
||||
.Pp
|
||||
It is useful when you have to run a program using long arguments or pass long data to stdin or things like that usually required for exploiting crackmes :)
|
||||
.Sh DIRECTIVES
|
||||
.Pp
|
||||
The rr2 (rarun2) configuration file accepts the following directives, described as key=value entries and comments defined as lines starting with '#'.
|
||||
.Bl -tag -width Fl
|
||||
.It Ar program
|
||||
path to program to be executed
|
||||
.It Ar stdout
|
||||
select file to replace stdout file descriptor
|
||||
.It Ar stdin
|
||||
select file to read data from stdin
|
||||
.It Ar input
|
||||
set string to be passed to the program via stdin
|
||||
.It Ar chdir
|
||||
change directory before executing the program
|
||||
.It Ar chroot
|
||||
run the program in chroot. requires some previous setup
|
||||
.It Ar preload
|
||||
preload a library (not supported on Windows, only linux,osx,bsd)
|
||||
.It Ar setuid
|
||||
set process uid
|
||||
.It Ar seteuid
|
||||
set effective process uid
|
||||
.It Ar setgid
|
||||
set process group id
|
||||
.It Ar setegid
|
||||
set effective process group id
|
||||
.It Ar setenv
|
||||
set value for given environment variable
|
||||
.It Ar arg[0-3]
|
||||
set value for argument N passed to the program
|
||||
.El
|
||||
.Sh EXAMPLE
|
||||
.Pp
|
||||
$ cat foo.rr2
|
||||
#!/usr/bin/rarun2
|
||||
program=./pp400
|
||||
arg0=10
|
||||
stdin=foo.txt
|
||||
chdir=/tmp
|
||||
#chroot=.
|
||||
./foo.rr2
|
||||
.Pp
|
||||
.Sh SEE ALSO
|
||||
.Pp
|
||||
.Xr radare2(1) ,
|
||||
.Xr rahash2(1) ,
|
||||
.Xr rafind2(1) ,
|
||||
.Xr rabin2(1) ,
|
||||
.Xr ranal2(1) ,
|
||||
.Xr radiff2(1) ,
|
||||
.Xr ragg2(1) ,
|
||||
.Xr rasc2(1) ,
|
||||
.Xr rasm2(1) ,
|
||||
.Sh AUTHORS
|
||||
.Pp
|
||||
pancake <pancake@nopcode.org>
|
||||
|
|
@ -62,8 +62,8 @@ Some shellcodes can be modified using the environment variables CMD, HOST and PO
|
|||
.Xr rabin2(1) ,
|
||||
.Xr rasm2(1) ,
|
||||
.Xr rax2(1) ,
|
||||
.Xr rarc2(1) ,
|
||||
.Xr rarc2-tool(1) ,
|
||||
.Xr ragg2(1) ,
|
||||
.Xr rarun2(1) ,
|
||||
.Sh AUTHORS
|
||||
.Pp
|
||||
pancake <pancake@nopcode.org>,
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ Show usage help message.
|
|||
.Xr rabin2(1) ,
|
||||
.Xr ranal2(1) ,
|
||||
.Xr radiff2(1) ,
|
||||
.Xr rarc2(1) ,
|
||||
.Xr rarc2-tool(1) ,
|
||||
.Xr ragg2(1) ,
|
||||
.Xr rarun2(1) ,
|
||||
.Xr rasc2(1) ,
|
||||
.Xr rax2(1) ,
|
||||
.Sh AUTHORS
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ Available variable types are:
|
|||
.Xr rabin2(1) ,
|
||||
.Xr ranal2(1) ,
|
||||
.Xr radiff2(1) ,
|
||||
.Xr rarc2(1) ,
|
||||
.Xr rarc2-tool(1) ,
|
||||
.Xr ragg2(1) ,
|
||||
.Xr rarun2(1) ,
|
||||
.Xr rasc2(1) ,
|
||||
.Xr rasm2(1) ,
|
||||
.Sh AUTHORS
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ Show usage help message.
|
|||
.Xr ranal2(1) ,
|
||||
.Xr rasm2(1) ,
|
||||
.Xr rax2(1) ,
|
||||
.Xr rarc2(1) ,
|
||||
.Xr rarc2-tool(1) ,
|
||||
.Xr ragg2(1) ,
|
||||
.Xr rarun2(1) ,
|
||||
.Xr rasc2(1) ,
|
||||
.Sh AUTHORS
|
||||
.Pp
|
||||
|
|
|
|||
|
|
@ -2,7 +2,12 @@ include ../config.mk
|
|||
SOEXT=gir
|
||||
include ../libs.mk
|
||||
|
||||
all: ${LIBS}
|
||||
all:
|
||||
# XXX sh mkgir.sh RUtil r_util
|
||||
sh mkgir.sh RAsm r_asm
|
||||
#sh mkgir.sh RCore r_core
|
||||
|
||||
all2: ${LIBS}
|
||||
|
||||
${LIBS}:
|
||||
ifeq ($(HAVE_VALABIND)$(HAVE_GIRCOMPILER),11)
|
||||
|
|
@ -24,4 +29,4 @@ install:
|
|||
gjs test.js
|
||||
|
||||
clean:
|
||||
@rm -f *.gir *.typelib
|
||||
@rm -f *.gir *.typelib *.vapi *.vala *.tmp *.c *.h
|
||||
|
|
|
|||
27
r2-bindings/gir/mkgir.sh
Normal file
27
r2-bindings/gir/mkgir.sh
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/sh
|
||||
if [ -z "$2" ]; then
|
||||
echo "Usage: sh mkgir.sh RAsm r_asm"
|
||||
exit 1
|
||||
fi
|
||||
N=$1
|
||||
A=$2
|
||||
|
||||
deps() {
|
||||
for a in `cat ../vapi/$1.deps`; do
|
||||
printf -- "--pkg $a "
|
||||
done
|
||||
}
|
||||
|
||||
cat ../vapi/$A.vapi | perl vapi2vala.pl > $A.vala
|
||||
|
||||
HEADER="--use-header -H $A.h"
|
||||
echo "valac $(deps $A) --library=$A-1.0 --gir=$A-1.0.gir $A.vala"
|
||||
valac ${HEADER} -C $(deps $A) --library=$N-1.0 --gir=$N-1.0.gir $A.vala
|
||||
|
||||
mv $N-1.0.gir $N-1.0.tmp
|
||||
cat $N-1.0.tmp | grep -v annotation > $N-1.0.gir
|
||||
echo "g-ir-compiler -m $N -l lib$A.dylib $N-1.0.gir > $N-1.0.typelib"
|
||||
g-ir-compiler -m $N -l lib$A.dylib $N-1.0.gir > $N-1.0.typelib
|
||||
|
||||
echo sudo cp r_asm-1.0.typelib /opt/local/lib/girepository-1.0/
|
||||
#sudo cp $N-1.0.typelib /opt/local/lib/girepository-1.0/
|
||||
|
|
@ -1,6 +1,21 @@
|
|||
/* This is not working */
|
||||
const pathtogir = "/Users/pancake/prg/node-gir/";
|
||||
|
||||
var gir = require (pathtogir+"/gir");
|
||||
gir.init();
|
||||
|
||||
var r2 = gir.load("RAsm", "1.0");
|
||||
var r2core = gir.load("RCore", "1.0");
|
||||
console.log (r2);
|
||||
console.log (r2core);
|
||||
|
||||
var IntelSyntax = r2.RAsmSyntax.intel;
|
||||
|
||||
console.log ("INTEL_SYNTAX = "+IntelSyntax);
|
||||
|
||||
/* This is not working +/
|
||||
const r = imports.gi.r_asm.Radare;
|
||||
var b = new r.RAsm ();
|
||||
for (var a in r) {
|
||||
print (a);
|
||||
}
|
||||
*/
|
||||
|
|
|
|||
47
r2-bindings/gir/vapi2vala.pl
Normal file
47
r2-bindings/gir/vapi2vala.pl
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/perl
|
||||
# vapi2vala -- pancake
|
||||
my $DEBUG = 0;
|
||||
while (<STDIN>) {
|
||||
if (/\);/) {
|
||||
local $ol=$l=$_;
|
||||
$l=~s/public//;
|
||||
$l=~s/private//;
|
||||
$l=~s/unowned//;
|
||||
if (/delegate/) {
|
||||
print;
|
||||
next;
|
||||
}
|
||||
$l=~s/delegate//;
|
||||
$l=~s/static//;
|
||||
$l=~s/^\s*//g;
|
||||
$l=~s/^\t*//g;
|
||||
$l=~s/\s\(/\(/g;
|
||||
print STDERR "LINE: ($l)\n" if ($DEBUG);
|
||||
@o = split (/ /, $l);
|
||||
$t=$o[0];
|
||||
$n=$o[1];
|
||||
print STDERR "---> $t : $n\n" if ($DEBUG);
|
||||
local $v = "null";
|
||||
if ($t=~/\(/ || $t eq "void") {
|
||||
$ol=~s/\);/\) {}/;
|
||||
} else {
|
||||
if ($t eq "string") {
|
||||
$v="\"\"";
|
||||
} elsif ($t eq "int") {
|
||||
$t = "";
|
||||
$v="0";
|
||||
} elsif ($t eq "bool") {
|
||||
$v="false";
|
||||
}
|
||||
if ($t eq "") {
|
||||
$ol=~s/\);/\) {return $v;}/;
|
||||
} else {
|
||||
$ol=~s/\);/\) {return $v;}/;
|
||||
#//$ol=~s/\);/\) {return ($t)$v;}/;
|
||||
}
|
||||
}
|
||||
print $ol;
|
||||
} else {
|
||||
print;
|
||||
}
|
||||
}
|
||||
|
|
@ -22,5 +22,6 @@ TARGETS="
|
|||
mingw32
|
||||
android-arm
|
||||
android-x86
|
||||
python-dist
|
||||
"
|
||||
# mingw64 maemo
|
||||
|
|
|
|||
Loading…
Reference in a new issue