diff options
| author | Mason Reed <mason@vector35.com> | 2024-10-23 20:47:31 -0400 |
|---|---|---|
| committer | Mason Reed <mason@vector35.com> | 2024-10-24 17:03:11 -0400 |
| commit | e151425087b6c0ee8c4d099bfc2d6d1268201db0 (patch) | |
| tree | 25160cf81aa6d650cf1497a078acc50f0062757c /plugins/warp/src/plugin/workflow.rs | |
| parent | 0f53c21d6a7abbfd48fd59ec7c15586f02777b7e (diff) | |
Add WARP integration
https://github.com/Vector35/warp/
Diffstat (limited to 'plugins/warp/src/plugin/workflow.rs')
| -rw-r--r-- | plugins/warp/src/plugin/workflow.rs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/plugins/warp/src/plugin/workflow.rs b/plugins/warp/src/plugin/workflow.rs new file mode 100644 index 00000000..da8473f0 --- /dev/null +++ b/plugins/warp/src/plugin/workflow.rs @@ -0,0 +1,38 @@ +use crate::matcher::cached_function_match; +use binaryninja::llil; +use binaryninja::workflow::{Activity, AnalysisContext, Workflow}; + +const MATCHER_ACTIVITY_NAME: &str = "analysis.plugins.WARPMatcher"; +// NOTE: runOnce is off because previously matched functions need info applied. +const MATCHER_ACTIVITY_CONFIG: &str = r#"{ + "name": "analysis.plugins.WARPMatcher", + "title" : "WARP Matcher", + "description": "This analysis step applies WARP info to matched functions...", + "eligibility": { + "auto": { "default": true }, + "runOnce": false + } +}"#; + +pub fn insert_matcher_workflow() { + let matcher_activity = |ctx: &AnalysisContext| { + let function = ctx.function(); + if function.has_user_annotations() { + // User has touched the function, stop trying to match on it! + return; + } + + if let Some(llil) = unsafe { ctx.llil_function::<llil::NonSSA<llil::RegularNonSSA>>() } { + cached_function_match(&function, &llil); + } + }; + + let meta_workflow = Workflow::new_from_copy("core.function.metaAnalysis"); + let activity = Activity::new_with_action(MATCHER_ACTIVITY_CONFIG, matcher_activity); + meta_workflow.register_activity(&activity).unwrap(); + meta_workflow.insert( + "core.function.runFunctionRecognizers", + [MATCHER_ACTIVITY_NAME], + ); + meta_workflow.register().unwrap(); +} |
