diff --git a/libr/core/cmd_anal.c b/libr/core/cmd_anal.c index eaa1e417a7..8b9b809c4e 100644 --- a/libr/core/cmd_anal.c +++ b/libr/core/cmd_anal.c @@ -5018,7 +5018,6 @@ static int cmd_anal(void *data, const char *input) { "ai", " [addr]", "address information (show perms, stack, heap, ...)", "ao", "[e?] [len]", "analyze Opcodes (or emulate it)", "aO", "", "Analyze N instructions in M bytes", - "an", "[an-] [...]", "manage no-return addresses/symbols/functions", "ar", "", "like 'dr' but for the esil vm. (registers)", "ap", "", "find prelude for current offset", "ax", "[?ld-*]", "manage refs/xrefs (see also afx?)", diff --git a/libr/core/cmd_help.c b/libr/core/cmd_help.c index 1db88490de..56b0263fd9 100644 --- a/libr/core/cmd_help.c +++ b/libr/core/cmd_help.c @@ -789,15 +789,15 @@ static int cmd_help(void *data, const char *input) { "/","", "Search for bytes, regexps, patterns, ..", "!"," [cmd]", "Run given command as in system(3)", "#","!lang [..]", "Hashbang to run an rlang script", - "a","[?]", "Perform analysis of code", - "b","[?]", "Get or change block size", + "a","[?]", "Analysis commands", + "b","[?]", "Display or change the block size", "c","[?] [arg]", "Compare block with given data", - "C","[?]", "Code metadata management", + "C","[?]", "Code metadata (comments, format, hints, ..)", "d","[?]", "Debugger commands", "e"," [a[=b]]", "List/get/set config evaluable vars", - "f"," [name][sz][at]", "Set flag at current address", - "g"," [arg]", "Go compile shellcodes with r_egg", - "i","[?] [file]", "Get info about opened file", + "f"," [name][sz][at]", "Add flag at current address", + "g"," [arg]", "Generate shellcodes with r_egg", + "i","[?] [file]", "Get info about opened file from r_bin", "k","[?] [sdb-query]", "Run sdb-query. see k? for help, 'k *', 'k **' ...", "m","", "Mountpoints commands", "o","[?] [file] ([offset])", "Open file at optional address", @@ -807,10 +807,10 @@ static int cmd_help(void *data, const char *input) { "r","[?] [len]", "Resize file", "s","[?] [addr]", "Seek to address (also for '0x', '0x1' == 's 0x1')", "S","[?]", "Io section manipulation information", - "t","[?]", "Cparse types management", + "t","[?]", "Types, noreturn, signatures, C parser and more", "T","[?] [-] [num|msg]", "Text log utility", "u","[?]", "uname/undo seek/write", - "V","", "Enter visual mode (vcmds=visualvisual keystrokes)", + "V","", "Enter visual mode (V! = panels, VV = fcngraph, VVV = callgraph)", "w","[?] [str]", "Multiple write operations", "x","[?] [len]", "Alias for 'px' (print hexadecimal)", "y","[?] [len] [[[@]addr", "Yank/paste bytes from/to memory", diff --git a/libr/core/cmd_print.c b/libr/core/cmd_print.c index 1c73be960e..204b3febef 100644 --- a/libr/core/cmd_print.c +++ b/libr/core/cmd_print.c @@ -2427,21 +2427,23 @@ static int cmd_print(void *data, const char *input) { r_cons_printf ("0x%"PFMT64x" [", from); } + bool use_color = r_config_get_i (core->config, "scr.color"); len = 0; - for (i=0; iblock[p].flags) || (as->block[p].functions) || (as->block[p].comments) || (as->block[p].imports) || (as->block[p].symbols) - || (as->block[p].strings)) + || (as->block[p].strings)) { r_cons_printf ("\"offset\":%"PFMT64d",", at), l++; + } // TODO: simplify with macro l = 0; if (as->block[p].flags) r_cons_printf ("%s\"flags\":%d", l?",":"", as->block[p].flags), l++; @@ -2465,7 +2467,7 @@ static int cmd_print(void *data, const char *input) { || (as->block[p].comments) || (as->block[p].imports) || (as->block[p].symbols) - || (as->block[p].strings)) + || (as->block[p].strings)) { r_cons_printf ("| 0x%09"PFMT64x" | %4d %4d %4d %4d %4d %4d |\n", at, as->block[p].flags, as->block[p].functions, @@ -2473,41 +2475,59 @@ static int cmd_print(void *data, const char *input) { as->block[p].imports, as->block[p].symbols, as->block[p].strings); + } break; default: if (off>=at && offblock[p].strings>0) + RIOSection *s = r_io_section_vget (core->io, at); + if (use_color) { + if (s) { + if (s->rwx & 1) { + r_cons_print (Color_BGBLUE); + } else { + r_cons_print (Color_BGGREEN); + } + } else { + r_cons_print (Color_BGRED); + } + } + if (as->block[p].strings > 0) { r_cons_memcat ("z", 1); - else if (as->block[p].imports>0) + } else if (as->block[p].imports>0) { r_cons_memcat ("i", 1); - else if (as->block[p].symbols>0) + } else if (as->block[p].symbols>0) { r_cons_memcat ("s", 1); - else if (as->block[p].functions>0) + } else if (as->block[p].functions>0) { r_cons_memcat ("F", 1); - else if (as->block[p].flags>0) - r_cons_memcat ("f", 1); - else if (as->block[p].comments>0) + } else if (as->block[p].comments > 0) { r_cons_memcat ("c", 1); - else r_cons_memcat (".", 1); + } else if (as->block[p].flags > 3) { + r_cons_memcat ("f", 1); + } else { + r_cons_memcat (".", 1); + } } break; } } + if (use_color) { + r_cons_print (Color_RESET); + } switch (mode) { - case 'j': - r_cons_strcat ("]}\n"); - break; - case 'h': - //r_cons_printf (" total | flags funcs cmts imps syms str |\n"); - r_cons_printf ("|-------------)---------------------------------|\n"); - r_cons_printf ("| total | %4d %4d %4d %4d %4d %4d |\n", - total[0], total[1], total[2], total[3], total[4], total[5]); - r_cons_printf ("`-------------'---------------------------------'\n"); - break; - default: - r_cons_printf ("] 0x%"PFMT64x"\n", to); + case 'j': + r_cons_strcat ("]}\n"); + break; + case 'h': + //r_cons_printf (" total | flags funcs cmts imps syms str |\n"); + r_cons_printf ("|-------------)---------------------------------|\n"); + r_cons_printf ("| total | %4d %4d %4d %4d %4d %4d |\n", + total[0], total[1], total[2], total[3], total[4], total[5]); + r_cons_printf ("`-------------'---------------------------------'\n"); + break; + default: + r_cons_printf ("] 0x%"PFMT64x"\n", to); } r_core_anal_stats_free (as); break; diff --git a/libr/include/r_io.h b/libr/include/r_io.h index 940f5497de..682cb8f8fe 100644 --- a/libr/include/r_io.h +++ b/libr/include/r_io.h @@ -387,7 +387,6 @@ R_API void r_io_section_free(void *ptr); R_API RIOSection *r_io_section_add(RIO *io, ut64 offset, ut64 vaddr, ut64 size, ut64 vsize, int rwx, const char *name, ut32 bin_id, int fd); R_API RIOSection *r_io_section_get_name(RIO *io, const char *name); R_API RIOSection *r_io_section_get_i(RIO *io, int idx); -R_API RIOSection *r_io_section_getv(RIO *io, ut64 vaddr); R_API RIOSection *r_io_section_mget_in(RIO *io, ut64 maddr); R_API RIOSection *r_io_section_mget_prev(RIO *io, ut64 maddr); R_API RIOSection *r_io_section_vget(RIO *io, ut64 addr);