pub struct CheckSecResults {}Expand description
Checksec result struct for PE32/32+ binaries
Example
use checksec::pe::{Properties, CheckSecResults};
use goblin::{pe::PE, Object};
use memmap::Mmap;
use std::fs;
pub fn print_results(binary: &String) {
if let Ok(fp) = fs::File::open(&binary) {
if let Ok(buf) = unsafe { Mmap::map(&fp) } {
if let Ok(obj) = Object::parse(&buf) {
match obj {
Object::PE(pe) => println!(
"{:#?}",
CheckSecResults::parse(&pe, &buf)
),
_ => println!("Not an pe binary."),
}
}
}
}
}Some of the mitigations/security features that are checked require access to the underlying binary file to parse, so both the goblin object and a read-only memory-mapped version of the original file must be provided for evaluating PE32/32+ binaries.
Fields§
§aslr: ASLRAddress Space Layout Randomization
authenticode: boolAuthenticode
cfg: boolControl Flow Guard (/guard:cf)
clr: boolCommon Language Runtime (.NET Framework)
dep: boolData Execution Prevention
dynamic_base: boolDynamic Base
force_integrity: boolForce Integrity (/INTEGRITYCHECK)
gs: boolBuffer Security Check (/GS)
high_entropy_va: bool64-bit ASLR (/HIGHENTROPYVA)
isolation: boolAllow Isolation (/ALLOWISOLATION)
rfg: boolReturn Flow Guard
safeseh: boolSafe Structured Exception Handler (/SAFESEH)
seh: boolStructured Exception Handler
Implementations§
Trait Implementations§
Source§impl Debug for CheckSecResults
impl Debug for CheckSecResults
Source§impl<'de> Deserialize<'de> for CheckSecResults
impl<'de> Deserialize<'de> for CheckSecResults
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for CheckSecResults
impl Display for CheckSecResults
Auto Trait Implementations§
impl Freeze for CheckSecResults
impl RefUnwindSafe for CheckSecResults
impl Send for CheckSecResults
impl Sync for CheckSecResults
impl Unpin for CheckSecResults
impl UnwindSafe for CheckSecResults
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more