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
KittyMemoryEx Namespace Reference

Provides utility functions for process memory. More...

Classes

class  ProcMap
 Represents a mapping of a memory region. More...
class  ProcStatus
 Class to retrieve process status information. More...

Enumerations

enum class  EProcMapFilter {
  Equal , Contains , StartWith , EndWith ,
  Regex
}
 Enumerates the filter types for finding memory maps.

Functions

std::string getProcessName (pid_t pid)
 Retrieves the name of the process by its process ID.
std::vector< pid_t > getProcessIDs (const std::string &processName)
 Retrieves a list of process IDs that match a given process name.
pid_t getProcessID (const std::string &processName)
 Retrieves the process ID that matches a given process name.
std::vector< pid_t > getAllThreads (pid_t pid)
 Retrieves a list of thread IDs for a given process ID.
std::vector< ProcMap > getAllMaps (pid_t pid)
 Retrieves information about all memory maps in a remote process.
std::vector< ProcMap > getMaps (pid_t pid, EProcMapFilter filter, const std::string &name, const std::vector< ProcMap > &maps=std::vector< ProcMap >())
 Retrieves information about all memory maps in a remote process.
ProcMap getAddressMap (pid_t pid, uintptr_t address, const std::vector< ProcMap > &maps=std::vector< ProcMap >())
 Retrieves the map information for a specific address in a remote process.
std::vector< std::vector< ProcMap > > getFileMappings (pid_t pid, const std::string &path, const std::vector< ProcMap > &maps=std::vector< ProcMap >())
 Returns all contiguous mappings of a file in a remote process.
std::string getAppDirectory (const std::string &pkg)
 Retrieves the Android app directory.

Detailed Description

Provides utility functions for process memory.

Function Documentation

◆ getAddressMap()

ProcMap KittyMemoryEx::getAddressMap ( pid_t pid,
uintptr_t address,
const std::vector< ProcMap > & maps = std::vector< ProcMap >() )

Retrieves the map information for a specific address in a remote process.

Parameters
pidThe remote process ID
addressAddress to search for.
mapsVector of cached process maps (optional).
Returns
ProcMap object representing the map for the address, or an invalid map if not found.

◆ getAllMaps()

std::vector< ProcMap > KittyMemoryEx::getAllMaps ( pid_t pid)

Retrieves information about all memory maps in a remote process.

Parameters
pidThe remote process ID
Returns
Vector of ProcMap objects representing all memory maps.
Here is the caller graph for this function:

◆ getAllThreads()

std::vector< pid_t > KittyMemoryEx::getAllThreads ( pid_t pid)

Retrieves a list of thread IDs for a given process ID.

This function retrieves the thread IDs of all threads associated with the specified process ID by examining the /proc/[pid]/task directory.

Parameters
pidThe process ID of the process.
Returns
A vector of thread IDs for the specified process.
Here is the caller graph for this function:

◆ getAppDirectory()

std::string KittyMemoryEx::getAppDirectory ( const std::string & pkg)

Retrieves the Android app directory.

Parameters
pkgThe app's package name
Returns
App directory

◆ getFileMappings()

std::vector< std::vector< ProcMap > > KittyMemoryEx::getFileMappings ( pid_t pid,
const std::string & path,
const std::vector< ProcMap > & maps = std::vector< ProcMap >() )

Returns all contiguous mappings of a file in a remote process.

Finds all memory maps backed by the specified file and groups adjacent maps into contiguous mappings. Two maps are considered contiguous when both their virtual addresses and file offsets are contiguous. Multiple independent mappings of the same file are returned as separate groups.

Parameters
pidThe remote process ID
pathFile path to search for.
mapsVector of cached process maps (optional).
Returns
A vector where each element represents a contiguous file mapping as a sequence of its constituent memory maps.

◆ getMaps()

std::vector< ProcMap > KittyMemoryEx::getMaps ( pid_t pid,
EProcMapFilter filter,
const std::string & name,
const std::vector< ProcMap > & maps = std::vector< ProcMap >() )

Retrieves information about all memory maps in a remote process.

Parameters
pidThe remote process ID
filterFilter type to use.
nameName to filter by.
mapsVector of cached process maps (optional).
Returns
Vector of ProcMap objects that match the filter.

◆ getProcessID()

pid_t KittyMemoryEx::getProcessID ( const std::string & processName)

Retrieves the process ID that matches a given process name.

This function searches for the first process whose command line matches the specified process name and returns its process ID.

Parameters
processNameThe name of the process to match.
Returns
The process ID that matches the specified process name.

◆ getProcessIDs()

std::vector< pid_t > KittyMemoryEx::getProcessIDs ( const std::string & processName)

Retrieves a list of process IDs that match a given process name.

This function searches for all processes whose command line matches the specified process name and returns their process IDs in a vector.

Parameters
processNameThe name of the process to match.
Returns
A vector of process IDs that match the specified process name.

◆ getProcessName()

std::string KittyMemoryEx::getProcessName ( pid_t pid)

Retrieves the name of the process by its process ID.

This function reads the command line of the process identified by the given process ID and returns the process name.

Parameters
pidThe process ID of the process.
Returns
The name of the process.