#ifndef R2_EGG_H #define R2_EGG_H #include #include #include #include #include #ifdef __cplusplus extern "C" { #endif R_LIB_VERSION_HEADER(r_egg); #define R_EGG_INCDIR_ENV "EGG_INCDIR" #define R_EGG_INCDIR_PATH R2_PREFIX "/lib/radare2/" R2_VERSION "/egg" // rename to REggShellcode #define R_EGG_PLUGIN_SHELLCODE 0 #define R_EGG_PLUGIN_ENCODER 1 typedef struct r_egg_plugin_t { const char *name; const char *desc; int type; RBuffer* (*build) (void *egg); } REggPlugin; typedef struct r_egg_t { RBuffer *src; RBuffer *buf; RBuffer *bin; RList *list; //RList *shellcodes; // XXX is plugins nao? RAsm *rasm; RSyscall *syscall; Sdb *db; RList *plugins; RList *patches; // struct r_egg_emit_t *remit; int arch; int endian; int bits; ut32 os; int context; } REgg; /* XXX: this may fail in different arches */ #if 0 r2 -q - <plugins R_API void r_egg_option_set (REgg *egg, const char *k, const char *v); R_API 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); R_API void r_egg_printf(REgg *egg, const char *fmt, ...); R_API int r_egg_compile(REgg *egg); R_API int r_egg_padding (REgg *egg, const char *pad); R_API int r_egg_assemble(REgg *egg); R_API void r_egg_pattern(REgg *egg, int size); R_API RBuffer *r_egg_get_bin(REgg *egg); //R_API int r_egg_dump (REgg *egg, const char *file) { } 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); R_API int r_egg_patch(REgg *egg, int off, const ut8 *b, int l); R_API void r_egg_finalize(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_xor; extern REggPlugin r_egg_plugin_shya; extern REggPlugin r_egg_plugin_exec; #endif #ifdef __cplusplus } #endif #endif