* Refactor TODO
* Added r_anal_fcn_to_string() and get_var() - vars now have array size and direction * Some random fixes - minor opimitzation in autocompletion (thx edu) * Added Vtlr command to rename in visual tracked flags
This commit is contained in:
parent
bafedbd021
commit
67ad35187b
151
TODO
151
TODO
|
@ -11,47 +11,36 @@
|
|||
|
||||
Build system:
|
||||
-------------
|
||||
* Design new website...
|
||||
* Write documentation about how to build r2, r2-swig, valaswig, make symstall and
|
||||
some basics about the organization of the code (boring++)
|
||||
* Store version information in libraries ? debian claims for it
|
||||
* install.sh (to track installed files ..)
|
||||
|
||||
Questions:
|
||||
----------
|
||||
* #md5 #sha1 #entropy ...
|
||||
* There's dup of info between RMeta and RAnal .. functions.. oh fuck!
|
||||
* imports from PE doesnt works with /a because there's an indirect call
|
||||
* rabin2 doesnt works for fat mach-o
|
||||
* Store version information in libraries ? debian claims for it
|
||||
* Load symbol information from libraries (only the ones imported by rabin2?)
|
||||
- only in runtime when eip is in library code?
|
||||
* Implement 'av' command we need it (really?) how about to eval with ?
|
||||
* filter search results..? cc 8080 @@ hit* .. check for values that has changed.
|
||||
* code analysis with r_parse // isnt this already done? nibble?
|
||||
- generate by just parsing the opcode
|
||||
- RAnalAopArg { int size; int delta; int type; }
|
||||
- r_anal_aop_arg_set (); r_anal_aop_arg_get (); r_anal_aop_arg_binmask ();
|
||||
|
||||
Bugs:
|
||||
-----
|
||||
* Vu doesnt seems to work always fine :/
|
||||
* Cx/CX are not displayed in disasm as they should.. (C! must die)
|
||||
* if we use objcopy --stripsymbols on a library..the stripped symbols are not
|
||||
* nibble: check if we use objcopy --stripsymbols on a library..the stripped symbols are not
|
||||
listed by nm or rabin..but objcopy is able to see them O_O
|
||||
|
||||
TODO:
|
||||
-----
|
||||
* asm.syntax=att doesnt seems to work
|
||||
* Test r_lib^w32/osx support
|
||||
* port r_sign to RList
|
||||
* pancake: implement callback for conditional breakpoints
|
||||
* nibble: trace counts after step..thats not correct!
|
||||
* implement grep{col,row}
|
||||
* Implement r_sys_setenv stuff from r1 in core/file.c:33 (!!?)
|
||||
* Implement visual selection of bytes
|
||||
* pancake: FileDescriptors: dd -- copy from !fd in r1
|
||||
* pancake: we need an api to define function signatures
|
||||
- arg/var set name/get value/ ..
|
||||
- CF* must be used to define function shit
|
||||
- integrated with function signatures
|
||||
- offset -> formatstring (offset is the key to function signature)
|
||||
* pancake: implement RAnalCall (analyze function arguments, return values, propagate types..)
|
||||
- define number of arguments for given function
|
||||
- warn if signature and analysis differs in number of args or so..
|
||||
* gerardo?: implement GMP in util/big.c
|
||||
TODO nibble
|
||||
-----------
|
||||
* rabin2 doesnt works for fat mach-o
|
||||
* #md5 #sha1 #entropy ...
|
||||
* trace counts after step..thats not correct!
|
||||
* nibble: diff code analysis
|
||||
- diff two programs
|
||||
1st level:
|
||||
|
@ -62,15 +51,79 @@ TODO:
|
|||
2nd level:
|
||||
- basic block level diffing (output in graph mode)
|
||||
|
||||
TODO pancake
|
||||
------------
|
||||
* implement callback for conditional breakpoints
|
||||
* FileDescriptors: dd -- copy from !fd in r1
|
||||
* we need an api to define function signatures
|
||||
- arg/var set name/get value/ ..
|
||||
- CF* must be used to define function shit
|
||||
- integrated with function signatures
|
||||
- offset -> formatstring (offset is the key to function signature)
|
||||
* implement RAnalCall (analyze function arguments, return values, propagate types..)
|
||||
- define number of arguments for given function
|
||||
- warn if signature and analysis differs in number of args or so..
|
||||
|
||||
TODO gerardo
|
||||
------------
|
||||
* implement GMP in util/big.c
|
||||
|
||||
unassigned
|
||||
----------
|
||||
* Implement a r_list_get_n() to get Nth element in linked list
|
||||
* Test r_lib^w32/osx support
|
||||
* port r_sign to RList
|
||||
* implement grep{col,row}
|
||||
* Implement r_sys_setenv stuff from r1 in core/file.c:33 (!!?)
|
||||
* Implement visual selection of bytes
|
||||
|
||||
---8<------------8<------------------8<---------------------8<------------- -- - -
|
||||
|
||||
0.6
|
||||
===
|
||||
* r_bin->relocs // RLit of relocations
|
||||
* r_bin->relocs // RList of relocations
|
||||
* rasign2 : must be done, write manpage
|
||||
* distribute 'spp' with 'rarc2' ?
|
||||
* Initial analysis looking for xrefs to strings and so? ax? ./a@@entry0 - Launched at startup
|
||||
|
||||
Analysis
|
||||
========
|
||||
* Implement more get_main() (NOOB)
|
||||
|
||||
Bindings
|
||||
========
|
||||
* generate accessors automatically from valaswig
|
||||
* Script plugins
|
||||
- We should enable r_lib to implement plugins in any
|
||||
scripting language, so we can for example prepare
|
||||
a .c stub interface for python/perl/ruby/..
|
||||
- this requires a swig bridge
|
||||
|
||||
Refactoring
|
||||
===========
|
||||
* Add RLog API.. pipeable to disk and stderr..also hookable ..cool for ui
|
||||
* Move disasm loop into r_print (r_print should depend on r_asm)
|
||||
- thats hard :)
|
||||
* Move 'r_syscall_t' stuff into r_debug (sync r_core)
|
||||
* merge r_asm and r_anal?
|
||||
* Implement r_bind api to link multiple pointers
|
||||
core->asm = r_bind_set (core->asm->bind, r_asm_new ());
|
||||
* what do we have to do with r_th, r_parse and r_vm ?
|
||||
* Is RCore->block and blocksize a RBuf ? refactor!11
|
||||
* Find a better name for r_buf_fread (really?)
|
||||
* typedef all function pointers, like in r_bp
|
||||
* Review r_io API
|
||||
* semi-ok state (R_TRUFAE), implement r_errno and r_errstr in r_util?
|
||||
* Finish and import the spp's getopt owns implementation in r_util (like in p9)
|
||||
* Rename __UNIX__ as __POSIX__
|
||||
|
||||
Future
|
||||
======
|
||||
* radare2 -e dbg.engine=vm -d ls
|
||||
- load the program using r_bin in virtual space
|
||||
- initialize vm and set regs
|
||||
- debug backend should use the vm
|
||||
|
||||
Transaction notes
|
||||
=================
|
||||
Loading big binaries results on broken interaction.
|
||||
|
@ -93,52 +146,6 @@ Loading big binaries results on broken interaction.
|
|||
\
|
||||
`-- (while (lock,load,unlock))
|
||||
|
||||
Analysis
|
||||
========
|
||||
* Implement more get_main() (NOOB)
|
||||
* code analysis with r_parse // isnt this already done? nibble?
|
||||
- generate by just parsing the opcode
|
||||
- RAnalAopArg { int size; int delta; int type; }
|
||||
- r_anal_aop_arg_set (); r_anal_aop_arg_get (); r_anal_aop_arg_binmask ();
|
||||
|
||||
Bindings
|
||||
========
|
||||
* generate accessors automatically from valaswig
|
||||
* Script plugins
|
||||
- We should enable r_lib to implement plugins in any
|
||||
scripting language, so we can for example prepare
|
||||
a .c stub interface for python/perl/ruby/..
|
||||
- this requires a swig bridge
|
||||
|
||||
Build system
|
||||
============
|
||||
* install.sh (to track installed files ..)
|
||||
|
||||
Refactoring
|
||||
===========
|
||||
* Add RLog API.. pipeable to disk and stderr..also hookable ..cool for ui
|
||||
* Move disasm loop into r_print (r_print should depend on r_asm)
|
||||
- thats hard :)
|
||||
* Move 'r_syscall_t' stuff into r_debug (sync r_core)
|
||||
* merge r_asm and r_anal?
|
||||
* Implement r_bind api to link multiple pointers
|
||||
core->asm = r_bind_set (core->asm->bind, r_asm_new ());
|
||||
* what do we have to do with r_th, r_parse and r_vm ?
|
||||
* Is RCore->block and blocksize a RBuf ? refactor!11
|
||||
* Find a better name for r_buf_fread (really?)
|
||||
* typedef all function pointers, like in r_bp
|
||||
* Review r_io API
|
||||
* rasm2 should be configurable at startup time to choose default arch (use env?)
|
||||
* semi-ok state (R_TRUFAE), implement r_errno and r_errstr in r_util?
|
||||
* Finish and import the spp's getopt owns implementation in r_util (like in p9)
|
||||
* Rename __UNIX__ as __POSIX__
|
||||
|
||||
Future
|
||||
======
|
||||
* radare2 -e dbg.engine=vm -d ls
|
||||
- load the program using r_bin in virtual space
|
||||
- initialize vm and set regs
|
||||
- debug backend should use the vm
|
||||
|
||||
.------------------------.
|
||||
| ___ ___ ____ |
|
||||
|
|
|
@ -92,7 +92,6 @@ setup dbg.fpregs to true to visualize the fpu registers in the debugger view
|
|||
To debug a program you can do dbg://${path-to-program} or use -d ${path..}
|
||||
3nl4r9e y0\/r r4d4r3
|
||||
LUA is the default scripting language for radare. Read radare.lua fmi
|
||||
There's a discussion forum in http://radare.nopcode.org/forum/
|
||||
I did it for the pwnz
|
||||
If you send the program you are debugging to 15 friends before 143 minutes and then step three times on the same opcode you will get the name of the person who loves you
|
||||
To remove this message, put `dbxenv suppress_startup_message 7.5' in your .dbxrc
|
||||
|
@ -108,3 +107,4 @@ radare2 is like windows 7 but even better
|
|||
Enlarge your radare2
|
||||
Excellent; we can attack in any direction!
|
||||
Better than an eel in the ass
|
||||
radare build farm is beats the facebook one
|
||||
|
|
|
@ -148,8 +148,8 @@ R_API int r_anal_fcn_del(RAnal *anal, ut64 addr) {
|
|||
if (!(anal->fcns = r_anal_fcn_list_new ()))
|
||||
return R_FALSE;
|
||||
} else r_list_foreach (anal->fcns, iter, fcni)
|
||||
if (addr >= fcni->addr && addr < fcni->addr+fcni->size)
|
||||
r_list_unlink (anal->fcns, fcni);
|
||||
if (addr >= fcni->addr && addr < fcni->addr+fcni->size)
|
||||
r_list_unlink (anal->fcns, fcni);
|
||||
return R_TRUE;
|
||||
}
|
||||
|
||||
|
@ -173,3 +173,32 @@ R_API RAnalFcn *r_anal_fcn_find(RAnal *anal, ut64 addr) {
|
|||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
R_API RAnalVar *r_anal_fcn_get_var(RAnalFcn *fs, int num, int dir) {
|
||||
RAnalVar *var;
|
||||
RListIter *iter;
|
||||
int count = 0;
|
||||
// TODO: vars must be sorted by delta
|
||||
r_list_foreach (fs->vars, iter, var) {
|
||||
if (dir & var->dir)
|
||||
if (count++ == num)
|
||||
return var;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
R_API char *r_anal_fcn_to_string(RAnal *a, RAnalFcn* fs) {
|
||||
int i;
|
||||
char *sign;
|
||||
RAnalVar *arg, *ret = r_anal_fcn_get_var (fs, 0, R_ANAL_VAR_OUT);
|
||||
if (ret) sign = r_str_newf ("%s %s (", ret->name, fs->name);
|
||||
else sign = r_str_newf ("void %s (", fs->name);
|
||||
for (i=0;;i++) {
|
||||
arg = r_anal_fcn_get_var (fs, i, R_ANAL_VAR_IN);
|
||||
if (!arg) break;
|
||||
if (i) sign = r_str_concatf (sign, ", %s %s", arg->vartype, arg->name);
|
||||
else sign = r_str_concatf (sign, "%s %s", arg->vartype, arg->name);
|
||||
}
|
||||
sign = r_str_concatf (sign, ");");
|
||||
return sign;
|
||||
}
|
||||
|
|
|
@ -16,9 +16,7 @@ R_API RAnalVar *r_anal_var_new() {
|
|||
}
|
||||
|
||||
R_API RAnalVarType *r_anal_var_type_new() {
|
||||
RAnalVarType *vartype;
|
||||
|
||||
vartype = R_NEW (RAnalVarType);
|
||||
RAnalVarType *vartype = R_NEW (RAnalVarType);
|
||||
if (vartype)
|
||||
memset (vartype, 0, sizeof (RAnalVarType));
|
||||
return vartype;
|
||||
|
|
|
@ -7,8 +7,7 @@
|
|||
/* this is the base fd.. more than one is supported :) */
|
||||
static int backup_fd=999;
|
||||
|
||||
R_API int r_cons_pipe_open(const char *file, int append)
|
||||
{
|
||||
R_API int r_cons_pipe_open(const char *file, int append) {
|
||||
int fd = open(file, O_RDWR | O_CREAT | (append?O_APPEND:O_TRUNC), 0644);
|
||||
if (fd==-1) {
|
||||
fprintf(stderr, "Cannot open file '%s'\n", file);
|
||||
|
@ -19,8 +18,7 @@ R_API int r_cons_pipe_open(const char *file, int append)
|
|||
return fd;
|
||||
}
|
||||
|
||||
R_API void r_cons_pipe_close(int fd)
|
||||
{
|
||||
R_API void r_cons_pipe_close(int fd) {
|
||||
if (fd == -1)
|
||||
return;
|
||||
close(fd);
|
||||
|
|
|
@ -130,8 +130,11 @@ static void r_print_disasm(RPrint *p, RCore *core, ut64 addr, ut8 *buf, int len,
|
|||
{
|
||||
RAnalFcn *f = r_anal_fcn_find (core->anal, addr);
|
||||
if (f && f->addr == at) {
|
||||
char *sign = r_anal_fcn_to_string (core->anal, f);
|
||||
r_cons_printf ("/* function: %s (%d) */\n",
|
||||
f->name, f->size);
|
||||
if (sign) r_cons_printf ("// %s\n", sign);
|
||||
free (sign);
|
||||
stackptr = 0;
|
||||
fcni = f;
|
||||
}
|
||||
|
@ -534,7 +537,7 @@ static int cmd_zign(void *data, const char *input) {
|
|||
" zf name fmt define function zignature (fast/slow, args, types)\n"
|
||||
" zb name bytes define zignature for bytes\n"
|
||||
" zh name bytes define function header zignature\n"
|
||||
" zg pfx [file] generate siganture for current file\n"
|
||||
" zg pfx [file] generate signature for current file\n"
|
||||
" .zc @ fcn.foo flag signature if matching (.zc@@fcn)\n"
|
||||
" z/ [ini] [end] search zignatures between these regions\n"
|
||||
"NOTE: bytes can contain '.' (dots) to specify a binary mask\n");
|
||||
|
@ -2411,13 +2414,15 @@ static int cmd_meta(void *data, const char *input) {
|
|||
case '!':
|
||||
r_meta_sync (core->meta);
|
||||
break;
|
||||
case 'F': /* add function */
|
||||
eprintf ("TODO\n");
|
||||
break;
|
||||
case 'S':
|
||||
case 's':
|
||||
case 'd': /* data */
|
||||
case 'm': /* struct */
|
||||
case 'x': /* code xref */
|
||||
case 'X': /* data xref */
|
||||
case 'F': /* add function */
|
||||
switch (input[1]) {
|
||||
case '-':
|
||||
if (input[2]==' ')
|
||||
|
@ -2475,10 +2480,10 @@ static int cmd_meta(void *data, const char *input) {
|
|||
case '?':
|
||||
eprintf (
|
||||
"Usage: C[-LCFsSmxX?] [...]\n"
|
||||
" C! # sync xrefs with\n"
|
||||
" C! # sync xrefs with (to be deprecated)\n"
|
||||
" C-[@][ addr] # delete metadata at given address\n"
|
||||
" CL[-] [addr] # show 'code line' information (bininfo)\n"
|
||||
" CF [size] [name] [addr] [name] # register function size here\n"
|
||||
//" CF [size] [name] [addr] [name] # register function size here\n"
|
||||
" CC [string] # add comment\n"
|
||||
" Cs[-] [size] [[addr]] # add string\n"
|
||||
" CS[-] [size] # ...\n"
|
||||
|
@ -2492,7 +2497,7 @@ static int cmd_meta(void *data, const char *input) {
|
|||
|
||||
static int cmd_macro(void *data, const char *input) {
|
||||
RCore *core = (RCore*)data;
|
||||
switch(input[0]) {
|
||||
switch (input[0]) {
|
||||
case ')':
|
||||
r_cmd_macro_break (&core->cmd->macro, input+1);
|
||||
break;
|
||||
|
|
|
@ -82,7 +82,7 @@ static int autocomplete(RLine *line) {
|
|||
(!memcmp (line->buffer.data, "/a ", 3)) ||
|
||||
(!memcmp (line->buffer.data, "? ", 2))) {
|
||||
int n, i = 0;
|
||||
int sdelta = (line->buffer.data[0]=='/' || (!memcmp (line->buffer.data, "fr ", 3)))?3:2;
|
||||
int sdelta = (line->buffer.data[1]==' ')?2:3;
|
||||
n = strlen (line->buffer.data+sdelta);
|
||||
list_for_each_prev (pos, &core->flags->flags) {
|
||||
RFlagItem *flag = list_entry (pos, RFlagItem, list);
|
||||
|
|
|
@ -171,6 +171,8 @@ R_API int r_core_visual_trackflags(RCore *core) {
|
|||
break;
|
||||
case 'e':
|
||||
/* TODO: prompt for addr, size, name */
|
||||
eprintf ("TODO\n");
|
||||
sleep (1);
|
||||
break;
|
||||
case 'q':
|
||||
if (menu<=0) return R_TRUE; menu--;
|
||||
|
@ -187,6 +189,20 @@ R_API int r_core_visual_trackflags(RCore *core) {
|
|||
case '-':
|
||||
r_core_block_size (core, core->blocksize-1);
|
||||
break;
|
||||
case 'r':
|
||||
if (menu == 1) {
|
||||
int len;
|
||||
r_cons_set_raw (0);
|
||||
// TODO: use r_flag_rename or wtf?..fr doesnt uses this..
|
||||
snprintf (cmd, sizeof (cmd), "fr %s ", fs2);
|
||||
len = strlen (cmd);
|
||||
eprintf ("Rename flag '%s' as:\n", fs2);
|
||||
if (r_cons_fgets (cmd+len, sizeof (cmd)-len-1, 0, NULL) <0)
|
||||
cmd[0]='\0';
|
||||
r_core_cmd (core, cmd, 0);
|
||||
r_cons_set_raw (1);
|
||||
}
|
||||
break;
|
||||
case 'P':
|
||||
if (--format<0)
|
||||
format = MAX_FORMAT;
|
||||
|
@ -219,6 +235,7 @@ R_API int r_core_visual_trackflags(RCore *core) {
|
|||
" a/d/e - add/delete/edit flag\n"
|
||||
" +/- - increase/decrease block size\n"
|
||||
" o - sort flags by offset\n"
|
||||
" r - rename flag\n"
|
||||
" n - sort flags by name\n"
|
||||
" p/P - rotate print format\n"
|
||||
" : - enter command\n");
|
||||
|
@ -426,7 +443,7 @@ R_API void r_core_visual_config(RCore *core) {
|
|||
#if HAVE_LIB_READLINE
|
||||
char *ptr = readline(VISUAL_PROMPT);
|
||||
if (ptr) {
|
||||
strncpy(cmd, ptr, sizeof(cmd));
|
||||
strncpy(cmd, ptr, sizeof (cmd));
|
||||
r_core_cmd(core, cmd, 1);
|
||||
free(ptr);
|
||||
}
|
||||
|
|
|
@ -216,11 +216,18 @@ typedef struct r_anal_var_access_t {
|
|||
int set;
|
||||
} RAnalVarAccess;
|
||||
|
||||
enum {
|
||||
R_ANAL_VAR_IN = 1,
|
||||
R_ANAL_VAR_OUT = 2
|
||||
};
|
||||
|
||||
typedef struct r_anal_var_t {
|
||||
char *name;
|
||||
int delta;
|
||||
int type; /* global, local... */
|
||||
char *vartype; /* float, int... */
|
||||
char *name; /* name of the variable */
|
||||
int delta; /* delta offset inside stack frame */
|
||||
int dir; /* direction (in, out) */
|
||||
int type; /* global, local... */
|
||||
int array; /* array size */
|
||||
char *vartype; /* float, int... */
|
||||
/* probably dupped or so */
|
||||
RList/*RAnalVarAccess*/ *accesses; /* list of accesses for this var */
|
||||
RList/*RAnalValue*/ *stores; /* where this */
|
||||
|
@ -260,7 +267,6 @@ typedef struct r_anal_plugin_t {
|
|||
struct list_head list;
|
||||
} RAnalPlugin;
|
||||
|
||||
|
||||
#ifdef R_API
|
||||
/* anal.c */
|
||||
R_API RAnal *r_anal_new();
|
||||
|
@ -304,6 +310,8 @@ R_API int r_anal_fcn_add(RAnal *anal, ut64 addr, ut64 size,
|
|||
const char *name, int diff);
|
||||
R_API int r_anal_fcn_del(RAnal *anal, ut64 addr);
|
||||
R_API RList *r_anal_fcn_bb_list(RAnal *anal, RAnalFcn *fcn);
|
||||
R_API RAnalVar *r_anal_fcn_get_var(RAnalFcn *fs, int num, int dir);
|
||||
R_API char *r_anal_fcn_to_string(RAnal *a, RAnalFcn* fs);
|
||||
|
||||
/* ref.c */
|
||||
R_API RAnalRef *r_anal_ref_new();
|
||||
|
|
|
@ -190,6 +190,7 @@ R_API void r_str_writef(int fd, const char *fmt, ...);
|
|||
R_API char **r_str_argv(const char *str, int *_argc);
|
||||
R_API void r_str_argv_free(char **argv);
|
||||
R_API char *r_str_new(char *str);
|
||||
R_API char *r_str_newf(const char *fmt, ...);
|
||||
R_API const char *r_str_bool(int b);
|
||||
R_API const char *r_str_ansi_chrn(const char *str, int n);
|
||||
R_API int r_str_ansi_len(const char *str);
|
||||
|
|
|
@ -187,6 +187,16 @@ R_API char *r_str_new(char *str) {
|
|||
return strdup (str);
|
||||
}
|
||||
|
||||
R_API char *r_str_newf(const char *fmt, ...) {
|
||||
char string[1024];
|
||||
va_list ap;
|
||||
va_start (ap, fmt);
|
||||
vsnprintf (string, 1023, fmt, ap);
|
||||
fmt = r_str_new (string);
|
||||
va_end (ap);
|
||||
return (char*)fmt;
|
||||
}
|
||||
|
||||
R_API char *r_str_chop(char *str) {
|
||||
int len;
|
||||
char *ptr;
|
||||
|
|
Loading…
Reference in New Issue