diff options
Diffstat (limited to 'plugins/warp/src/plugin/copy.rs')
| -rw-r--r-- | plugins/warp/src/plugin/copy.rs | 35 |
1 files changed, 35 insertions, 0 deletions
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 + } +} |
