Struct lief::macho::binary::Binary

pub struct Binary { /* private fields */ }
Expand description

This is the main interface to read and write Mach-O binary attributes.

Note that this structure implements the generic::Binary trait from which other generic functions are exposed

Implementations§

§

impl Binary

pub fn header(&self) -> Header<'_>

Return the main Mach-O header

pub fn commands(&self) -> CommandsIter<'_>

Return an iterator over the different crate::macho::Commands used by the Mach-O binary

pub fn sections(&self) -> Sections<'_>

Return an iterator over the different crate::macho::Section of the binary

pub fn segments(&self) -> Segments<'_>

Return an iterator over the different crate::macho::commands::Segment (LC_SEGMENT/LC_SIGNATURE) of the binary.

pub fn libraries(&self) -> Libraries<'_>

Return an iterator over the crate::macho::commands::Dylib used by this binary

pub fn relocations(&self) -> Relocations<'_>

Return an iterator over the different crate::macho::Relocation of this binary

pub fn symbols(&self) -> Symbols<'_>

Return an iterator over the different crate::macho::Symbol of this binary

pub fn dyld_info(&self) -> Option<DyldInfo<'_>>

Return the LC_DYLD_INFO/LC_DYLD_INFO_ONLY command if present

pub fn uuid(&self) -> Option<UUID<'_>>

Return the LC_UUID command if present

pub fn main_command(&self) -> Option<Main<'_>>

Return the LC_MAIN command if present

pub fn dylinker(&self) -> Option<Dylinker<'_>>

Return the LC_LOAD_DYLINKER/LC_ID_DYLINKER command if present

pub fn function_starts(&self) -> Option<FunctionStarts<'_>>

Return the LC_FUNCTION_STARTS command if present

pub fn source_version(&self) -> Option<SourceVersion<'_>>

Return the LC_SOURCE_VERSION command if present

pub fn thread_command(&self) -> Option<ThreadCommand<'_>>

Return the LC_THREAD/LC_UNIXTHREAD command if present

pub fn rpath(&self) -> Option<RPath<'_>>

Return the LC_RPATH command if present

pub fn symbol_command(&self) -> Option<SymbolCommand<'_>>

Return the LC_SYMTAB command if present

pub fn dynamic_symbol(&self) -> Option<DynamicSymbolCommand<'_>>

Return the LC_DYSYMTAB command if present

pub fn code_signature(&self) -> Option<CodeSignature<'_>>

Return the LC_CODE_SIGNATURE command if present

pub fn code_signature_dir(&self) -> Option<CodeSignatureDir<'_>>

Return the LC_DYLIB_CODE_SIGN_DRS command if present

pub fn data_in_code(&self) -> Option<DataInCode<'_>>

Return the LC_DATA_IN_CODE command if present

pub fn segment_split_info(&self) -> Option<SegmentSplitInfo<'_>>

Return the LC_SEGMENT_SPLIT_INFO command if present

pub fn encryption_info(&self) -> Option<EncryptionInfo<'_>>

Return the LC_ENCRYPTION_INFO/LC_ENCRYPTION_INFO_64 command if present

pub fn sub_framework(&self) -> Option<SubFramework<'_>>

Return the LC_SUB_FRAMEWORK command if present

pub fn dyld_environment(&self) -> Option<DyldEnvironment<'_>>

Return the LC_DYLD_ENVIRONMENT command if present

pub fn build_version(&self) -> Option<BuildVersion<'_>>

Return the LC_BUILD_VERSION command if present

pub fn dyld_chained_fixups(&self) -> Option<DyldChainedFixups<'_>>

Return the LC_DYLD_CHAINED_FIXUPS command if present

pub fn dyld_exports_trie(&self) -> Option<DyldExportsTrie<'_>>

Return the LC_DYLD_EXPORTS_TRIE command if present

pub fn two_level_hints(&self) -> Option<TwoLevelHints<'_>>

Return the LC_TWOLEVEL_HINTS command if present

pub fn linker_opt_hint(&self) -> Option<LinkerOptHint<'_>>

Return the LC_LINKER_OPTIMIZATION_HINT command if present

pub fn version_min(&self) -> Option<VersionMin<'_>>

Return the LC_VERSION_MIN_MACOSX/VERSION_MIN_IPHONEOS command if present

pub fn support_arm64_ptr_auth(&self) -> bool

Check if the binary is supporting ARM64 pointer authentication (arm64e)

pub fn objc_metadata(&self) -> Option<Metadata<'_>>

Return Objective-C metadata if present

Trait Implementations§

§

impl Binary for Binary

§

fn entrypoint(&self) -> u64

Binary’s entrypoint
§

fn imagebase(&self) -> u64

Default base address where the binary should be mapped
§

fn is_pie(&self) -> bool

Whether the current binary is an executable and position independent
§

fn has_nx(&self) -> bool

Whether the binary defines a non-executable stack
§

fn original_size(&self) -> u64

Original file size of the binary
§

fn debug_info(&self) -> Option<DebugInfo<'_>>

Return the debug info if present. It can be either a crate::pdb::DebugInfo or crate::dwarf::DebugInfo. Read more
§

impl Debug for Binary

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Binary

§

impl !Send for Binary

§

impl !Sync for Binary

§

impl Unpin for Binary

§

impl UnwindSafe for Binary

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.