From 5b86b891ca460010cf2fa56805c141872eef3412 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Tue, 12 Nov 2024 15:30:33 -0500 Subject: WARP: Run `cargo fmt` --- plugins/warp/src/bin/sigem.rs | 20 +++++++++++--------- plugins/warp/src/convert.rs | 2 +- plugins/warp/src/plugin.rs | 2 +- plugins/warp/src/plugin/create.rs | 6 ++---- 4 files changed, 15 insertions(+), 15 deletions(-) (limited to 'plugins') diff --git a/plugins/warp/src/bin/sigem.rs b/plugins/warp/src/bin/sigem.rs index f13b56f4..69193404 100644 --- a/plugins/warp/src/bin/sigem.rs +++ b/plugins/warp/src/bin/sigem.rs @@ -10,10 +10,10 @@ use rayon::prelude::*; use binaryninja::binaryview::{BinaryView, BinaryViewExt}; use binaryninja::function::Function as BNFunction; use binaryninja::rc::Guard as BNGuard; +use binaryninja::settings::Settings; use serde_json::{json, Value}; use walkdir::WalkDir; use warp::signature::Data; -use binaryninja::settings::Settings; use warp_ninja::cache::{cached_type_references, register_cache_destructor}; #[derive(Parser, Debug)] @@ -55,13 +55,13 @@ fn default_settings(bn_settings: &Settings) -> Value { "analysis.signatureMatcher.autorun": false, "analysis.mode": "full", }); - + // If WARP is enabled we must turn it off to prevent matching on other stuff. if bn_settings.contains("analysis.warp.matcher") { settings["analysis.warp.matcher"] = json!(false); settings["analysis.warp.guid"] = json!(false); } - + settings } @@ -70,7 +70,10 @@ fn main() { env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")).init(); // If no output file was given, just prepend binary with extension sbin - let output_file = args.output.unwrap_or(args.path.to_owned()).with_extension("sbin"); + let output_file = args + .output + .unwrap_or(args.path.to_owned()) + .with_extension("sbin"); if output_file.exists() && !args.overwrite.unwrap_or(false) { log::info!("Output file already exists, skipping... {:?}", output_file); @@ -93,7 +96,7 @@ fn main() { // Make sure caches are flushed when the views get destructed. register_cache_destructor(); - + let settings = default_settings(&bn_settings); log::info!("Creating functions for {:?}...", args.path); @@ -143,7 +146,7 @@ fn data_from_view(view: &BinaryView) -> Data { data.types.extend(referenced_types); } - + data } @@ -181,7 +184,7 @@ fn data_from_archive(settings: &Value, mut archive: Archive) -> Opti data_from_file(settings, &path) }) .collect::>(); - + Some(Data::merge(entry_data)) } @@ -228,8 +231,7 @@ fn data_from_file(settings: &Value, path: &Path) -> Option { _ if path.is_dir() => data_from_directory(settings, path.into()), _ => { let path_str = path.to_str().unwrap(); - let view = - binaryninja::load_with_options(path_str, true, Some(settings.to_string()))?; + let view = binaryninja::load_with_options(path_str, true, Some(settings.to_string()))?; let data = data_from_view(&view); view.file().close(); Some(data) diff --git a/plugins/warp/src/convert.rs b/plugins/warp/src/convert.rs index 6f2bf7e3..8240123d 100644 --- a/plugins/warp/src/convert.rs +++ b/plugins/warp/src/convert.rs @@ -1,7 +1,7 @@ use std::collections::HashSet; -use binaryninja::architecture::ArchitectureExt; use binaryninja::architecture::Architecture as BNArchitecture; +use binaryninja::architecture::ArchitectureExt; use binaryninja::binaryview::{BinaryView, BinaryViewExt}; use binaryninja::callingconvention::CallingConvention as BNCallingConvention; use binaryninja::rc::Ref as BNRef; diff --git a/plugins/warp/src/plugin.rs b/plugins/warp/src/plugin.rs index 7ae78c02..a372a87f 100644 --- a/plugins/warp/src/plugin.rs +++ b/plugins/warp/src/plugin.rs @@ -11,11 +11,11 @@ use crate::{build_function, cache}; use binaryninja::binaryview::{BinaryView, BinaryViewExt}; use binaryninja::command::{Command, FunctionCommand}; use binaryninja::function::{Function, FunctionUpdateType}; +use binaryninja::logger::Logger; use binaryninja::rc::Ref; use binaryninja::tags::TagType; use binaryninja::ObjectDestructor; use warp::signature::function::Function as WarpFunction; -use binaryninja::logger::Logger; mod copy; mod create; diff --git a/plugins/warp/src/plugin/create.rs b/plugins/warp/src/plugin/create.rs index 0792e6dc..dd21bd8f 100644 --- a/plugins/warp/src/plugin/create.rs +++ b/plugins/warp/src/plugin/create.rs @@ -1,5 +1,4 @@ use crate::cache::{cached_function, cached_type_references}; -use crate::convert::from_bn_type; use crate::matcher::invalidate_function_matcher_cache; use binaryninja::binaryview::{BinaryView, BinaryViewExt}; use binaryninja::command::Command; @@ -7,7 +6,6 @@ use rayon::prelude::*; use std::io::Write; use std::thread; use std::time::Instant; -use warp::r#type::ComputedType; pub struct CreateSignatureFile; @@ -36,7 +34,7 @@ impl Command for CreateSignatureFile { let llil = func.low_level_il().ok()?; Some(cached_function(&func, &llil)) })); - + if let Some(ref_ty_cache) = cached_type_references(&view) { let referenced_types = ref_ty_cache .cache @@ -46,7 +44,7 @@ impl Command for CreateSignatureFile { data.types.extend(referenced_types); } - + log::info!("Signature generation took {:?}", start.elapsed()); if let Some(sig_file_name) = binaryninja::interaction::get_text_line_input( -- cgit v1.3.1