Skip to content

Commit

Permalink
Add yara.va, to override io.va if set to false
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Nov 21, 2024
1 parent 5a135ed commit 7cd56e7
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/core_r2yara.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,10 @@ static int cmd_yara_scan(R2Yara *r2yara, R_NULLABLE const char* option) {

r_flag_space_push (core->flags, "yara");
const size_t to_scan_size = r_io_size (core->io);
r2yara->iova = r_config_get_b (core->config, "io.va");
r2yara->iova = r_config_get_b (core->config, "yara.va");
if (r2yara->iova) {
r2yara->iova = r_config_get_b (core->config, "io.va");
}

if (to_scan_size < 1) {
R_LOG_ERROR ("Invalid file size");
Expand Down Expand Up @@ -801,14 +804,12 @@ static int cmd_yara_load_default_rules(R2Yara *r2yara) {
return false;
}

// Move to r_sys_time_ymd?
static char *yyyymmdd(void) {
time_t current_time;
struct tm *time_info;
char *ds = calloc (16, 1);

time (&current_time);
time_info = localtime (&current_time);

struct tm *time_info = localtime (&current_time);
strftime (ds, 16, "%Y-%m-%d", time_info);
return ds;
}
Expand All @@ -835,6 +836,8 @@ static void setup_config(R2Yara *r2yara) {
r_config_node_desc (node, "YARA rule tags");
node = r_config_set_i (cfg, "yara.amount", 0);
r_config_node_desc (node, "Amount of strings to match (0 means all of them)");
node = r_config_set_b (cfg, "yara.va", true);
r_config_node_desc (node, "Show results in virtual or physical addresses, overrides io.va");
r_config_lock (cfg, true);
}

Expand Down

0 comments on commit 7cd56e7

Please sign in to comment.