bin.strpurge: added support to prevent string purge by prev entries (addr range) (#9225)

This commit is contained in:
Khairul Azhar Kasmiran 2018-01-21 23:40:37 +08:00 committed by radare
parent bf1fb2d31f
commit 38a6cc2ff7
2 changed files with 10 additions and 9 deletions

View File

@ -215,6 +215,10 @@ R_API bool r_core_bin_strpurge(RCore *core, const char *str, ut64 refaddr) {
purge = true;
continue;
}
if (*ptr == '!') {
bang = true;
ptr++;
}
range_sep = strchr (ptr, '-');
if (range_sep) {
*range_sep = 0;
@ -222,14 +226,10 @@ R_API bool r_core_bin_strpurge(RCore *core, const char *str, ut64 refaddr) {
ptr = range_sep + 1;
to = r_num_get (NULL, ptr);
if (refaddr >= from && refaddr <= to) {
purge = true;
purge = bang ? false : true;
continue;
}
}
if (*ptr == '!') {
bang = true;
ptr++;
}
addr = r_num_get (NULL, ptr);
if (addr != 0 || *ptr == '0') {
if (refaddr == addr) {

View File

@ -2391,10 +2391,11 @@ R_API int r_core_config_init(RCore *core) {
SETOPTIONS (n, "latin1", "utf8", "utf16le", "utf32le", "guess", NULL);
SETCB ("bin.usextr", "true", &cb_usextr, "Use extract plugins when loading files");
SETCB ("bin.useldr", "true", &cb_useldr, "Use loader plugins when loading files");
SETCB ("bin.strpurge", "", &cb_strpurge, "Try to purge false positive strings (true: use the "
"false_positive() classifier in cbin.c, [,addr]*: specific string addrs to purge, "
"[,addr1-addr2]*: purge all strings in the range addr1-addr2 inclusive, [,!addr]*: prevent "
"purge of string at addr by prev entries)");
SETCB ("bin.strpurge", "", &cb_strpurge, "Purge strings (true: use the false_positive() "
"classifier in cbin.c, [,addr]*: specific string addrs to purge, [,addr1-addr2]*: purge "
"all strings in the range addr1-addr2 inclusive, [,!addr]*: prevent purge of string at "
"addr by prev entries, [,!addr1-addr2]*: prevent purge of strings in range addr1-addr2 "
"inclusive by prev entries). Neither !true nor !false is supported.");
SETPREF ("bin.b64str", "false", "Try to debase64 the strings");
SETPREF ("bin.libs", "false", "Try to load libraries after loading main binary");
n = NODECB ("bin.strfilter", "", &cb_strfilter);