This commit is contained in:
Maijin 2018-08-01 22:27:19 +02:00 committed by GitHub
parent 5aced3c295
commit 6eda76e0f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 1 deletions

View File

@ -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;

View File

@ -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,