LIEF: Library to Instrument Executable Formats Version 1.0.0
Loading...
Searching...
No Matches
LIEF::MachO::Parser Class Reference

The main interface to parse a Mach-O binary. More...

#include <Parser.hpp>

Inheritance diagram for LIEF::MachO::Parser:
Collaboration diagram for LIEF::MachO::Parser:

Public Member Functions

Parseroperator= (const Parser &copy)=delete
 Parser (const Parser &copy)=delete
 ~Parser () override

Static Public Member Functions

static std::unique_ptr< FatBinaryparse (const std::string &filename, const ParserConfig &conf=ParserConfig::deep())
 Parse a Mach-O file from the path provided by the filename parameter.
static std::unique_ptr< FatBinaryparse (const std::vector< uint8_t > &data, const ParserConfig &conf=ParserConfig::deep())
 Parse a Mach-O file from the raw content provided by the data parameter.
static std::unique_ptr< FatBinaryparse (std::unique_ptr< BinaryStream > stream, const ParserConfig &conf=ParserConfig::deep())
 Parse a Mach-O binary from the provided BinaryStream.
static std::unique_ptr< FatBinaryparse_from_memory (uintptr_t address, const ParserConfig &conf=ParserConfig::deep())
 Parse the Mach-O binary from the address given in the first parameter.
static std::unique_ptr< FatBinaryparse_from_memory (uintptr_t address, size_t size, const ParserConfig &conf=ParserConfig::deep())
 Parse the Mach-O binary from the address given in the first parameter and the size given in the second parameter.
static std::unique_ptr< FatBinaryparse_from_dump (const std::string &filepath, uint64_t addr, const ParserConfig &conf=ParserConfig::deep())
 Parse a Mach-O binary from a memory dump located on disk.
static std::unique_ptr< FatBinaryparse_from_dump (BinaryStream &stream, uint64_t addr, const ParserConfig &conf=ParserConfig::deep())
 Same as parse_from_dump(const std::string&, uint64_t, const ParserConfig&) but the dump is wrapped in the given non-owned stream.
static std::unique_ptr< FatBinaryparse_from_dump (std::unique_ptr< BinaryStream > stream, uint64_t addr, const ParserConfig &conf=ParserConfig::deep())
 Same as parse_from_dump(const std::string&, uint64_t, const ParserConfig&) but the dump is wrapped in the given owned stream.
Static Public Member Functions inherited from LIEF::Parser
static std::unique_ptr< Binaryparse (const std::string &filename)
 Construct an LIEF::Binary from the given filename.
static std::unique_ptr< Binaryparse (const std::vector< uint8_t > &raw)
 Construct an LIEF::Binary from the given raw data.
static std::unique_ptr< Binaryparse (std::unique_ptr< BinaryStream > stream)
 Construct an LIEF::Binary from the given stream.

Detailed Description

The main interface to parse a Mach-O binary.

This class is used to parse both Fat & non-Fat binary. Non-fat binaries are considered as a fat with only one architecture. This is why MachO::Parser::parse outputs a FatBinary object.

Constructor & Destructor Documentation

◆ Parser()

LIEF::MachO::Parser::Parser ( const Parser & copy)
delete

References Parser().

Referenced by operator=(), parse_from_dump(), and Parser().

◆ ~Parser()

LIEF::MachO::Parser::~Parser ( )
overridevirtual

Reimplemented from LIEF::Parser.

Member Function Documentation

◆ operator=()

Parser & LIEF::MachO::Parser::operator= ( const Parser & copy)
delete

References Parser().

◆ parse() [1/3]

std::unique_ptr< FatBinary > LIEF::MachO::Parser::parse ( const std::string & filename,
const ParserConfig & conf = ParserConfig::deep() )
static

Parse a Mach-O file from the path provided by the filename parameter.

The conf parameter can be used to tweak the configuration of the parser

Parameters
[in]filenamePath to the Mach-O file
[in]confParser configuration (Default: ParserConfig::deep)

References LIEF::MachO::ParserConfig::deep().

Referenced by parse_from_dump().

◆ parse() [2/3]

std::unique_ptr< FatBinary > LIEF::MachO::Parser::parse ( const std::vector< uint8_t > & data,
const ParserConfig & conf = ParserConfig::deep() )
static

Parse a Mach-O file from the raw content provided by the data parameter.

The conf parameter can be used to tweak the configuration of the parser

Parameters
[in]dataMach-O file as a vector of bytes
[in]confParser configuration (Default: ParserConfig::deep)

References LIEF::MachO::ParserConfig::deep().

◆ parse() [3/3]

std::unique_ptr< FatBinary > LIEF::MachO::Parser::parse ( std::unique_ptr< BinaryStream > stream,
const ParserConfig & conf = ParserConfig::deep() )
static

Parse a Mach-O binary from the provided BinaryStream.

References LIEF::MachO::ParserConfig::deep().

◆ parse_from_dump() [1/3]

std::unique_ptr< FatBinary > LIEF::MachO::Parser::parse_from_dump ( BinaryStream & stream,
uint64_t addr,
const ParserConfig & conf = ParserConfig::deep() )
static

Same as parse_from_dump(const std::string&, uint64_t, const ParserConfig&) but the dump is wrapped in the given non-owned stream.

References LIEF::MachO::ParserConfig::deep().

◆ parse_from_dump() [2/3]

std::unique_ptr< FatBinary > LIEF::MachO::Parser::parse_from_dump ( const std::string & filepath,
uint64_t addr,
const ParserConfig & conf = ParserConfig::deep() )
static

Parse a Mach-O binary from a memory dump located on disk.

A dump is a raw capture of the process memory that was mapped starting at the virtual address addr. This is typically used to parse a Mach-O image that has been dumped from memory (e.g. from a debugger or a runtime hook).

Parameters
[in]filepathPath to the file that contains the memory dump
[in]addrVirtual address at which the dump was mapped
[in]confOptional configuration for the parser

References LIEF::MachO::ParserConfig::deep().

◆ parse_from_dump() [3/3]

std::unique_ptr< FatBinary > LIEF::MachO::Parser::parse_from_dump ( std::unique_ptr< BinaryStream > stream,
uint64_t addr,
const ParserConfig & conf = ParserConfig::deep() )
static

Same as parse_from_dump(const std::string&, uint64_t, const ParserConfig&) but the dump is wrapped in the given owned stream.

References LIEF::MachO::ParserConfig::deep(), LIEF_LOCAL, parse(), and Parser().

◆ parse_from_memory() [1/2]

std::unique_ptr< FatBinary > LIEF::MachO::Parser::parse_from_memory ( uintptr_t address,
const ParserConfig & conf = ParserConfig::deep() )
static

Parse the Mach-O binary from the address given in the first parameter.

References LIEF::MachO::ParserConfig::deep().

◆ parse_from_memory() [2/2]

std::unique_ptr< FatBinary > LIEF::MachO::Parser::parse_from_memory ( uintptr_t address,
size_t size,
const ParserConfig & conf = ParserConfig::deep() )
static

Parse the Mach-O binary from the address given in the first parameter and the size given in the second parameter.

References LIEF::MachO::ParserConfig::deep().


The documentation for this class was generated from the following file: