/* 代码模拟点击home键,黑屏模式指纹解锁第一步,嘿嘿!! 这个功能不好测试,所以我hook了音量调整按钮来验证 测试方法: 先将设备黑屏,再按音量键,屏幕亮了说明home模拟成功!! http://www.chinapyg.com http://www.dllhook.com code by piaoyun */ #include <mach/mach_time.h> // 记住把 IOKit.framework 从iOS设备中拖出来,然后导入 #include <UIKit/UIkit.h> extern "C"{ typedef uint32_t IOHIDEventOptionBits; typedef struct __IOHIDEvent *IOHIDEventRef; IOHIDEventRef IOHIDEventCreateKeyboardEvent(CFAllocatorRef allocator, AbsoluteTime timeStamp, uint16_t usagePage, uint16_t usage, Boolean down, IOHIDEventOptionBits flags); } @interface SpringBoard: UIApplication - (void)_menuButtonDown:(struct __IOHIDEvent *)arg1; - (void)_menuButtonUp:(struct __IOHIDEvent *)arg1; @end %hook SpringBoard // 利用音量按钮来测试 - (_Bool)_volumeChanged:(struct __IOHIDEvent *)arg1 { NSLog(@"[++++]_volumeChanged"); %log; SpringBoard *springboard = (SpringBoard *)[%c(SpringBoard) sharedApplication]; uint64_t abTime = mach_absolute_time(); IOHIDEventRef event = IOHIDEventCreateKeyboardEvent(kCFAllocatorDefault, *(AbsoluteTime *)&abTime, 0xC, 0x40, YES, 0); [springboard _menuButtonDown:event]; CFRelease(event); event = IOHIDEventCreateKeyboardEvent(kCFAllocatorDefault, *(AbsoluteTime *)&abTime, 0xC, 0x40, YES, 0); [springboard _menuButtonUp:event]; CFRelease(event); return %orig; } %end %ctor { NSLog(@"[++++]inject SpringBoard success!!!"); %init; }
发表评论