diff options
Diffstat (limited to 'plugins/warp/src/plugin')
| -rw-r--r-- | plugins/warp/src/plugin/add.rs | 2 | ||||
| -rw-r--r-- | plugins/warp/src/plugin/copy.rs | 2 | ||||
| -rw-r--r-- | plugins/warp/src/plugin/create.rs | 7 | ||||
| -rw-r--r-- | plugins/warp/src/plugin/find.rs | 7 | ||||
| -rw-r--r-- | plugins/warp/src/plugin/load.rs | 10 | ||||
| -rw-r--r-- | plugins/warp/src/plugin/types.rs | 18 | ||||
| -rw-r--r-- | plugins/warp/src/plugin/workflow.rs | 19 |
7 files changed, 36 insertions, 29 deletions
diff --git a/plugins/warp/src/plugin/add.rs b/plugins/warp/src/plugin/add.rs index 19cf7115..2f76c8b5 100644 --- a/plugins/warp/src/plugin/add.rs +++ b/plugins/warp/src/plugin/add.rs @@ -1,7 +1,7 @@ use crate::cache::{cached_function, cached_type_references}; use crate::matcher::invalidate_function_matcher_cache; use crate::user_signature_dir; -use binaryninja::binaryview::BinaryView; +use binaryninja::binary_view::BinaryView; use binaryninja::command::FunctionCommand; use binaryninja::function::Function; use std::thread; diff --git a/plugins/warp/src/plugin/copy.rs b/plugins/warp/src/plugin/copy.rs index d539a430..18da7dfb 100644 --- a/plugins/warp/src/plugin/copy.rs +++ b/plugins/warp/src/plugin/copy.rs @@ -1,4 +1,4 @@ -use binaryninja::binaryview::BinaryView; +use binaryninja::binary_view::BinaryView; use binaryninja::command::FunctionCommand; use binaryninja::function::Function; diff --git a/plugins/warp/src/plugin/create.rs b/plugins/warp/src/plugin/create.rs index a936074a..4beba195 100644 --- a/plugins/warp/src/plugin/create.rs +++ b/plugins/warp/src/plugin/create.rs @@ -1,7 +1,7 @@ use crate::cache::{cached_function, cached_type_references}; use crate::matcher::invalidate_function_matcher_cache; use crate::user_signature_dir; -use binaryninja::binaryview::{BinaryView, BinaryViewExt}; +use binaryninja::binary_view::{BinaryView, BinaryViewExt}; use binaryninja::command::Command; use binaryninja::function::Function; use binaryninja::rc::Guard; @@ -30,11 +30,10 @@ impl Command for CreateSignatureFile { thread::spawn(move || { let total_functions = view.functions().len(); let done_functions = AtomicUsize::default(); - let background_task = binaryninja::backgroundtask::BackgroundTask::new( + let background_task = binaryninja::background_task::BackgroundTask::new( format!("Generating signatures... ({}/{})", 0, total_functions), true, - ) - .unwrap(); + ); let start = Instant::now(); diff --git a/plugins/warp/src/plugin/find.rs b/plugins/warp/src/plugin/find.rs index f54b4a4c..b2102e5e 100644 --- a/plugins/warp/src/plugin/find.rs +++ b/plugins/warp/src/plugin/find.rs @@ -1,5 +1,5 @@ use crate::cache::try_cached_function_guid; -use binaryninja::binaryview::{BinaryView, BinaryViewExt}; +use binaryninja::binary_view::{BinaryView, BinaryViewExt}; use binaryninja::command::Command; use binaryninja::function::Function as BNFunction; use binaryninja::rc::Guard as BNGuard; @@ -26,11 +26,10 @@ impl Command for FindFunctionFromGUID { log::info!("Searching functions for GUID... {}", searched_guid); let funcs = view.functions(); thread::spawn(move || { - let background_task = binaryninja::backgroundtask::BackgroundTask::new( + let background_task = binaryninja::background_task::BackgroundTask::new( format!("Searching functions for GUID... {}", searched_guid), false, - ) - .unwrap(); + ); // Only run this for functions which have already generated a GUID. let matched = funcs diff --git a/plugins/warp/src/plugin/load.rs b/plugins/warp/src/plugin/load.rs index 03356444..c86a16cb 100644 --- a/plugins/warp/src/plugin/load.rs +++ b/plugins/warp/src/plugin/load.rs @@ -1,5 +1,5 @@ use crate::matcher::{Matcher, PlatformID, PLAT_MATCHER_CACHE}; -use binaryninja::binaryview::{BinaryView, BinaryViewExt}; +use binaryninja::binary_view::{BinaryView, BinaryViewExt}; use binaryninja::command::Command; pub struct LoadSignatureFile; @@ -10,8 +10,12 @@ impl Command for LoadSignatureFile { return; }; - let Some(file) = - binaryninja::interaction::get_open_filename_input("Load Signature File", "*.sbin") + // NOTE: Because we only can consume signatures from a specific directory, we don't need to use the interaction API. + // If we did need to load signature files from a project than this would need to change. + let Some(file) = rfd::FileDialog::new() + .add_filter("Signature Files", &["sbin"]) + .set_file_name(format!("{}.sbin", view.file().filename())) + .pick_file() else { return; }; diff --git a/plugins/warp/src/plugin/types.rs b/plugins/warp/src/plugin/types.rs index fb030bfe..057d5f98 100644 --- a/plugins/warp/src/plugin/types.rs +++ b/plugins/warp/src/plugin/types.rs @@ -1,5 +1,5 @@ use crate::convert::to_bn_type; -use binaryninja::binaryview::{BinaryView, BinaryViewExt}; +use binaryninja::binary_view::{BinaryView, BinaryViewExt}; use binaryninja::command::Command; use std::time::Instant; @@ -7,10 +7,13 @@ pub struct LoadTypes; impl Command for LoadTypes { fn action(&self, view: &BinaryView) { - let Some(file) = binaryninja::interaction::get_open_filename_input( - "Apply Signature File Types", - "*.sbin", - ) else { + // NOTE: Because we only can consume signatures from a specific directory, we don't need to use the interaction API. + // If we did need to load signature files from a project than this would need to change. + let Some(file) = rfd::FileDialog::new() + .add_filter("Signature Files", &["sbin"]) + .set_file_name(format!("{}.sbin", view.file().filename())) + .pick_file() + else { return; }; @@ -31,11 +34,10 @@ impl Command for LoadTypes { let view = view.to_owned(); std::thread::spawn(move || { - let background_task = binaryninja::backgroundtask::BackgroundTask::new( + let background_task = binaryninja::background_task::BackgroundTask::new( format!("Applying {} types...", data.types.len()), true, - ) - .unwrap(); + ); let start = Instant::now(); for comp_ty in data.types { diff --git a/plugins/warp/src/plugin/workflow.rs b/plugins/warp/src/plugin/workflow.rs index bcd19f47..fbd50dc8 100644 --- a/plugins/warp/src/plugin/workflow.rs +++ b/plugins/warp/src/plugin/workflow.rs @@ -1,9 +1,9 @@ use crate::cache::cached_function_guid; use crate::matcher::cached_function_matcher; -use binaryninja::backgroundtask::BackgroundTask; -use binaryninja::binaryview::{BinaryView, BinaryViewExt}; +use binaryninja::background_task::BackgroundTask; +use binaryninja::binary_view::{BinaryView, BinaryViewExt}; use binaryninja::command::Command; -use binaryninja::llil; +use binaryninja::low_level_il::function::RegularNonSSA; use binaryninja::workflow::{Activity, AnalysisContext, Workflow}; use std::time::Instant; @@ -37,7 +37,7 @@ impl Command for RunMatcher { // 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 undo_id = view.file().begin_undo_actions(true); - let background_task = BackgroundTask::new("Matching on functions...", false).unwrap(); + let background_task = BackgroundTask::new("Matching on functions...", false); let start = Instant::now(); view.functions() .iter() @@ -59,7 +59,7 @@ pub fn insert_workflow() { let matcher_activity = |ctx: &AnalysisContext| { let view = ctx.view(); let undo_id = view.file().begin_undo_actions(true); - let background_task = BackgroundTask::new("Matching on functions...", false).unwrap(); + let background_task = BackgroundTask::new("Matching on functions...", false); let start = Instant::now(); view.functions() .iter() @@ -73,12 +73,14 @@ pub fn insert_workflow() { let guid_activity = |ctx: &AnalysisContext| { let function = ctx.function(); - if let Some(llil) = unsafe { ctx.llil_function::<llil::NonSSA<llil::RegularNonSSA>>() } { + // TODO: Returning RegularNonSSA means we cant modify the il (the lifting code was written just for lifted il, that needs to be fixed) + if let Some(llil) = unsafe { ctx.llil_function::<RegularNonSSA>() } { cached_function_guid(&function, &llil); } }; - let function_meta_workflow = Workflow::new_from_copy("core.function.metaAnalysis"); + let old_function_meta_workflow = Workflow::instance("core.function.metaAnalysis"); + let function_meta_workflow = old_function_meta_workflow.clone("core.function.metaAnalysis"); let guid_activity = Activity::new_with_action(GUID_ACTIVITY_CONFIG, guid_activity); function_meta_workflow .register_activity(&guid_activity) @@ -86,7 +88,8 @@ pub fn insert_workflow() { function_meta_workflow.insert("core.function.runFunctionRecognizers", [GUID_ACTIVITY_NAME]); function_meta_workflow.register().unwrap(); - let module_meta_workflow = Workflow::new_from_copy("core.module.metaAnalysis"); + let old_module_meta_workflow = Workflow::instance("core.module.metaAnalysis"); + let module_meta_workflow = old_module_meta_workflow.clone("core.module.metaAnalysis"); let matcher_activity = Activity::new_with_action(MATCHER_ACTIVITY_CONFIG, matcher_activity); module_meta_workflow .register_activity(&matcher_activity) |
