I coded an iOKit fuzzer for iOS. Here is the code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <mach/mach.h>
#include <mach/vm_map.h>
#include <IOKit/IOKitLib.h>
int main()
{
io_service_t service = IOServiceGetMatching(kIOMasterPortDefault, IOserviceMatching("IOUSBHIDDriver")); // change service each time
if(!service)
{
return -1;
}
io_connect_t connect;
kern_return_t kr = IOServiceOpen(service, mach_task_self(), 0, &connect);
if(kr != kIOReturnSuccess)
{
return -1;
}
uint32_t selector =3;
uint64_t input[0];
input[0] = 0x44444444444;
IOConnectCallMethod(connect, selector, input, 1, 0, 0, NULL, NULL, NULL, NULL);
printf("Did it crash? No? Do it again! -Toxic\n");
}
I've been trying to compile this with GCC for a while now, but I get all kinds of errors. I'd like to know if anyone know exactly how to compile a command line tool for iOS. Thanks.