summaryrefslogtreecommitdiff
path: root/plugins/warp/src/plugin/copy.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2024-10-23 20:47:31 -0400
committerMason Reed <mason@vector35.com>2024-10-24 17:03:11 -0400
commite151425087b6c0ee8c4d099bfc2d6d1268201db0 (patch)
tree25160cf81aa6d650cf1497a078acc50f0062757c /plugins/warp/src/plugin/copy.rs
parent0f53c21d6a7abbfd48fd59ec7c15586f02777b7e (diff)
Add WARP integration
https://github.com/Vector35/warp/
Diffstat (limited to 'plugins/warp/src/plugin/copy.rs')
-rw-r--r--plugins/warp/src/plugin/copy.rs35
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
+ }
+}