Macho

Struct Macho 

Source
pub struct Macho { /* private fields */ }
Expand description

These fields contain Mac OS Mach Object file format (Mach-O) metadata.

Implementations§

Source§

impl Macho

Source

pub fn get_go_import_hash(&self) -> Option<&String>

A hash of the Go language imports in a Mach-O file excluding standard library imports. An import hash can be used to fingerprint binaries even after recompilation or other code-level transformations have occurred, which would change more traditional hash values.

The algorithm used to calculate the Go symbol hash and a reference implementation are available here.

Source

pub fn set_go_import_hash(&mut self, go_import_hash_arg: String)

A hash of the Go language imports in a Mach-O file excluding standard library imports. An import hash can be used to fingerprint binaries even after recompilation or other code-level transformations have occurred, which would change more traditional hash values.

The algorithm used to calculate the Go symbol hash and a reference implementation are available here.

§Example

10bddcb4cee42080f76c88d9ff964491

Source

pub fn get_go_imports_names_entropy(&self) -> Option<&u64>

Shannon entropy calculation from the list of Go imports.

Source

pub fn set_go_imports_names_entropy( &mut self, go_imports_names_entropy_arg: u64, )

Shannon entropy calculation from the list of Go imports.

Source

pub fn get_go_imports_names_var_entropy(&self) -> Option<&u64>

Variance for Shannon entropy calculation from the list of Go imports.

Source

pub fn set_go_imports_names_var_entropy( &mut self, go_imports_names_var_entropy_arg: u64, )

Variance for Shannon entropy calculation from the list of Go imports.

Source

pub fn get_go_imports(&self) -> Option<&String>

List of imported Go language element names and types.

Source

pub fn set_go_imports(&mut self, go_imports_arg: String)

List of imported Go language element names and types.

Source

pub fn get_go_stripped(&self) -> Option<&bool>

Set to true if the file is a Go executable that has had its symbols stripped or obfuscated and false if an unobfuscated Go executable.

Source

pub fn set_go_stripped(&mut self, go_stripped_arg: bool)

Set to true if the file is a Go executable that has had its symbols stripped or obfuscated and false if an unobfuscated Go executable.

Source

pub fn get_import_hash(&self) -> Option<&String>

A hash of the imports in a Mach-O file. An import hash can be used to fingerprint binaries even after recompilation or other code-level transformations have occurred, which would change more traditional hash values.

This is a synonym for symhash.

Source

pub fn set_import_hash(&mut self, import_hash_arg: String)

A hash of the imports in a Mach-O file. An import hash can be used to fingerprint binaries even after recompilation or other code-level transformations have occurred, which would change more traditional hash values.

This is a synonym for symhash.

§Example

d41d8cd98f00b204e9800998ecf8427e

Source

pub fn get_imports(&self) -> &Vec<String>

List of imported element names and types.

Source

pub fn add_import(&mut self, import_arg: String)

List of imported element names and types.

Source

pub fn get_imports_names_entropy(&self) -> Option<&u64>

Shannon entropy calculation from the list of imported element names and types.

Source

pub fn set_imports_names_entropy(&mut self, imports_names_entropy_arg: u64)

Shannon entropy calculation from the list of imported element names and types.

Source

pub fn get_imports_names_var_entropy(&self) -> Option<&u64>

Variance for Shannon entropy calculation from the list of imported element names and types.

Source

pub fn set_imports_names_var_entropy( &mut self, imports_names_var_entropy_arg: u64, )

Variance for Shannon entropy calculation from the list of imported element names and types.

Source

pub fn get_sections(&self) -> &Vec<String>

An array containing an object for each section of the Mach-O file.

The keys that should be present in these objects are defined by sub-fields underneath macho.sections.*.

Source

pub fn add_section(&mut self, section_arg: String)

An array containing an object for each section of the Mach-O file.

The keys that should be present in these objects are defined by sub-fields underneath macho.sections.*.

Source

pub fn get_sections_entropy(&self) -> Option<&u64>

Shannon entropy calculation from the section.

Source

pub fn set_sections_entropy(&mut self, sections_entropy_arg: u64)

Shannon entropy calculation from the section.

Source

pub fn get_sections_name(&self) -> Option<&String>

Mach-O Section List name.

Source

pub fn set_sections_name(&mut self, sections_name_arg: String)

Mach-O Section List name.

Source

pub fn get_sections_physical_size(&self) -> Option<&u64>

Mach-O Section List physical size.

Source

pub fn set_sections_physical_size(&mut self, sections_physical_size_arg: u64)

Mach-O Section List physical size.

Source

pub fn get_sections_var_entropy(&self) -> Option<&u64>

Variance for Shannon entropy calculation from the section.

Source

pub fn set_sections_var_entropy(&mut self, sections_var_entropy_arg: u64)

Variance for Shannon entropy calculation from the section.

Source

pub fn get_sections_virtual_size(&self) -> Option<&u64>

Mach-O Section List virtual size. This is always the same as physical_size.

Source

pub fn set_sections_virtual_size(&mut self, sections_virtual_size_arg: u64)

Mach-O Section List virtual size. This is always the same as physical_size.

Source

pub fn get_symhash(&self) -> Option<&String>

A hash of the imports in a Mach-O file. An import hash can be used to fingerprint binaries even after recompilation or other code-level transformations have occurred, which would change more traditional hash values.

This is a Mach-O implementation of the Windows PE imphash

Source

pub fn set_symhash(&mut self, symhash_arg: String)

A hash of the imports in a Mach-O file. An import hash can be used to fingerprint binaries even after recompilation or other code-level transformations have occurred, which would change more traditional hash values.

This is a Mach-O implementation of the Windows PE imphash

§Example

d3ccf195b62a9279c3c19af1080497ec

Trait Implementations§

Source§

impl Clone for Macho

Source§

fn clone(&self) -> Macho

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Macho

Source§

fn default() -> Macho

Returns the “default value” for a type. Read more
Source§

impl Serialize for Macho

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Macho

§

impl RefUnwindSafe for Macho

§

impl Send for Macho

§

impl Sync for Macho

§

impl Unpin for Macho

§

impl UnwindSafe for Macho

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.