Skip to content

Commit

Permalink
fix: default policy expression and manifest file for binary analysis …
Browse files Browse the repository at this point in the history
…plugin
  • Loading branch information
j-lanson committed Oct 30, 2024
1 parent 186ca5d commit b2d4020
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 1 addition & 2 deletions hipcheck/src/plugin/retrieval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ use xz2::read::XzDecoder;
use super::get_current_arch;

/// The plugins currently are not delegated via the `plugin` system and are still part of `hipcheck` core
pub const MITRE_LEGACY_PLUGINS: [&str; 6] = [
pub const MITRE_LEGACY_PLUGINS: [&str; 5] = [
"activity",
"entropy",
"affiliation",
"binary",
"churn",
"typo",
];
Expand Down
8 changes: 4 additions & 4 deletions plugins/binary/plugin.kdl
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name "binary"
version "0.1.0"
license "Apache-2.0"
entrypoint {
on arch="aarch64-apple-darwin" "./hc-mitre-binary"
on arch="x86_64-apple-darwin" "./hc-mitre-binary"
on arch="x86_64-unknown-linux-gnu" "./hc-mitre-binary"
on arch="x86_64-pc-windows-msvc" "./hc-mitre-binary"
on arch="aarch64-apple-darwin" "./target/debug/binary"
on arch="x86_64-apple-darwin" "./target/debug/binary"
on arch="x86_64-unknown-linux-gnu" "./target/debug/binary"
on arch="x86_64-pc-windows-msvc" "./target/debug/binary"
}
4 changes: 3 additions & 1 deletion plugins/binary/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ pub static DETECTOR: OnceLock<BinaryFileDetector> = OnceLock::new();

#[derive(Deserialize)]
struct RawConfig {
#[serde(rename = "binary-file")]
binary_file: Option<PathBuf>,
#[serde(rename = "binary-file-threshold")]
binary_file_threshold: Option<u64>,
}

Expand Down Expand Up @@ -101,7 +103,7 @@ impl Plugin for BinaryPlugin {
// If no policy vars, we have no default expr
Some(None) => Ok("".to_owned()),
// Use policy config vars to construct a default expr
Some(Some(policy_conf)) => Ok(format!("(lte $ {}))", policy_conf)),
Some(Some(policy_conf)) => Ok(format!("(lte (count $) {})", policy_conf)),
}
}

Expand Down

0 comments on commit b2d4020

Please sign in to comment.