* @brief Class that manages memory operations for a remote process. */
| 20 | * @brief Class that manages memory operations for a remote process. |
| 21 | */ |
| 22 | class KittyMemoryMgr |
| 23 | { |
| 24 | private: |
| 25 | bool _init; |
| 26 | pid_t _pid; |
| 27 | std::string _process_name; |
| 28 | EKittyMemOP _eMemOp; |
| 29 | std::unique_ptr<IKittyMemOp> _pMemOp; |
| 30 | std::unique_ptr<IKittyMemOp> _pMemOpPatch; |
| 31 | |
| 32 | public: |
| 33 | /// @brief MemoryPatch Manager |
| 34 | MemoryPatchMgr memPatch; |
| 35 | /// @brief MemoryBackup Manager |
| 36 | MemoryBackupMgr memBackup; |
| 37 | /// @brief Memory Scanner Manager |
| 38 | KittyScannerMgr memScanner; |
| 39 | /// @brief Elf Scanner Manager |
| 40 | ElfScannerMgr elfScanner; |
| 41 | |
| 42 | #ifdef __ANDROID__ |
| 43 | /// @brief Linker Scanner Manager |
| 44 | LinkerScannerMgr linkerScanner; |
| 45 | /// @brief NativeBridge Scanner Manager |
| 46 | NativeBridgeScannerMgr nbScanner; |
| 47 | #endif |
| 48 | |
| 49 | /// @brief Process Trace Manager |
| 50 | KittyTraceMgr trace; |
| 51 | |
| 52 | KittyMemoryMgr() : _init(false), _pid(0), _eMemOp(EK_MEM_OP_NONE) |
| 53 | { |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * @brief Initializes the memory manager. |
| 58 | * @param pid Remote process ID. |
| 59 | * @param eMemOp Memory read & write operation type. |
| 60 | * @param initMemPatch If true, initializes MemoryPatch and MemoryBackup instances. |
| 61 | * @return True if initialization is successful, false otherwise. |
| 62 | */ |
| 63 | bool initialize(pid_t pid, EKittyMemOP eMemOp, bool initMemPatch); |
| 64 | |
| 65 | /** |
| 66 | * @brief Returns the process ID. |
| 67 | */ |
| 68 | inline pid_t processID() const |
| 69 | { |
| 70 | return _pid; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * @brief Returns the process name. |
| 75 | * @return The name of the remote process. |
| 76 | */ |
| 77 | inline std::string processName() const |
| 78 | { |
| 79 | return _process_name; |
nothing calls this directly
no outgoing calls
no test coverage detected