From d6e1624cff2b5d5eac57e0bf99ca1dac8437f9a5 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Thu, 7 Nov 2024 16:46:23 -0500 Subject: WARP: Find command shouldn't generate new GUID's --- plugins/warp/src/plugin/find.rs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'plugins/warp/src/plugin') 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::>(); + .collect::>>(); 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()); } } -- cgit v1.3.1