diff options
| author | Mason Reed <mason@vector35.com> | 2024-10-30 14:33:57 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2024-10-30 15:40:40 -0400 |
| commit | 27acd49fc745297adc9101146fd6d64054251ce4 (patch) | |
| tree | fcfcb6ff07e6120ebfc1df567a1fdf7a605ba803 /plugins/warp/src/plugin | |
| parent | acd2dc49cea61e59b9dd7e1a5415cc36cdab1844 (diff) | |
WARP: Add more debug commands and manually invoke the matcher
Diffstat (limited to 'plugins/warp/src/plugin')
| -rw-r--r-- | plugins/warp/src/plugin/workflow.rs | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/plugins/warp/src/plugin/workflow.rs b/plugins/warp/src/plugin/workflow.rs index bd47c117..ee224df8 100644 --- a/plugins/warp/src/plugin/workflow.rs +++ b/plugins/warp/src/plugin/workflow.rs @@ -1,10 +1,11 @@ use crate::cache::cached_function_guid; use crate::matcher::cached_function_matcher; use binaryninja::backgroundtask::BackgroundTask; -use binaryninja::binaryview::BinaryViewExt; +use binaryninja::binaryview::{BinaryView, BinaryViewExt}; use binaryninja::llil; use binaryninja::workflow::{Activity, AnalysisContext, Workflow}; use std::time::Instant; +use binaryninja::command::Command; const MATCHER_ACTIVITY_NAME: &str = "analysis.plugins.warp.matcher"; // NOTE: runOnce is off because previously matched functions need info applied. @@ -29,6 +30,29 @@ const GUID_ACTIVITY_CONFIG: &str = r#"{ } }"#; +pub struct RunMatcher; + +impl Command for RunMatcher { + fn action(&self, view: &BinaryView) { + let view = view.to_owned(); + log::info!("Re-running matcher for {:?}", view); + // TODO: Check to see if the GUID cache is empty and ask the user if they want to regenerate the guids. + std::thread::spawn(move || { + let background_task = BackgroundTask::new("Matching on functions...", false).unwrap(); + let start = Instant::now(); + view.functions() + .iter() + .for_each(|function| cached_function_matcher(&function)); + log::info!("Function matching took {:?}", start.elapsed()); + background_task.finish(); + }); + } + + fn valid(&self, _view: &BinaryView) -> bool { + true + } +} + pub fn insert_workflow() { let matcher_activity = |ctx: &AnalysisContext| { let view = ctx.view(); |
