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: ASLR
Address Space Layout Randomization
authenticode: bool
Authenticode
cfg: bool
Control Flow Guard (/guard:cf
)
clr: bool
Common Language Runtime (.NET Framework)
dep: bool
Data Execution Prevention
dynamic_base: bool
Dynamic Base
force_integrity: bool
Force Integrity (/INTEGRITYCHECK
)
gs: bool
Buffer Security Check (/GS
)
high_entropy_va: bool
64-bit ASLR (/HIGHENTROPYVA
)
isolation: bool
Allow Isolation (/ALLOWISOLATION
)
rfg: bool
Return Flow Guard
safeseh: bool
Safe Structured Exception Handler (/SAFESEH
)
seh: bool
Structured 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