- UID
- 2
注册时间2004-12-1
阅读权限255
最后登录1970-1-1
总坛主
TA的每日心情 | 开心 2024-12-1 11:04 |
---|
签到天数: 12 天 [LV.3]偶尔看看II
|
发现一个插件非常不错,在锁屏模式直接用指纹解锁,所以研究了下~~
大家知道在锁屏模式,指纹识别监听事件是无效的,所以变通一下:
1.先模拟按一次home让屏幕点亮
2.调用原来的指纹解锁功能
这里照顾没有iPhone5以上带指纹设备的朋友测试,我采用hook音量按钮的方法来做实验,实际功能和音量没毛关系,望悉知!
- /*
- 代码模拟点击home键,黑屏模式指纹解锁第一步,嘿嘿!!
-
- 这个功能不好测试,所以我hook了音量调整按钮来验证
-
- 测试方法:
- 先将设备黑屏,再按音量键,屏幕亮了说明home模拟成功!!
-
- https://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;
- }
复制代码
看完了,是不是很简单,也是不是很蛋疼??
其实我还有更好的方法,嘿嘿!!!
|
|