diff options
| author | Mason Reed <mason@vector35.com> | 2024-11-07 16:46:23 -0500 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2024-11-08 03:13:53 -0500 |
| commit | d6e1624cff2b5d5eac57e0bf99ca1dac8437f9a5 (patch) | |
| tree | 67fe0dca1dc9981f6585285df42f4389960b6e0e /plugins/warp/src/plugin | |
| parent | 0bafdd69f36841090eb584abe1efc5b8f55927ed (diff) | |
WARP: Find command shouldn't generate new GUID's
Diffstat (limited to 'plugins/warp/src/plugin')
| -rw-r--r-- | plugins/warp/src/plugin/find.rs | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/plugins/warp/src/plugin/find.rs b/plugins/warp/src/plugin/find.rs index 7eb0ab38..15a06add 100644 --- a/plugins/warp/src/plugin/find.rs +++ b/plugins/warp/src/plugin/find.rs @@ -1,11 +1,12 @@ +use crate::cache::try_cached_function_guid; use binaryninja::binaryview::{BinaryView, BinaryViewExt}; use binaryninja::command::Command; +use binaryninja::function::Function as BNFunction; +use binaryninja::rc::Guard as BNGuard; use rayon::prelude::*; use std::thread; use warp::signature::function::FunctionGUID; -use crate::cache::cached_function_guid; - pub struct FindFunctionFromGUID; impl Command for FindFunctionFromGUID { @@ -31,21 +32,18 @@ impl Command for FindFunctionFromGUID { ) .unwrap(); + // Only run this for functions which have already generated a GUID. let matched = funcs .par_iter() - .filter_map(|func| { - Some(( - func.clone(), - cached_function_guid(&func, func.low_level_il_if_available()?.as_ref()), - )) + .filter(|func| { + try_cached_function_guid(&func).is_some_and(|guid| guid == searched_guid) }) - .filter(|(_func, guid)| guid.eq(&searched_guid)) - .collect::<Vec<_>>(); + .collect::<Vec<BNGuard<BNFunction>>>(); if matched.is_empty() { log::info!("No matches found for GUID... {}", searched_guid); } else { - for (func, _) in matched { + for func in matched { log::info!("Match found at function... 0x{:0x}", func.start()); } } |
