diff --git a/binr/rafind2/rafind2.c b/binr/rafind2/rafind2.c index 0b45fd0d72..1bac12ec94 100644 --- a/binr/rafind2/rafind2.c +++ b/binr/rafind2/rafind2.c @@ -166,6 +166,15 @@ static int rafind_open_file(char *file) { free (tostr); return 0; } + if (mode == R_SEARCH_ESIL) { + char *cmd; + r_list_foreach (keywords, iter, kw) { + cmd = r_str_newf ("r2 -qc \"/E %s\" %s", kw, file); + r_sandbox_system (cmd, 1); + free (cmd); + } + return 0; + } if (mode == R_SEARCH_KEYWORD) { r_list_foreach (keywords, iter, kw) { if (hexstr) { @@ -248,7 +257,7 @@ int main(int argc, char **argv) { int c; keywords = r_list_new (); - while ((c = getopt (argc, argv, "a:ie:b:mM:s:S:x:Xzf:t:rqnhvZ")) != -1) { + while ((c = getopt (argc, argv, "a:ie:b:mM:s:S:x:Xzf:t:E:rqnhvZ")) != -1) { switch (c) { case 'a': align = r_num_math (NULL, optarg); @@ -270,6 +279,10 @@ int main(int argc, char **argv) { hexstr = 0; r_list_append (keywords, optarg); break; + case 'E': + mode = R_SEARCH_ESIL; + r_list_append (keywords, optarg); + break; case 's': mode = R_SEARCH_KEYWORD; hexstr = 0; diff --git a/libr/include/r_search.h b/libr/include/r_search.h index 4ba76824d6..9f67abd52a 100644 --- a/libr/include/r_search.h +++ b/libr/include/r_search.h @@ -13,6 +13,7 @@ extern "C" { R_LIB_VERSION_HEADER(r_search); enum { + R_SEARCH_ESIL, R_SEARCH_KEYWORD, R_SEARCH_REGEXP, R_SEARCH_PATTERN,