* Fix some t-*.sh scripts (rollback)

* Initial working version of shellcodes inside r_egg
  $ ragg2 -i x86.osx.binsh -b 64 -k osx -f mach064 -o a.out
  ragg2 -L : list all plugins
  ragg2 -i <shellcode-plugin> : select shellcode
  ragg2 -r : show raw bytes
  ragg2 -x : execute -- fails :(
* Use r_lib in r_egg
  - User defined shellcode plugins can now be loaded on runtime
* Fix append_bytes in r_egg api
* Implement r_egg option_{get|set}
* Use working shellcode for x86.osx.binsh example (64bit)
* Update pkgconfig templates
* Add -D flag to rasm2 (show hex and asm)

--HG--
rename : libr/egg/p/x86_osx_binsh.c => libr/egg/p/egg_x86_osx_binsh.c
This commit is contained in:
pancake 2011-11-13 04:08:08 +01:00
parent 99919408e3
commit e0fc376dab
20 changed files with 286 additions and 111 deletions

View file

@ -13,13 +13,24 @@ static int usage () {
" -o [file] output file\n"
" -O use default output file (filename without extension or a.out)\n"
" -I add include path\n"
" -L list all plugins (shellcodes and encoders)\n"
" -i [plugin] include shellcode plugin, uses options\n"
" -c [k=v] set configuration options\n"
" -s show assembler\n"
" -x show hexpairs (enabled by default)\n"
" -X execute\n"
" -r show raw bytes instead of hexpairs\n"
" -x execute\n"
" -h show this help\n");
return 1;
}
static void list (REgg *egg) {
RListIter *iter;
REggPlugin *p;
r_list_foreach (egg->plugins, iter, p) {
printf ("%10s : sz=%d : %s\n", p->name, p->length, p->desc);
}
}
static int create (const char *format, const char *arch, int bits, const ut8 *code, int codelen) {
RBin *bin = r_bin_new ();
RBuffer *b;
@ -50,12 +61,14 @@ int openfile (const char *f, int x) {
#define ISEXEC (*format!='r')
int main(int argc, char **argv) {
const char *file = NULL;
const char *arch = "x86";
const char *os = R_EGG_OS_NAME;
char *format = "raw";
int show_execute = 0;
int show_hex = 1;
int show_asm = 0;
int show_raw = 0;
int bits = 32;
const char *ofile = NULL;
int ofileauto = 0;
@ -63,7 +76,7 @@ int main(int argc, char **argv) {
int c, i;
REgg *egg = r_egg_new ();
while ((c = getopt (argc, argv, "ha:b:f:o:sxXk:FOI:")) != -1) {
while ((c = getopt (argc, argv, "ha:b:f:o:sxrk:FOI:Li:c:")) != -1) {
switch (c) {
case 'a':
arch = optarg;
@ -84,6 +97,24 @@ int main(int argc, char **argv) {
case 'I':
r_egg_lang_include_path (egg, optarg);
break;
case 'i':
if (!r_egg_shellcode (egg, optarg)) {
eprintf ("Unknown shellcode '%s'\n", optarg);
return 1;
}
break;
case 'c':
{
char *p = strchr (optarg, '=');
if (p) {
*p=0;
r_egg_option_set (egg, optarg, p+1);
} else {
eprintf ("Missing '='\nExample: ragg2 -c cmd=/bin/ls\n");
return 1;
}
}
break;
case 'F':
#if __APPLE__
format = "mach0";
@ -105,32 +136,37 @@ int main(int argc, char **argv) {
case 'k':
os = optarg;
break;
case 'x':
show_hex = 1;
case 'r':
show_raw = 1;
break;
case 'X':
case 'x':
// execute
show_execute = 1;
break;
case 'L':
list (egg);
return 0;
case 'h':
return usage ();
}
}
if (optind == argc)
return usage ();
if (optind == argc) {
// eprintf ("No filename given\n");
//return usage ();
} else file = argv[optind];
/* create output file if needed */
if (ofileauto) {
int fd;
char *o, *p = strdup (argv[optind]);
if ( (o = strchr (p, '.')) ) {
*o = 0;
fd = openfile (p, ISEXEC);
} else {
fd = openfile ("a.out", ISEXEC);
}
free (p);
if (file) {
char *o, *p = strdup (file);
if ( (o = strchr (p, '.')) ) {
*o = 0;
fd = openfile (p, ISEXEC);
} else fd = openfile ("a.out", ISEXEC);
free (p);
} else fd = openfile ("a.out", ISEXEC);
if (fd == -1) {
eprintf ("cannot open file '%s'\n", optarg);
goto fail;
@ -138,43 +174,48 @@ int main(int argc, char **argv) {
}
if (ofile) {
if (openfile (ofile, ISEXEC) == -1) {
eprintf ("cannot open file '%s'\n", optarg);
eprintf ("cannot open file '%s'\n", ofile);
goto fail;
}
}
r_egg_setup (egg, arch, bits, 0, os);
if (!strcmp (argv[optind], "-")) {
char buf[1024];
for (;;) {
fgets (buf, sizeof (buf)-1, stdin);
if (feof (stdin)) break;
r_egg_load (egg, buf, 0);
}
} else {
if (!r_egg_include (egg, argv[optind], 0)) {
eprintf ("Cannot open '%s'\n", argv[optind]);
goto fail;
if (file) {
if (!strcmp (file, "-")) {
char buf[1024];
for (;;) {
fgets (buf, sizeof (buf)-1, stdin);
if (feof (stdin)) break;
r_egg_load (egg, buf, 0);
}
} else {
if (!r_egg_include (egg, file, 0)) {
eprintf ("Cannot open '%s'\n", file);
goto fail;
}
}
}
r_egg_compile (egg);
//printf ("src (%s)\n", r_egg_get_source (egg));
if (show_asm)
printf ("%s\n", r_egg_get_assembly (egg));
if (show_hex || show_execute) {
if (show_raw || show_hex || show_execute) {
if (!r_egg_assemble (egg)) {
eprintf ("r_egg_assemble: invalid assembly\n");
goto fail;
}
b = r_egg_get_bin (egg);
if (b == NULL) {
if (!(b = r_egg_get_bin (egg))) {
eprintf ("r_egg_get_bin: invalid egg :(\n");
goto fail;
}
if (show_raw) {
write (1, b->buf, b->length);
} else
if (show_execute) {
r_egg_run (egg);
return 0;
} else {
if (show_execute) {
// TODO
eprintf ("TODO: execute\n");
}
switch (*format) {
case 'r':
if (show_hex) {

View file

@ -28,6 +28,7 @@ static void r_asm_list(RAsm *a) {
static int rasm_show_help() {
printf ("rasm2 [-e] [-o offset] [-a arch] [-s syntax] -d \"opcode\"|\"hexpairs\"|- [-f file ..]\n"
" -d Disassemble from hexpair bytes\n"
" -D Disassemble showing hexpair and opcode\n"
" -f Read data from file\n"
" -F [in:out] Specify input and/or output filters (att2intel, x86.pseudo, ...)\n"
" -o [offset] Set start address for code (0x%08"PFMT64x")\n"
@ -45,7 +46,7 @@ static int rasm_show_help() {
return 0;
}
static int rasm_disasm(char *buf, ut64 offset, ut64 len, int ascii, int bin) {
static int rasm_disasm(char *buf, ut64 offset, ut64 len, int ascii, int bin, int hex) {
struct r_asm_code_t *acode;
ut8 *data;
char *ptr = buf;
@ -70,13 +71,24 @@ static int rasm_disasm(char *buf, ut64 offset, ut64 len, int ascii, int bin) {
if (!len || clen <= len)
len = clen;
r_asm_set_pc (a, offset);
if (!(acode = r_asm_mdisassemble (a, data, len)))
return 0;
printf ("%s", acode->buf_asm);
ret = acode->len;
r_asm_code_free (acode);
if (hex) {
ret = 0;
RAsmOp op;
r_asm_set_pc (a, offset);
while (r_asm_disassemble (a, &op, data+ret, len-ret) != -1) {
printf ("0x%08"PFMT64x" %d %12s %s\n",
a->pc, op.inst_len, op.buf_hex, op.buf_asm);
ret += op.inst_len;
r_asm_set_pc (a, offset+ret);
}
} else {
r_asm_set_pc (a, offset);
if (!(acode = r_asm_mdisassemble (a, data, len)))
return 0;
printf ("%s", acode->buf_asm);
ret = acode->len;
r_asm_code_free (acode);
}
return ret;
}
@ -144,8 +156,11 @@ int main(int argc, char *argv[]) {
return rasm_show_help ();
r_asm_use (a, R_SYS_ARCH);
while ((c = getopt (argc, argv, "Ceva:b:s:do:Bl:hLf:F:")) != -1) {
while ((c = getopt (argc, argv, "DCeva:b:s:do:Bl:hLf:F:")) != -1) {
switch (c) {
case 'D':
dis = 2;
break;
case 'f':
file = optarg;
break;
@ -229,13 +244,14 @@ int main(int argc, char *argv[]) {
eprintf ("WARNING: Cannot slurp more from stdin\n");
if (ret>=0)
buf[ret] = '\0';
if (dis) ret = rasm_disasm (buf, offset, len, ascii, bin);
if (dis)
ret = rasm_disasm (buf, offset, len, ascii, bin, dis-1);
else ret = rasm_asm (buf, offset, len, bin);
} else {
content = r_file_slurp (file, &length);
if (content) {
content[length] = '\0';
if (dis) ret = rasm_disasm (content, offset, len, ascii, bin);
if (dis) ret = rasm_disasm (content, offset, len, ascii, bin, dis-1);
else ret = rasm_asm (content, offset, len, bin);
free (content);
} else eprintf ("Cannot open file %s\n", file);
@ -248,7 +264,7 @@ int main(int argc, char *argv[]) {
if ((!bin || !dis) && feof (stdin))
break;
if (!bin || !dis) buf[strlen (buf)-1]='\0';
if (dis) ret = rasm_disasm (buf, offset, len, ascii, bin);
if (dis) ret = rasm_disasm (buf, offset, len, ascii, bin, dis-1);
else ret = rasm_asm (buf, offset, len, bin);
idx += ret;
offset += ret;
@ -261,7 +277,7 @@ int main(int argc, char *argv[]) {
}
return idx;
}
if (dis) ret = rasm_disasm (argv[optind], offset, len, ascii, bin);
if (dis) ret = rasm_disasm (argv[optind], offset, len, ascii, bin, dis-1);
else ret = rasm_asm (argv[optind], offset, len, bin);
if (!ret) eprintf ("invalid\n");
return ret;

View file

@ -26,6 +26,7 @@
slower, but would mess up some macros a bit. xoxorich. */
#include <stdio.h>
#include <string.h>
#include "sysdep.h"
#include "opcode/sparc.h"

View file

@ -322,7 +322,7 @@ R_API RAsmCode* r_asm_mdisassemble(RAsm *a, ut8 *buf, ut64 len) {
return r_asm_code_free (acode);
for (idx = ret = slen = 0, acode->buf_asm[0] = '\0'; idx < len; idx+=ret) {
r_asm_set_pc(a, a->pc + ret);
r_asm_set_pc (a, a->pc + ret);
ret = r_asm_disassemble (a, &op, buf+idx, len-idx);
if (ret<1) {
eprintf ("disassemble error at offset %"PFMT64d"\n", idx);

View file

@ -16,7 +16,6 @@ ARCHS+=msil.mk sh.mk
include $(ARCHS)
all: ${ALL_TARGETS}
@true
a:
${CC} -DTEST asm_x86_nasm.c `pkg-config --libs --cflags r_asm` -o a${EXT_EXE}

View file

@ -2,6 +2,7 @@
#include "r_core.h"
// XXX: spageti!
/* io callback */
static int __lib_io_cb(struct r_lib_plugin_t *pl, void *user, void *data) {
struct r_io_plugin_t *hand = (struct r_io_plugin_t *)data;
@ -102,6 +103,17 @@ static int __lib_bin_cb(struct r_lib_plugin_t *pl, void *user, void *data) {
static int __lib_bin_dt(struct r_lib_plugin_t *pl, void *p, void *u) { return R_TRUE; }
/* bin callback */
static int __lib_egg_cb(struct r_lib_plugin_t *pl, void *user, void *data) {
REggPlugin *hand = (REggPlugin*)data;
struct r_core_t *core = (struct r_core_t *)user;
//printf(" * Added (dis)assembly handler\n");
r_egg_add (core->bin, hand);
return R_TRUE;
}
static int __lib_bin_dt(struct r_lib_plugin_t *pl, void *p, void *u) { return R_TRUE; }
R_API int r_core_loadlibs_init(struct r_core_t *core) {
/* initialize handlers */
r_lib_add_handler (core->lib, R_LIB_TYPE_IO, "io plugins",
@ -122,6 +134,8 @@ R_API int r_core_loadlibs_init(struct r_core_t *core) {
&__lib_parse_cb, &__lib_parse_dt, core);
r_lib_add_handler (core->lib, R_LIB_TYPE_BIN, "bin plugins",
&__lib_bin_cb, &__lib_bin_dt, core);
r_lib_add_handler (core->lib, R_LIB_TYPE_EGG, "egg plugins",
&__lib_egg_cb, &__lib_egg_dt, core);
return R_TRUE;
}

View file

@ -1,11 +1,20 @@
NAME=r_egg
DEPS=r_util r_asm r_syscall
DEPS=r_util r_asm r_syscall r_db
include ../config.mk
#OBJ+=p/x86_osx_binsh.o
OBJ=egg.o lang.o
OBJ+=emit_x86.o
OBJ+=emit_arm.o
OBJ+=emit_x64.o
OBJ+=emit_trace.o
include ${STATIC_EGG_PLUGINS}
OBJ+=$(subst ..,p/..,$(subst egg_,p/egg_,$(STATIC_OBJ)))
OBJ+=p/x86_osx_binsh.o
foo: ${LIBSO} ${LIBAR}
#plugins plugins:
# Do not build plugins. all are static @cd p && ${MAKE} all
include ../rules.mk

View file

@ -1,12 +1,18 @@
/* radare - LGPL - Copyright 2011 pancake<@nopcode.org> */
#include <r_egg.h>
#include "../config.h"
// TODO: must be plugins
extern REggEmit emit_x86;
extern REggEmit emit_x64;
extern REggEmit emit_arm;
extern REggEmit emit_trace;
static REggPlugin *egg_static_plugins[] =
{ R_EGG_STATIC_PLUGINS };
R_API REgg *r_egg_new () {
int i;
REgg *egg = R_NEW0 (REgg);
egg->src = r_buf_new ();
egg->buf = r_buf_new ();
@ -16,9 +22,31 @@ R_API REgg *r_egg_new () {
egg->rasm = r_asm_new ();
egg->bits = 0;
egg->endian = 0;
egg->pair = r_pair_new ();
egg->plugins = r_list_new ();
for (i=0; egg_static_plugins[i]; i++) {
REggPlugin *static_plugin = R_NEW (REggPlugin);
memcpy (static_plugin, egg_static_plugins[i], sizeof (REggPlugin));
r_egg_add (egg, static_plugin);
}
return egg;
}
R_API int r_egg_add (REgg *a, REggPlugin *foo) {
RListIter *iter;
RAsmPlugin *h;
// TODO: cache foo->name length and use memcmp instead of strcmp
if (!foo->name)
return R_FALSE;
//if (foo->init)
// foo->init (a->user);
r_list_foreach (a->plugins, iter, h)
if (!strcmp (h->name, foo->name))
return R_FALSE;
r_list_append (a->plugins, foo);
return R_TRUE;
}
R_API char *r_egg_to_string (REgg *egg) {
return strdup ((const char *)egg->buf->buf);
}
@ -74,11 +102,6 @@ R_API int r_egg_setup(REgg *egg, const char *arch, int bits, int endian, const c
egg->bits = bits;
egg->endian = endian;
}
if (egg->emit) {
if (egg->emit->init)
egg->emit->init (egg);
return 1;
}
return 0;
}
@ -141,7 +164,9 @@ R_API int r_egg_raw(REgg *egg, const ut8 *b, int len) {
out = malloc (outlen);
if (!out) return R_FALSE;
r_hex_bin2str (b, len, out);
r_buf_append_bytes (egg->buf, (const ut8*)".hex ", 5);
r_buf_append_bytes (egg->buf, (const ut8*)out, outlen);
r_buf_append_bytes (egg->buf, (const ut8*)"\n", 1);
return R_TRUE;
}
@ -172,8 +197,9 @@ R_API int r_egg_assemble(REgg *egg) {
code = r_buf_to_string (egg->buf);
asmcode = r_asm_massemble (egg->rasm, code);
if (asmcode && asmcode->len > 0) {
r_buf_append_bytes (egg->bin, asmcode->buf, asmcode->len);
if (asmcode) {
if (asmcode->len > 0)
r_buf_append_bytes (egg->bin, asmcode->buf, asmcode->len);
// LEAK r_asm_code_free (asmcode);
} else eprintf ("fail assembling\n");
free (code);
@ -204,6 +230,12 @@ R_API int r_egg_compile(REgg *egg) {
const char *b = (const char *)egg->src->buf;
if (!b || !egg->emit)
return R_FALSE;
// only emit begin if code is found
if (*b)
if (egg->emit) {
if (egg->emit->init)
egg->emit->init (egg);
}
for (; *b; b++) {
r_egg_lang_parsechar (egg, *b);
// XXX: some parse fail errors are false positives :(
@ -233,16 +265,26 @@ R_API void r_egg_append(REgg *egg, const char *src) {
/* JIT : TODO: accept arguments here */
R_API int r_egg_run(REgg *egg) {
int ret, (*ptr)() = malloc (egg->bin->length);
memcpy (ptr, egg->bin->buf, egg->bin->length);
r_mem_protect (ptr, egg->bin->length, "rx");
ret = ptr ();
int ret, (*cb)();
ut8 *ptr = malloc (4096);
ut8* shellcode = egg->bin->buf;
if (!ptr) return R_FALSE;
memcpy (ptr, shellcode, 4096);
r_mem_protect (ptr, 4096, "rx");
r_mem_protect (ptr, 4096, "rwx"); // try, ignore if fail
cb = (void*)ptr;
ret = cb ();
free (ptr);
return ret;
}
R_API void r_egg_option(REgg *egg, const char *k, const char *v) {
// set option for shellcode
#define R_EGG_FILL_TYPE_TRAP
#define R_EGG_FILL_TYPE_NOP
#define R_EGG_FILL_TYPE_CHAR
#define R_EGG_FILL_TYPE_SEQ
#define R_EGG_FILL_TYPE_SEQ
R_API void r_egg_fill(REgg *egg, int pos, int type, int argc, int length) {
}
// functions that manipulate the compile() buffer
@ -258,16 +300,24 @@ R_API void r_egg_option(REgg *egg, const char *k, const char *v) {
#endif
R_API void r_egg_option_set(REgg *egg, const char *key, const char *val) {
// TODO: use hashtable here k=v
// TOOD: use rconfig here?
return r_pair_set (egg->pair, key, val);
}
R_API const char *r_egg_option_get(REgg *egg, const char *key) {
// TODO: use hashtable here k=v
return NULL;
return r_pair_get (egg->pair, key);
}
R_API void r_egg_shellcode(REgg *egg, const char *name) {
// TODO embed in r_egg
R_API int r_egg_shellcode(REgg *egg, const char *name) {
REggPlugin *p;
RListIter *iter;
RBuffer *b;
r_list_foreach (egg->plugins, iter, p) {
if (!strcmp (name, p->name)) {
b = p->build (egg);
r_egg_raw (egg, b->buf, b->length);
r_buf_free (b);
return R_TRUE;
}
}
return R_FALSE;
}

View file

@ -0,0 +1,53 @@
/* radare - LGPL - Copyright 2011 pancake<@nopcode.org> */
#include <r_egg.h>
#if 0
static ut8 x86_osx_binsh[] =
"\x31\xdb\x6a\x3b\x58\x53\xeb\x18\x5f"
"\x57\x53\x54\x54\x57\x6a\xff\x88\x5f"
"\x07\x89\x5f\xf5\x88\x5f\xfa\x9a\xff"
"\xff\xff\xff\x2b\xff\xe8\xe3\xff\xff"
"\xff" // /bin/shX";
"\x2f\x73\x68\x68\x2f\x62\x69\x6e\x58";
char x64_osx_suidsh[] =
#endif
// XXX: must obfuscate
static ut8 x86_osx_binsh[] =
"\x41\xb0\x02\x49\xc1\xe0\x18\x49\x83\xc8\x17\x31\xff\x4c\x89\xc0"
"\x0f\x05\xeb\x12\x5f\x49\x83\xc0\x24\x4c\x89\xc0\x48\x31\xd2\x52"
"\x57\x48\x89\xe6\x0f\x05\xe8\xe9\xff\xff\xff\x2f\x62\x69\x6e\x2f"
"\x2f\x73\x68";
#if 0
41b00249c1e0184983c81731ff4c89c0
0f05eb125f4983c0244c89c04831d252
574889e60f05e8e9ffffff2f62696e2f
2f7368
#endif
static RBuffer *build (REgg *egg) {
RBuffer *buf = r_buf_new ();
const char *shell = r_egg_option_get (egg, "cmd");
if (shell) {
eprintf ("TODO: implement support to change the shell\n");
r_buf_free (buf);
return NULL;
} else {
r_buf_set_bytes (buf, x86_osx_binsh, strlen ((const char *)x86_osx_binsh));
}
return buf;
}
REggPlugin r_egg_plugin_x86_osx_binsh = {
.name = "x86.osx.binsh",
.desc = "execute cmd=/bin/sh",
.bytes = x86_osx_binsh,
.length = sizeof (x86_osx_binsh),
.build = build
};
#ifndef CORELIB
struct r_lib_struct_t radare_plugin = {
.type = R_LIB_TYPE_EGG,
.data = &r_egg_plugin_x86_osx_binsh
};
#endif

View file

@ -1,31 +0,0 @@
/* radare - LGPL - Copyright 2011 pancake<@nopcode.org> */
#include <r_egg.h>
static ut8 x86_osx_binsh[] =
"\x31\xdb\x6a\x3b\x58\x53\xeb\x18\x5f"
"\x57\x53\x54\x54\x57\x6a\xff\x88\x5f"
"\x07\x89\x5f\xf5\x88\x5f\xfa\x9a\xff"
"\xff\xff\xff\x2b\xff\xe8\xe3\xff\xff"
"\xff" // /bin/shX";
"\x2f\x73\x68\x68\x2f\x62\x69\x6e\x58";
static RBuffer *build (REgg *egg) {
RBuffer *buf = r_buf_new ();
const char *shell = r_egg_option_get (egg, "shell");
if (shell) {
eprintf ("TODO: implement support to change the shell\n");
r_buf_free (buf);
return NULL;
} else {
r_buf_set_bytes (buf, x86_osx_binsh, strlen (x86_osx_binsh));
}
return buf;
}
REggPlugin r_egg_plugin_x86_osx_binsh = {
.name = "x86.osx.binsh",
.desc = "execute shell=/bin/sh",
.bytes = x86_osx_binsh,
.length = sizeof (x86_osx_binsh),
.build = build
};

View file

@ -0,0 +1,9 @@
N=egg_x86_osx_binsh
OBJ_X86OSXBINSH=${N}.o
STATIC_OBJ+=${OBJ_X86OSXBINSH}
TARGET_${N}=${N}.${EXT_SO}
ALL_TARGETS+=${TARGET_${N}}
${TARGET_X86OSXBINSH}: ${OBJ_X86OSXBINSH}
${CC} $(call libname,${N}) ${LDFLAGS} ${CFLAGS} -o ${TARGET_${N}} ${OBJ_X86OSXBINSH}

BIN
libr/egg/t/fail-t-t-strlen.sh Executable file

Binary file not shown.

View file

@ -10,3 +10,4 @@ main@global(128,128) {
}
EOF
. ./t.sh

View file

@ -10,6 +10,7 @@
#include <r_parse.h>
#define R_ASM_OPCODES_PATH R2_LIBDIR"/radare2/"R2_VERSION"/opcodes"
// XXX too big!
#define R_ASM_BUFSIZE 1024
/* backward compatibility */
@ -47,7 +48,7 @@ enum {
};
typedef struct r_asm_op_t {
int inst_len;
int inst_len; // rename to size or length
// But this is pretty slow..so maybe we should add some accessors
ut8 buf[R_ASM_BUFSIZE];
char buf_asm[R_ASM_BUFSIZE];

View file

@ -1,7 +1,9 @@
#ifndef _INCLUDE_R_EGG_H_
#define _INCLUDE_R_EGG_H_
#include <r_db.h>
#include <r_asm.h>
#include <r_lib.h>
#include <r_util.h>
#include <r_syscall.h>
@ -23,9 +25,11 @@ typedef struct r_egg_t {
RBuffer *buf;
RBuffer *bin;
RList *list;
RList *shellcodes;
//RList *shellcodes; // XXX is plugins nao?
RAsm *rasm;
RSyscall *syscall;
RPair *pair;
RList *plugins;
struct r_egg_emit_t *emit;
int endian;
int bits;
@ -94,6 +98,7 @@ typedef struct r_egg_lang_t {
R_API REgg *r_egg_new ();
R_API char *r_egg_to_string (REgg *egg);
R_API void r_egg_free (REgg *egg);
R_API int r_egg_add (REgg *a, REggPlugin *foo);
R_API void r_egg_reset (REgg *egg);
R_API int r_egg_setup(REgg *egg, const char *arch, int bits, int endian, const char *os);
R_API int r_egg_include(REgg *egg, const char *file, int format);
@ -102,8 +107,8 @@ R_API void r_egg_syscall(REgg *egg, const char *arg, ...);
R_API void r_egg_alloc(REgg *egg, int n);
R_API void r_egg_label(REgg *egg, const char *name);
R_API int r_egg_raw(REgg *egg, const ut8 *b, int len);
R_API void r_egg_shellcode(REgg *egg, const char *name);
#define r_egg_get_shellcodes(x) x->shellcodes
R_API int r_egg_shellcode(REgg *egg, const char *name);
#define r_egg_get_shellcodes(x) x->plugins
R_API void r_egg_option_set (REgg *egg, const char *k, const char *v);
R_API const char *r_egg_option_get (REgg *egg, const char *k);
R_API void r_egg_if(REgg *egg, const char *reg, char cmp, int v);
@ -116,11 +121,15 @@ R_API char *r_egg_get_source(REgg *egg);
R_API RBuffer *r_egg_get_bin(REgg *egg);
R_API char *r_egg_get_assembly(REgg *egg);
R_API void r_egg_append(REgg *egg, const char *src);
R_API int r_egg_run(REgg *egg);
/* lang.c */
R_API char *r_egg_mkvar(REgg *egg, char *out, const char *_str, int delta);
R_API int r_egg_lang_parsechar(REgg *egg, char c);
R_API void r_egg_lang_include_path (REgg *egg, const char *path);
R_API void r_egg_lang_include_init (REgg *egg);
/* plugin pointers */
extern REggPlugin r_egg_plugin_x86_osx_binsh;
#endif
#endif

View file

@ -60,6 +60,7 @@ enum {
R_LIB_TYPE_FASTCALL,/* fastcall */
R_LIB_TYPE_CRYPTO, /* cryptography */
R_LIB_TYPE_CMD, /* commands */
R_LIB_TYPE_EGG, /* r_egg plugin */
R_LIB_TYPE_LAST
};

View file

@ -74,7 +74,7 @@ deinstall uninstall:
cd .. && ${MAKE} uninstall
clean: ${EXTRA_CLEAN}
-rm -f *.${EXT_EXE} *.${EXT_SO} *.${EXT_AR}
-rm -f *.${EXT_EXE} *.${EXT_SO} *.${EXT_AR} *.d
-rm -f ${LIBSO} ${LIBAR} ${OBJ} ${BIN} *.exe a.out
-@if [ -e t/Makefile ]; then (cd t && ${MAKE} clean) ; fi
-@if [ -e p/Makefile ]; then (cd p && ${MAKE} clean) ; fi

View file

@ -7,5 +7,5 @@ Name: r_asm
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_asm -lr_lib -lr_util -lr_parse
Libs: -L${libdir} -lr_asm -lr_lib -lr_util -lr_parse -lr_db
Cflags: -I${includedir}/libr

View file

@ -7,5 +7,5 @@ Name: r_lang
Description: radare foundation libraries
Version: @VERSION@
Requires:
Libs: -L${libdir} -lr_lang -lr_util -lr_lib
Libs: -L${libdir} -lr_lang -lr_util -lr_lib -lr_line
Cflags: -I${includedir}/libr

View file

@ -5,7 +5,8 @@
# fs.jfs
# do not build : asm.x86_as
# do not build : asm.x86_nasm
STATIC="asm.java
STATIC="
asm.java
asm.bf
asm.arm
asm.armthumb
@ -56,6 +57,7 @@ debug.native
debug.gdb
debug.rap
debug.bf
egg.x86_osx_binsh
fs.fat
fs.ntfs
fs.ext2