mirror of
https://github.com/radareorg/radare2.git
synced 2024-11-28 15:41:38 +00:00
bin.strpurge: added support for ranges (#9215)
This commit is contained in:
parent
89c309a900
commit
9f258ebe1b
@ -206,12 +206,24 @@ R_API bool r_core_bin_strpurge(RCore *core, const char *str, ut64 refaddr) {
|
||||
int splits = r_str_split (addrs, ',');
|
||||
int i;
|
||||
char *ptr;
|
||||
ut64 addr;
|
||||
char *range_sep;
|
||||
ut64 addr, from, to;
|
||||
for (i = 0, ptr = addrs; i < splits; i++, ptr += strlen (ptr) + 1) {
|
||||
if (!strcmp (ptr, "true") && false_positive (str)) {
|
||||
free (addrs);
|
||||
return true;
|
||||
}
|
||||
range_sep = strchr (ptr, '-');
|
||||
if (range_sep) {
|
||||
*range_sep = 0;
|
||||
from = r_num_get (NULL, ptr);
|
||||
ptr = range_sep + 1;
|
||||
to = r_num_get (NULL, ptr);
|
||||
if (refaddr >= from && refaddr <= to) {
|
||||
free (addrs);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
addr = r_num_get (NULL, ptr);
|
||||
if (addr != 0 || *ptr == '0') {
|
||||
if (refaddr == addr) {
|
||||
|
@ -2391,7 +2391,8 @@ R_API int r_core_config_init(RCore *core) {
|
||||
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 addresses to purge)");
|
||||
"false_positive() classifier in cbin.c, [,addr]*: specific string addresses to purge, "
|
||||
"[,addr1-addr2]*: purge all strings in the range addr1-addr2 inclusive)");
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user