mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-26 14:40:31 +00:00
* Update and reorder TODO tasks
* Added r_file_mmap() functions in r_util * Do not hash files bigger than 10MB * Fix abspath() return value and signature
This commit is contained in:
parent
9b6a8ca973
commit
6d515cc1a8
181
TODO
181
TODO
@ -5,68 +5,10 @@
|
||||
|
||||
<{include libr/TODO}>
|
||||
|
||||
TODO 0.7
|
||||
========
|
||||
* fork/clone child . inject code to create new threads or pids
|
||||
- dpn dptn
|
||||
* dmi command must read from memory if no file path provided
|
||||
- rabin from memory ftw
|
||||
- to get libnames of dll, so..
|
||||
* inject code someway?
|
||||
* Refactor cursor stuff (already done?)imho yes
|
||||
* w32 is required this?? r2 -d <pid> > dh native > dp=824 > ... -- not really :) for 0.6
|
||||
* Create radare2-testsuite project
|
||||
- tests for ired, rax2, radare2, rabin2 ...
|
||||
* Record trace of register status for each function when running
|
||||
- r_reg_arena_copy();
|
||||
* Add lua and dalvik disassembler (volunteers?)
|
||||
* Reimplement or fix the delta diffing in C
|
||||
- first we need to do it for ired..
|
||||
* Trace contents of buffers: filter search results..? cc 8080 @@ hit* .. check for values that has changed.
|
||||
* Add dex format support to rabin (android)
|
||||
* Is RCore->block and blocksize a RBuf ? refactor!11
|
||||
* add support for sign/unsigned registers..or at least a way to cast them
|
||||
* Implement rap:// upload/download protocol commands (maybe just system() with rsc2+wget?
|
||||
* Add support for STATIC_PLUGINS in r_lang
|
||||
- r_lang_define is implemented in lang.c, but requires the collaboration
|
||||
of the plugins to properly setup the environment for the script execution.
|
||||
- Add support for STATIC_PLUGINS in r_lang
|
||||
- dlerror(/usr/lib/radare2/lang_perl.so): libperl.so: cannot open shared object file: No such file or directory
|
||||
This issue is fixed by setting LD_LIBRARY_PATH...looks like dlopen ignores rpath
|
||||
* merge asm.arch vm.arch
|
||||
* Functions in r_util to get lil/big ut8,16,32 from ut8*
|
||||
* rahash takes TOO long to load on big binaries
|
||||
[pancake@dazo ~]$ rax -
|
||||
jeje
|
||||
6a656a650a^C
|
||||
[pancake@dazo ~]$ rax2 -
|
||||
jeje
|
||||
0x0
|
||||
^C
|
||||
* _ZN7WebCore11CounterNode7recountERKNS_12AtomicStringE
|
||||
- demangle c++ and objc names
|
||||
WebCore.CounterNode.recount(AtomicString)
|
||||
_ZN = begin of stream
|
||||
0-9+ = count of chars
|
||||
E = end of stream
|
||||
RKNS_ = start of arguments
|
||||
* Check if python plugin works from inside (IMHO no)
|
||||
|
||||
Questions
|
||||
=========
|
||||
* r_list_foreach_prev is buggy, review and remove..
|
||||
* make symstall in swig/ ?
|
||||
* What about rsc2 ? deprecate, maintain? cleanup from 1? build? install?
|
||||
* Add deltified offset in PC? +10, +30 ... asm.reladdr
|
||||
* Add "pm ?" for bit print like in pb?
|
||||
* regio not implemented // it is really necessary? imho no..
|
||||
* Only use uppercase KMG for Kilo,Mega,Giga in r_num? - 'g' is for double
|
||||
* distribute 'spp' with 'rarc2' ? imho no
|
||||
|
||||
Debugger
|
||||
========
|
||||
* stepover waits for one unknown event that cannot be stopped
|
||||
* Implement DRX support
|
||||
* stepover waits for one unknown event that cannot be stopped
|
||||
* Implement list threads on ALL supported platforms (win,lin,osx)
|
||||
* ALL threads must be stopped when a breakpoint is handled..
|
||||
* Floating point registers
|
||||
@ -74,8 +16,44 @@ Debugger
|
||||
* Implement dump+restore as macros (dump,)
|
||||
* Add support for windbg+virtualkd
|
||||
|
||||
TODO nibble
|
||||
-----------
|
||||
pancake
|
||||
-------
|
||||
* fork/clone child . inject code to create new threads or pids
|
||||
- dpn dptn
|
||||
* Functions in r_util to get lil/big ut8,16,32 from ut8*
|
||||
- already done..must find better names probably
|
||||
* merge asm.arch vm.arch
|
||||
* _ZN7WebCore11CounterNode7recountERKNS_12AtomicStringE
|
||||
- demangle c++ and objc names
|
||||
WebCore.CounterNode.recount(AtomicString)
|
||||
_ZN = begin of stream
|
||||
0-9+ = count of chars
|
||||
E = end of stream
|
||||
RKNS_ = start of arguments
|
||||
* Implement rap:// upload/download protocol commands (maybe just system() with rsc2+wget?
|
||||
* support for macro scripting
|
||||
* better debugger support for OSX and iOS
|
||||
* rarc2 allows to compile invalid code like calling puts() out of context
|
||||
* 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..
|
||||
- when calling a function
|
||||
- identify arguments passed and compare with arguments required
|
||||
- if they do not match: we need to warn/ask user/store multiple options
|
||||
- function signature comparsion if they dont match
|
||||
r_anal_fcn_cmp (anal, f1, f2);
|
||||
|
||||
nibble
|
||||
------
|
||||
* implement getsym() in r_bin , replace getmain()
|
||||
* Check if python plugin works from inside
|
||||
- write tuto, how to call py code from shell or r2
|
||||
* dmi command must read from memory if no file path provided
|
||||
- rabin from memory ftw
|
||||
- to get libnames of dll, so..
|
||||
* Refactor cursor stuff
|
||||
- isnt this already done? -- imho yes
|
||||
-- from 0.6
|
||||
* r_anal
|
||||
- use r_anal_value everywhere
|
||||
- x86im
|
||||
@ -94,10 +72,15 @@ TODO nibble
|
||||
- implement GMP in util/big.c
|
||||
- http://etutorials.org/Programming/secure+programming/Chapter+7.+Public+Key+Cryptography/7.5+Generating+a+Prime+Number+Testing+for+Primality/
|
||||
|
||||
TODO edu
|
||||
--------
|
||||
* remove all uses of alloca()
|
||||
* Implement more get_main()
|
||||
@earada
|
||||
-------
|
||||
* sha1 checksum of files is not correct
|
||||
* r_file_slurp should work fine for big files
|
||||
- mmap if supported
|
||||
- add r_file_mmap ?
|
||||
- read file in blocks instead of the whole file in a single syscall
|
||||
* remove all uses of alloca() // mingw and grep reports them all :)
|
||||
* Only use uppercase KMG for Kilo,Mega,Giga in r_num? - 'g' is for double
|
||||
* typedef all function pointers, like in r_bp
|
||||
* Implement /A : search AES
|
||||
* Implement case-insensitive search (e search.casematters ?) any better name? Use /i?
|
||||
@ -105,22 +88,44 @@ TODO edu
|
||||
* Implement /p to search for patterns
|
||||
- implement it in r_core ?? or add r_io_bind support
|
||||
* Implement search and replace /s
|
||||
- insert or append? (see r1 cfg vars)
|
||||
|
||||
TODO 0.7
|
||||
========
|
||||
* inject code someway?
|
||||
* Create radare2-testsuite project
|
||||
- tests for ired, rax2, radare2, rabin2 ...
|
||||
* Record trace of register status for each function when running
|
||||
- r_reg_arena_copy();
|
||||
* Add lua and dalvik disassembler (volunteers?)
|
||||
- Add dex format support to rabin (android)
|
||||
* Reimplement or fix the delta diffing in C
|
||||
- first we need to do it for ired..
|
||||
* Trace contents of buffers: filter search results..? cc 8080 @@ hit* .. check for values that has changed.
|
||||
* Is RCore->block and blocksize a RBuf ? refactor!11
|
||||
* add support for sign/unsigned registers..or at least a way to cast them
|
||||
* Add support for STATIC_PLUGINS in r_lang
|
||||
- r_lang_define is implemented in lang.c, but requires the collaboration
|
||||
of the plugins to properly setup the environment for the script execution.
|
||||
- Add support for STATIC_PLUGINS in r_lang
|
||||
- dlerror(/usr/lib/radare2/lang_perl.so): libperl.so: cannot open shared object file: No such file or directory
|
||||
This issue is fixed by setting LD_LIBRARY_PATH...looks like dlopen ignores rpath
|
||||
|
||||
Questions
|
||||
=========
|
||||
* radare2.c:217 . find name for maxfilesize to hash
|
||||
* r_list_foreach_prev is buggy, review and remove..
|
||||
* make symstall in swig/ ?
|
||||
* What about rsc2 ? deprecate, maintain? cleanup from 1? build? install?
|
||||
* Add deltified offset in PC? +10, +30 ... asm.reladdr
|
||||
* Add "pm ?" for bit print like in pb?
|
||||
* regio not implemented // it is really necessary? imho no..
|
||||
* distribute 'spp' with 'rarc2' ? imho no
|
||||
|
||||
TODO pancake
|
||||
------------
|
||||
* rarc2 allows to compile invalid code like calling puts() out of context
|
||||
* 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..
|
||||
- when calling a function
|
||||
- identify arguments passed and compare with arguments required
|
||||
- if they do not match: we need to warn/ask user/store multiple options
|
||||
- function signature comparsion if they dont match
|
||||
r_anal_fcn_cmp (anal, f1, f2);
|
||||
|
||||
Bindings
|
||||
========
|
||||
* generate accessors from valaswig
|
||||
* generate accessors from valaswig ? why?
|
||||
* Script plugins
|
||||
- We should enable r_lib to implement plugins in any
|
||||
scripting language, so we can for example prepare
|
||||
@ -183,28 +188,6 @@ Flags
|
||||
- the r_flag_get by string should have another construction with btree
|
||||
for the string of the name
|
||||
|
||||
Transaction notes
|
||||
=================
|
||||
Loading big binaries results on broken interaction.
|
||||
- Optimize bottlenecks
|
||||
- Index flags by name and offset
|
||||
- Dont walk all the entries all the time
|
||||
- Use RDB or RHashMap
|
||||
- Cache
|
||||
- We can just cache the last N used pointers to resolve them faster
|
||||
- Should work fine for disassembling and others
|
||||
- Transactions and threads
|
||||
- BIGLOCK is enought i think
|
||||
- A background thread can load rabin info
|
||||
- r_th is required
|
||||
- We need a way to get 'status' info from thread (msg passing?)
|
||||
- r_th_msg
|
||||
- We can lock the loading thread when a shell command is going to be executed
|
||||
|
|
||||
|--- (while (prompt,lock,run,unlock))
|
||||
\
|
||||
`-- (while (lock,load,unlock))
|
||||
|
||||
|
||||
.------------------------.
|
||||
| ___ ___ ____ |
|
||||
|
@ -211,10 +211,13 @@ int main(int argc, char **argv) {
|
||||
r_cons_flush ();
|
||||
}
|
||||
|
||||
/* XXX: find better solution.. files > 10MB does not hash */
|
||||
#define SLURP_LIMIT (10*1024*1024)
|
||||
/* check if file.sha1 has changed */
|
||||
if (!strstr(r.file->filename,"://")) {
|
||||
char *path = strdup (r_config_get (r.config, "file.path"));
|
||||
if (r.file->size < SLURP_LIMIT) // TODO: configure this in cfg.hashlimit //
|
||||
if (!strstr (r.file->filename,"://")) {
|
||||
const char *npath, *nsha1;
|
||||
char *path = strdup (r_config_get (r.config, "file.path"));
|
||||
char *sha1 = strdup (r_config_get (r.config, "file.sha1"));
|
||||
char *cmd = r_str_dup_printf (".!rahash2 -r %s", r.file->filename);
|
||||
has_project = r_core_project_open (&r, r_config_get (r.config, "file.project"));
|
||||
|
@ -61,7 +61,6 @@ int main(int argc, char **argv) {
|
||||
int c, buf_len = 0;
|
||||
int bsize = 0;
|
||||
int rad = 0;
|
||||
int ret = 0;
|
||||
|
||||
while ((c = getopt (argc, argv, "rVa:s:b:h")) != -1) {
|
||||
switch (c) {
|
||||
@ -88,7 +87,6 @@ int main(int argc, char **argv) {
|
||||
if (optind<argc)
|
||||
buf = (const ut8*)r_file_slurp (argv[optind], &buf_len);
|
||||
if (buf == NULL)
|
||||
return 1;
|
||||
else ret = do_hash (algo, buf, buf_len, bsize, rad);
|
||||
return ret;
|
||||
return do_help (1);
|
||||
return do_hash (algo, buf, buf_len, bsize, rad);
|
||||
}
|
||||
|
@ -338,6 +338,7 @@ R_API int r_core_config_init(RCore *core) {
|
||||
r_config_set_cb (cfg, "cfg.datefmt", "%d:%m:%Y %H:%M:%S %z", &config_cfgdatefmt_callback);
|
||||
r_config_set (cfg, "cfg.fortunes", "true");
|
||||
r_config_set (cfg, "dbg.backend", "native");
|
||||
config_set("dbg.bep", "loader"); // loader, entry, constructor, main
|
||||
r_config_set_cb (cfg, "dbg.stopthreads", "true", &config_stopthreads_callback);
|
||||
r_config_set_cb (cfg, "dbg.swstep", "false", &config_swstep_callback);
|
||||
r_config_set_cb (cfg, "dbg.trace", "true", &config_trace_callback);
|
||||
@ -526,7 +527,6 @@ R_API int r_core_config_init(RCore *core) {
|
||||
#else
|
||||
config_set("dbg.hwbp", "true"); // hardware breakpoints by default // ALSO BSD
|
||||
#endif
|
||||
config_set("dbg.bep", "loader"); // loader, main
|
||||
config_set("dir.home", getenv("HOME"));
|
||||
|
||||
/* dir.monitor */
|
||||
|
@ -22,6 +22,14 @@
|
||||
#define R_BIN_SIZEOF_STRINGS 256
|
||||
#define R_BIN_MAX_ARCH 1024
|
||||
|
||||
// TODO: rename getmain() bin.getsym(RBin.SYM_ENTRY)
|
||||
enum {
|
||||
R_BIN_SYM_ENTRY,
|
||||
R_BIN_SYM_INIT,
|
||||
R_BIN_SYM_MAIN,
|
||||
R_BIN_SYM_FINI
|
||||
};
|
||||
|
||||
typedef struct r_bin_arch_t {
|
||||
char *file;
|
||||
int size;
|
||||
@ -194,7 +202,6 @@ typedef struct r_bin_obj_t {
|
||||
} RBinObj;
|
||||
|
||||
#ifdef R_API
|
||||
|
||||
/* bin.c */
|
||||
R_API int r_bin_add(RBin *bin, RBinPlugin *foo);
|
||||
R_API int r_bin_xtr_add(RBin *bin, RBinXtrPlugin *foo);
|
||||
@ -225,16 +232,13 @@ R_API int r_bin_set_arch(RBin *bin, const char *arch, int bits, const char *name
|
||||
R_API int r_bin_set_archidx(RBin *bin, int idx);
|
||||
R_API void r_bin_list_archs(RBin *bin);
|
||||
R_API void r_bin_set_user_ptr(RBin *bin, void *user);
|
||||
|
||||
/* bin_meta.c */
|
||||
R_API int r_bin_meta_get_line(RBin *bin, ut64 addr, char *file, int len, int *line);
|
||||
R_API char *r_bin_meta_get_source_line(RBin *bin, ut64 addr);
|
||||
|
||||
/* bin_write.c */
|
||||
R_API ut64 r_bin_wr_scn_resize(RBin *bin, const char *name, ut64 size);
|
||||
R_API int r_bin_wr_rpath_del(RBin *bin);
|
||||
R_API int r_bin_wr_output(RBin *bin, const char *filename);
|
||||
|
||||
/* plugin pointers */
|
||||
extern RBinPlugin r_bin_plugin_elf;
|
||||
extern RBinPlugin r_bin_plugin_elf64;
|
||||
@ -246,6 +250,5 @@ extern RBinPlugin r_bin_plugin_java;
|
||||
extern RBinPlugin r_bin_plugin_dummy;
|
||||
extern RBinXtrPlugin r_bin_xtr_plugin_fatmach0;
|
||||
extern RBinXtrPlugin r_bin_xtr_plugin_dyldcache;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -78,7 +78,12 @@ typedef struct r_range_t {
|
||||
RList *ranges;
|
||||
} RRange;
|
||||
|
||||
#ifdef R_API
|
||||
typedef struct r_mmap_t {
|
||||
ut8 *buf;
|
||||
int len;
|
||||
int fd;
|
||||
} RMmap;
|
||||
|
||||
/* bitsize */
|
||||
enum {
|
||||
R_SYS_BITS_8 = 1,
|
||||
@ -87,6 +92,11 @@ enum {
|
||||
R_SYS_BITS_64 = 8,
|
||||
};
|
||||
|
||||
#ifdef R_API
|
||||
|
||||
R_API RMmap *r_file_mmap (const char *file);
|
||||
R_API void r_file_mmap_free (RMmap *m);
|
||||
|
||||
/* arch */
|
||||
// TODO: This must deprecate DEFAULT_ARCH??
|
||||
#if __i386__
|
||||
@ -262,7 +272,7 @@ R_API st64 r_hex_bin_truncate (ut64 in, int n);
|
||||
|
||||
R_API char *r_file_path(const char *bin);
|
||||
R_API const char *r_file_basename (const char *path);
|
||||
R_API const char *r_file_abspath(const char *file);
|
||||
R_API char *r_file_abspath(const char *file);
|
||||
R_API char *r_file_slurp(const char *str, int *usz);
|
||||
//R_API char *r_file_slurp_range(const char *str, ut64 off, ut64 sz);
|
||||
R_API char *r_file_slurp_range(const char *str, ut64 off, int sz, int *osz);
|
||||
|
@ -8,6 +8,9 @@
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#if __UNIX__
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
R_API const char *r_file_basename (const char *path) {
|
||||
const char *ptr = strrchr (path, '/');
|
||||
@ -22,7 +25,7 @@ R_API boolt r_file_exist(const char *str) {
|
||||
return (S_ISREG (buf.st_mode))?R_TRUE:R_FALSE;
|
||||
}
|
||||
|
||||
R_API const char *r_file_abspath(const char *file) {
|
||||
R_API char *r_file_abspath(const char *file) {
|
||||
#if __UNIX__
|
||||
if (file[0] != '/')
|
||||
return r_str_dup_printf ("%s/%s", r_sys_getcwd (), file);
|
||||
@ -30,7 +33,7 @@ R_API const char *r_file_abspath(const char *file) {
|
||||
if (!strchr (file, ':'))
|
||||
return r_str_dup_printf ("%s/%s", r_sys_getcwd (), file);
|
||||
#endif
|
||||
return file;
|
||||
return strdup (file);
|
||||
}
|
||||
|
||||
R_API char *r_file_path(const char *bin) {
|
||||
@ -203,3 +206,35 @@ R_API boolt r_file_rm(const char *file) {
|
||||
// TODO: w32 unlink?
|
||||
return (unlink (file)==0)? R_TRUE:R_FALSE;
|
||||
}
|
||||
|
||||
R_API RMmap *r_file_mmap (const char *file) {
|
||||
RMmap *m = NULL;
|
||||
int fd = open (file, O_RDONLY);
|
||||
if (fd != -1) {
|
||||
m = R_NEW (RMmap);
|
||||
m->fd = fd;
|
||||
m->len = lseek (fd, (off_t)0, SEEK_END);
|
||||
#if __UNIX__
|
||||
m->buf = mmap (NULL, m->len, PROT_READ, MAP_SHARED, fd, (off_t)0);
|
||||
#else
|
||||
m->buf = malloc (m->len);
|
||||
if (m->buf) {
|
||||
lseek (fd, (off_t)0, SEEK_SET);
|
||||
read (fd, m->buf, m->len);
|
||||
} else {
|
||||
free (m);
|
||||
m = NULL;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return m;
|
||||
}
|
||||
|
||||
R_API void r_file_mmap_free (RMmap *m) {
|
||||
#if __UNIX__
|
||||
munmap (m->buf, m->len);
|
||||
// TODO: Implement Mumap in w32
|
||||
#endif
|
||||
close (m->fd);
|
||||
free (m);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user