본문 바로가기
ios-exploit/hexdump

IOS Exploit ][ dump hex 사용하기

by SpeeDr00t 2019. 9. 24.
반응형

IOS Exploit ][ dump hex 사용하기

■ 사용법

// Taken from the internet, dont remember where exctly
void DumpHex(const void* data, size_t size) {
char ascii[17];
size_t i, j;
ascii[16] = '\0';
for (i = 0; i < size; ++i) {
printf("%02X ", ((unsigned char*)data)[i]);
if (((unsigned char*)data)[i] >= ' ' && ((unsigned char*)data)[i] <= '~') {
ascii[i % 16] = ((unsigned char*)data)[i];
} else
ascii[i % 16] = '.';
if ((i+1) % 8 == 0 || i+1 == size) {
printf(" ");
if ((i+1) % 16 == 0)
printf("| %s \n", ascii);
else if (i+1 == size) {
ascii[(i+1) % 16] = '\0';
if ((i+1) % 16 <= 8) {
printf(" ");
}
for (j = (i+1) % 16; j < 16; ++j)
printf(" ");
printf("| %s \n", ascii);
}
}
}
}
typedef struct {
mach_msg_header_t Head;
} Request __attribute__((unused));
typedef struct {
mach_msg_header_t Head;
NDR_record_t NDR;
kern_return_t RetCode;
int psid;
int return_code;
mach_msg_trailer_t trailer;
} Reply __attribute__((unused));
union {
Request In;
Reply Out;
} Mess;
Reply *Out0P = &Mess.Out;
DumpHex((void*)Out0P,sizeof(Reply));
view raw DumpHex.c hosted with ❤ by GitHub
반응형