Monday, 1 May 2023

function to update offset via hex scan

https://ift.tt/5DQbY1p uintptr_t findOffset(const char *hex, const char *mask, uintptr_t expectedDistance, uintptr_t expectedOccurrence) { const mach_header *header = KittyMemory::getMemoryFileInfo(framework).header; int len = strlen(hex); char *hexCopy = (char *)malloc(len + 1); strcpy(hexCopy, hex); for (int i = 0; i < len; i++) { if (hexCopy[i] == '?') { hexCopy[i] = '0'; } } std::vector<uintptr_t> found_at_list = KittyScanner::findHexAll(header, "__TEXT", hexCopy, mask); free(hexCopy); uintptr_t foundHex = found_at_list[expectedOccurrence]; uintptr_t baseAddress = (uintptr_t)header; uintptr_t offset = foundHex - baseAddress; uintptr_t finOffset = offset + expectedDistance; #if DEBUG == 1 NSLog(@"found offset: %llu", finOffset); #endif return finOffset; }

from iOSGods RSS Feed https://ift.tt/2n1Hgwi

No comments:

Post a Comment