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

Provides general utility functions. More...

Namespaces

namespace  Path
 Provides utility functions for paths.
namespace  String
 Provides utility functions for strings.
namespace  Data
 Provides utility functions for data.
namespace  Zip
 Provides utility functions for handling ZIP files.

Classes

class  KTScopedFD
 RAII for file descriptor. More...
class  KTScopedMMap
 RAII for file descriptor. More...

Functions

uintptr_t untagPointer (uintptr_t ptr)
 Removes AArch64 top-byte pointer tags from an address.
template<typename T>
T * untagPointer (T *ptr)
template<typename T>
const T * untagPointer (const T *ptr)
template<typename T>
T randInt (T min, T max)
 Generates a random number of type T within a specified range.
std::vector< uint8_t > randomBytes (std::size_t length)
 Generates a random bytes of a specified length.
std::string randomString (size_t length)
 Generates a random string of a specified length.

Detailed Description

Provides general utility functions.

Function Documentation

◆ randInt()

template<typename T>
T KittyUtils::randInt ( T min,
T max )

Generates a random number of type T within a specified range.

Template Parameters
TThe type of the number.
Parameters
minThe minimum range.
minThe maximum range.
Returns
A random number.

◆ randomBytes()

std::vector< uint8_t > KittyUtils::randomBytes ( std::size_t length)

Generates a random bytes of a specified length.

Parameters
lengthThe length of the random bytes to generate.
Returns
Vector containing random byte values in the range [0, 255].

◆ randomString()

std::string KittyUtils::randomString ( size_t length)

Generates a random string of a specified length.

Parameters
lengthThe length of the random string to generate.
Returns
A random string.

◆ untagPointer()

uintptr_t KittyUtils::untagPointer ( uintptr_t ptr)
inline

Removes AArch64 top-byte pointer tags from an address.

On Android ARM64 systems, pointers may contain TBI/MTE tag bits in the top byte. This function removes those bits and returns the canonical virtual address suitable for comparisons against /proc/self/maps ranges.

Parameters
ptrAddress value to untag.
Returns
Canonical untagged address.
Parameters
ptrPointer value to untag.
Returns
Pointer of the same type with the top-byte tag removed.
Parameters
ptrConst pointer value to untag.
Returns
Const pointer of the same type with the top-byte tag removed.
Here is the caller graph for this function: