您可以在计算机上编写脚本,并基于模拟触摸库使用键盘和鼠标来控制您的 iOS 设备。
iOS13-模拟触摸是一个开源库,允许您在系统级别模拟触摸事件。您可以使用任何编程语言编写脚本来模拟 iOS 设备上的触摸事件远程或本地。请检查源代码[Github] iOS13-SimulateTouch https://github.com/xuan32546/IOS13-SimulateTouch
IOS13-模拟触摸
iOS 11.0 - 13.6 系统级触摸模拟 iOS13 simulate touch
需要越狱设备
描述 https://github.com/xuan32546/IOS13-SimulateTouch/blob/master/README.md#description
该库使您只需一行代码即可在 iOS 11.0 - 13.6 上模拟触摸事件!稍后将发布所有源代码。
Features https://github.com/xuan32546/IOS13-SimulateTouch/blob/master/README.md#features
- 支持多点触摸(您找不到其他库支持多点触摸)。
- 可编程的。控制脚本可以使用您想要的所有编程语言进行编程。
- 支持即时控制。可以无延迟地从其他设备/计算机控制 ios 设备。
- 系统级触摸模拟(不会注入任何进程)。
安装 https://github.com/xuan32546/IOS13-SimulateTouch/blob/master/README.md#installation
- 打开Cydia - 来源 - 编辑 - 添加 -http://47.114.83.227 http://47.114.83.227(“http”而不是“https”!请仔细检查。)
- Install 《ZJX触摸模拟》 tweak
- Done
代码示例 https://github.com/xuan32546/IOS13-SimulateTouch/blob/master/README.md#code-example
Python Version
import socket
import time
# event types
TOUCH_UP = 0
TOUCH_DOWN = 1
TOUCH_MOVE = 2
SET_SCREEN_SIZE = 9
# you can copy and paste this method to your code
def formatSocketData(type, index, x, y):
return '{}{:02d}{:05d}{:05d}'.format(type, index, int(x*10), int(y*10))
s = socket.socket()
s.connect(("127.0.0.1", 6000)) # connect to the tweak. Replace "127.0.0.1" with the ip address of your device
s.send(("1"+formatSocketData(SET_SCREEN_SIZE, 0, 2048, 2732)).encode()) # tell the tweak that the screen size is 2048x2732 (your screen size might differ). This should be send to the tweak every time you kill the SpringBoard (just send once)
time.sleep(1) # sleep for 1 sec to get setting size process finished
s.send(("1"+formatSocketData(TOUCH_DOWN, 7, 300, 400)).encode()) # tell the tweak to touch 300x400 on the screen
# IMPORTANT: NOTE the "1" at the head of the data. This indicates the event count and CANNOT BE IGNORED.
s.close()
实际上触摸仅由一行执行:
s.send(("1"+formatSocketData(TOUCH_DOWN, 7, 300, 400)).encode())
整洁又简单。
执行触摸移动
s.send(("1"+formatSocketData(TOUCH_MOVE, 7, 800, 400)).encode()) # tell the tweak to move our finger "7" to (800, 400)
执行修饰
s.send(("1"+formatSocketData(TOUCH_UP, 7, 800, 400)).encode()) # tell the tweak to touch up our finger "7" at (800, 400)
将它们结合起来
s.send(("1"+formatSocketData(TOUCH_DOWN, 7, 300, 400)).encode())
time.sleep(1)
s.send(("1"+formatSocketData(TOUCH_MOVE, 7, 800, 400)).encode())
time.sleep(1)
s.send(("1"+formatSocketData(TOUCH_UP, 7, 800, 400)).encode())
首先手指触摸(300, 400),然后移动到(800, 400),然后“离开”屏幕。所有触摸事件均无延迟地执行。
Usage https://github.com/xuan32546/IOS13-SimulateTouch/blob/master/README.md#usage
- 安装后,该调整将开始侦听端口 6000。
- 使用套接字将触摸数据字段发送到调整
data field should always be decimal digits, specified below
NOTE:将来可能会更新用法。我会更新这篇文章,但请在 github 上跟踪使用_iOS13-SimulateTouch https://github.com/xuan32546/IOS13-SimulateTouch/blob/master/README.md#usage
Event Count
(1 位数字):指定单个事件的计数。如果您要同时发送多个事件,只需增加事件计数并将事件附加到数据中即可。
在单个事件中
Type
(1 位数字):指定单个事件的类型。
支持的事件类型:
- 事件:触摸。标志: 0 描述: 指定该事件为触摸事件
- 事件:着陆。标志: 1. 描述: 指定该事件为触地事件
- 事件:触摸移动。标志: 2 描述: 指定该事件为 touch-move 事件(移动手指)
- 事件:设置大小。标志:9. 描述:设置屏幕尺寸(必填!!下面会解释)
Touch Index
(2 位):Apple 支持多点触控,因此在发布触摸事件时必须指定手指索引。手指索引的范围是1-20(0是保留的,不要使用0作为手指索引)。
x Coordinate
(5 位数字):您要触摸的位置的 x 坐标。前 4 位为整数部分,最后一位为小数部分。例如,如果您想在屏幕上触摸(123.4,2432.1),则应填写“01234”。
y Coordinate
(5 位数字):您要触摸的位置的 y 坐标。前 4 位为整数部分,最后一位为小数部分。例如,如果您想在屏幕上触摸(123.4,2432.1),则应填写“24321”。
Moreover
因此,如果您想用手指“3”在屏幕上触摸(123.4,1032.1),只需使用套接字连接到tweak并发送“11030123410321”。
数字 0:“1”表示仅执行一个事件。
第1位:“1”表示事件类型:TOUCH_DOWN(标志位为1)。
数字2-3:“03”表示该事件由手指“3”执行。
数字4-8:“01234”表示x坐标123.4。
数字9-13:“10321”表示y坐标1032.1。
重要的提示 https://github.com/xuan32546/IOS13-SimulateTouch/blob/master/README.md#important-note
The touch coordinate does not depend on the orientation of your device. See picture below to get more information. However you place your device, the click point on the screen will not be changed.