From e151425087b6c0ee8c4d099bfc2d6d1268201db0 Mon Sep 17 00:00:00 2001 From: Mason Reed Date: Wed, 23 Oct 2024 20:47:31 -0400 Subject: Add WARP integration https://github.com/Vector35/warp/ --- plugins/warp/src/plugin/copy.rs | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 plugins/warp/src/plugin/copy.rs (limited to 'plugins/warp/src/plugin/copy.rs') diff --git a/plugins/warp/src/plugin/copy.rs b/plugins/warp/src/plugin/copy.rs new file mode 100644 index 00000000..ee91fb4a --- /dev/null +++ b/plugins/warp/src/plugin/copy.rs @@ -0,0 +1,35 @@ +use binaryninja::binaryview::BinaryView; +use binaryninja::command::FunctionCommand; +use binaryninja::function::Function; + +use crate::cache::cached_function_guid; + +pub struct CopyFunctionGUID; + +impl FunctionCommand for CopyFunctionGUID { + fn action(&self, _view: &BinaryView, func: &Function) { + let Ok(llil) = func.low_level_il() else { + log::error!("Could not get low level il for copied function"); + return; + }; + if let Some(guid) = cached_function_guid(func, &llil) { + log::info!( + "Function GUID for {}... {}", + func.symbol().short_name().to_string(), + guid + ); + if let Ok(mut clipboard) = arboard::Clipboard::new() { + let _ = clipboard.set_text(guid.to_string()); + } + } else { + log::error!( + "Failed to create GUID for function... 0x{:0x}", + func.start() + ); + } + } + + fn valid(&self, _view: &BinaryView, _func: &Function) -> bool { + true + } +} -- cgit v1.3.1