From 9c2667464b4e20cfea11cb8d3447f92f51db7440 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Fri, 13 Dec 2024 15:17:54 -0500 Subject: WARP: User friendly file picker Instead of using the interaction api or text input just use a rust crate to manage the file picker dialog --- plugins/warp/src/lib.rs | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'plugins/warp/src/lib.rs') diff --git a/plugins/warp/src/lib.rs b/plugins/warp/src/lib.rs index 1b4f70a0..dee5d26b 100644 --- a/plugins/warp/src/lib.rs +++ b/plugins/warp/src/lib.rs @@ -1,8 +1,9 @@ +use std::path::PathBuf; use binaryninja::architecture::{ Architecture, ImplicitRegisterExtend, Register as BNRegister, RegisterInfo, }; use binaryninja::basicblock::BasicBlock as BNBasicBlock; -use binaryninja::binaryview::BinaryViewExt; +use binaryninja::binaryview::{BinaryView, BinaryViewExt}; use binaryninja::function::{Function as BNFunction, NativeBlock}; use binaryninja::llil; use binaryninja::llil::{ @@ -25,6 +26,24 @@ mod matcher; /// Only used when compiled for cdylib target. mod plugin; +pub fn core_signature_dir() -> PathBuf { + // Get core signatures for the given platform + let install_dir = binaryninja::install_directory().unwrap(); + // macOS core dir is separate from the install dir. + #[cfg(target_os = "macos")] + let core_dir = install_dir + .parent() + .unwrap() + .join("Resources"); + #[cfg(not(target_os = "macos"))] + let core_dir = install_dir; + core_dir.join("signatures") +} + +pub fn user_signature_dir() -> PathBuf { + binaryninja::user_directory().unwrap().join("signatures/") +} + pub fn build_function( func: &BNFunction, llil: &llil::Function>, -- cgit v1.3.1