KittyMemoryEx 1.0.0
Dedicated library for runtime code patching, memory scanning, tracing, injection and some more useful memory utilities. works for both Android and Linux
Loading...
Searching...
No Matches
LinkerScannerMgr Class Reference

Manager class for linker Elf. More...

#include <KittyScanner.hpp>

Inheritance diagram for LinkerScannerMgr:
Collaboration diagram for LinkerScannerMgr:

Public Member Functions

 LinkerScannerMgr (IKittyMemOp *pMem, const ElfScanner &linkerElf)
 Constructor for LinkerScannerMgr with a linker base address.
 LinkerScannerMgr (IKittyMemOp *pMem, uintptr_t linkerBase)
 Constructor for LinkerScannerMgr with the linker ElfScanner object.
bool init ()
 Initializes the linker scanner.
bool isInitialized () const
 Returns true if initialized, false otherwise.
ElfScanner * asELF () const
 Converts the LinkerScannerMgr object to an ElfScanner pointer.
kitty_linker_syms_t linker_offsets () const
 Returns the linker symbols offsets.
kitty_soinfo_offsets_t soinfo_offsets () const
 Returns the soinfo offsets.
uintptr_t solist () const
 Returns the linker solist head address.
uintptr_t somain () const
 Returns the linker somain address.
uintptr_t sonext () const
 Returns the linker solist tail address.
kitty_soinfo_t somainInfo () const
 Returns the linker somain info.
kitty_soinfo_t sonextInfo () const
 Returns the linker solist tail info.
std::vector< kitty_soinfo_t > allSoInfo () const
 Returns all linker's soinfo.
kitty_soinfo_t findSoInfo (const std::string &name) const
 Finds a soinfo by name.
Public Member Functions inherited from ElfScanner
 ElfScanner (IKittyMemOp *pMem, uintptr_t elfBase, const std::vector< KittyMemoryEx::ProcMap > &maps)
 Constructor for ElfScanner class. This constructor initializes the ElfScanner class with the given ELF base address.
 ElfScanner (IKittyMemOp *pMem, uintptr_t elfBase)
 Constructor for ElfScanner class. This constructor initializes the ElfScanner class with the given ELF base address.
 ElfScanner (IKittyMemOp *pMem, const kitty_soinfo_t &soinfo, const std::vector< KittyMemoryEx::ProcMap > &maps)
 Constructor for ElfScanner class. This constructor initializes the ElfScanner class with the given soinfo.
 ElfScanner (IKittyMemOp *pMem, const kitty_soinfo_t &soinfo)
 Constructor for ElfScanner class. This constructor initializes the ElfScanner class with the given soinfo.
bool isValid () const
 Checks if the ElfScanner class is valid.
bool isFixedBySoInfo () const
 Checks if the ELF file is fixed by soinfo. Some Elf headers are obfuscated or removed, createWithSoInfo(const kitty_soinfo_t&, const std::vector<KittyMemory::ProcMap>&) may fix header.
uintptr_t base () const
 Elf's Base address in memory.
uintptr_t end () const
 Elf's end address in memory.
 KT_ElfW (Ehdr) header() const
 Elf's header.
uintptr_t phdr () const
 Elf's program header address in memory.
std::vector< KT_ElfW(Phdr)> programHeaders () const
 Vector of Elf's program headers.
int loads () const
 Elf's number of loads.
uintptr_t loadBias () const
 Elf's load bias address in memory.
uintptr_t loadSize () const
 Elf's load size.
uintptr_t dynamic () const
 Elf's dynamic section address in memory.
std::vector< KT_ElfW(Dyn)> dynamics () const
 Vector of Elf's dynamic sections.
uintptr_t stringTable () const
 Elf's dynamic string table address in memory.
uintptr_t symbolTable () const
 Elf's dynamic symbol table address in memory.
size_t stringTableSize () const
 Elf's dynamic string table size.
size_t symbolEntrySize () const
 Elf's symbol entry size.
uintptr_t elfHashTable () const
 Elf's ELF hash table address in memory (DT_HASH), zero if not present.
uintptr_t gnuHashTable () const
 Elf's GNU hash table address in memory (DT_GNU_HASH), zero if not present.
std::unordered_map< std::string, uintptr_t > dsymbols ()
 Returns a map of symbols from the symbol table (SHT_SYMTAB) on disk.
uintptr_t findSymbol (const std::string &symbolName) const
 Finds a symbol from the dynamic symbol table by name.
uintptr_t findDebugSymbol (const std::string &symbolName)
 Finds a symbol from the symbol table (SHT_SYMTAB) on disk by name.
KittyMemoryEx::ProcMap baseSegment () const
 Elf's base memory map info.
std::vector< KittyMemoryEx::ProcMap > segments () const
 Returns all of Elf's memory maps info.
std::vector< KittyMemoryEx::ProcMap > bssSegments () const
 Returns all of Elf's BSS memory maps.
std::string filePath () const
 Returns the file path of the memory mapped Elf file.
std::string realPath () const
 Returns the real path of the memory mapped Elf file (e.g, incase if it's inside a zip, it will return full path to zip entry).
bool isZipped () const
 Returns if the memory mapped Elf file was loaded from zip file.
bool find_r_debug (r_debug *out) const
 Finds the r_debug structure in the process.

Additional Inherited Members

Protected Member Functions inherited from ElfScanner
 KT_ElfW (Ehdr) _ehdr
Protected Attributes inherited from ElfScanner
IKittyMemOp * _pMem
uintptr_t _elfBase
uintptr_t _phdr
std::vector< KT_ElfW(Phdr)> _phdrs
int _loads
uintptr_t _loadBias
uintptr_t _loadSize
uintptr_t _dynamic
std::vector< KT_ElfW(Dyn)> _dynamics
uintptr_t _stringTable
uintptr_t _symbolTable
uintptr_t _elfHashTable
uintptr_t _gnuHashTable
size_t _strsz
size_t _syment
bool _fixedBySoInfo
KittyMemoryEx::ProcMap _baseSegment
std::vector< KittyMemoryEx::ProcMap > _segments
std::vector< KittyMemoryEx::ProcMap > _bssSegments
std::string _filepath
std::string _realpath
bool _dsymbols_init
std::unordered_map< std::string, uintptr_t > _dsymbolsMap

Detailed Description

Manager class for linker Elf.

This class inherits from ElfScanner and provides methods for linker Elf.

Constructor & Destructor Documentation

◆ LinkerScannerMgr() [1/2]

LinkerScannerMgr::LinkerScannerMgr ( IKittyMemOp * pMem,
const ElfScanner & linkerElf )

Constructor for LinkerScannerMgr with a linker base address.

Parameters
pMemPointer to the memory operation interface.
linkerBaseThe base address of the linker.

◆ LinkerScannerMgr() [2/2]

LinkerScannerMgr::LinkerScannerMgr ( IKittyMemOp * pMem,
uintptr_t linkerBase )

Constructor for LinkerScannerMgr with the linker ElfScanner object.

Parameters
pMemPointer to the memory operation interface.
linkerElfLinker ElfScanner object.

Member Function Documentation

◆ asELF()

ElfScanner * LinkerScannerMgr::asELF ( ) const
inline

Converts the LinkerScannerMgr object to an ElfScanner pointer.

Returns
The ElfScanner pointer.

◆ findSoInfo()

kitty_soinfo_t LinkerScannerMgr::findSoInfo ( const std::string & name) const

Finds a soinfo by name.

Parameters
nameThe name of the soinfo.
Returns
The soinfo if found or empty object.

◆ init()

bool LinkerScannerMgr::init ( )

Initializes the linker scanner.

Returns
True if initialization is successful, false otherwise.

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