本文介绍了是否可以在越狱的 ios 上使用外部键盘模拟触摸事件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 ios 越狱和越狱涉及的所有元素上按下财政外部键盘(通过摄像头连接套件或蓝牙的 USB)上的特定键来模拟特定屏幕坐标中的触摸事件?

我会用它来用我的脚按下应用程序中的按钮(幅度),我想将键盘用作脚踏开关.

仅供私人使用.没有 Appstore 或 Cydia.谢谢.

解决方案

你可以在电脑上编写脚本,并基于模拟触摸库使用键盘和鼠标来控制你的 iOS 设备.

iOS13-SimulateTouch 是一个开源库,允许您在系统级别模拟触摸事件.您可以使用任何编程语言编写脚本,以远程或本地模拟 iOS 设备上的触摸事件.请查看

Event Count(1 位):指定单个事件的计数.如果您有多个事件要同时发送,只需增加事件计数并将事件附加到数据中即可.

在单个事件中

Type(1 位):指定单个事件的类型.

支持的事件类型:

  1. 事件:Touch Up.标志:0.说明:将事件指定为触摸事件
  2. 事件:触地得分.标志:1. 说明:将事件指定为触地事件
  3. 事件:触摸移动.Flag:2. 描述:指定事件为触摸移动事件(移动手指)
  4. 事件:设置大小.Flag: 9. Description: 设置屏幕大小(必填!!下面会解释)

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";为此.

此外

因此,如果您想用手指3"触摸 (123.4, 1032.1)在屏幕上,只需使用套接字连接到调整并发送11030123410321".

数字 0:1"表示只有一个事件要执行.

数字 1:1"表示事件类型:TOUCH_DOWN(标志为1).

数字 2-3:03"表示此事件由手指3"执行.

数字 4-8:01234"表示 x 坐标 123.4.

数字 9-13:10321"表示 y 坐标 1032.1.

重要说明

触摸坐标不取决于设备的方向.请参阅下图以获取更多信息.无论您如何放置设备,屏幕上的点击点都不会改变.

Is possible to simulate a touch event in specific screen's coordinates pressing a specific key on a fisical external keyboard (usb via camera connection kit or bluetooth) on ios jailbroken and all the elements that jailbreak involves?

I would use this to press a button in an app (amplitude) with my foot, i want to use a keyboard as a footswitch.

Just for a private use. No Appstore or Cydia.Thanks.

解决方案

You can write scripts on your computer and use your keyboard and mouse to control your iOS device based on the simulate touch library.

iOS13-SimulateTouch is an open-source library that allows you to simulate touch events at the system level. You can write scripts using any programming languages to simulate touch events on your iOS devices either remotely or locally. Please check the source code at [Github] iOS13-SimulateTouch


IOS13-SimulateTouch

iOS 11.0 - 13.6 system-level touch simulation iOS13 simuate touch

Jailbroken device required

Description

This library enables you to simulate touch events on iOS 11.0 - 13.6 with just one line of code! All the source code will be released later.

Features

  1. Multitouch supported (no other library you can find supports multi touching).
  2. Programmable. Control scripts can be programmed with all the programming languages you desire.
  3. Instant controlling supported. The ios device can be controlled with no latency from other devices/computers.
  4. System-level touch simulation (will not inject to any process).

Installation

  1. Open Cydia - Sources - Edit - Add - http://47.114.83.227 ("http" instead of "https"!!! Please double check this.)
  2. Install "ZJXTouchSimulation" tweak
  3. Done

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()

Actually the touch is performed by only one line:

s.send(("1"+formatSocketData(TOUCH_DOWN, 7, 300, 400)).encode())

Neat and easy.

Perform Touch Move

s.send(("1"+formatSocketData(TOUCH_MOVE, 7, 800, 400)).encode())  # tell the tweak to move our finger "7" to (800, 400)

Perform Touch Up

s.send(("1"+formatSocketData(TOUCH_UP, 7, 800, 400)).encode())  # tell the tweak to touch up our finger "7" at (800, 400)

Combining them

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())

First the finger touches (300, 400), and then it moves to (800, 400), and then "leaves" the screen. All the touch events are performed with no latency.

Usage

  1. After installation, the tweak will start listening at port 6000.
  2. Use socket to send touch data field to the tweak

data field should always be decimal digits, specified below

NOTE: Usage might be updated in the future. I will update this post but please keep track on github at Usage_iOS13-SimulateTouch

Event Count(1 digit): Specify the count of the single events. If you have multiple events to send at the same time, just increase the event count and append events to the data.

Inside a single event

Type(1 digit): Specify the type of the single event.

Supported event type:

  1. Event: Touch Up. Flag: 0. Description: Specify the event as a touch-up event
  2. Event: Touch Down. Flag: 1. Description: Specify the event as a touch-down event
  3. Event: Touch Move. Flag: 2. Description: Specify the event as a touch-move event (move the finger)
  4. Event: Set Size. Flag: 9. Description: Set screen size (required!! Will be explained below)

Touch Index(2 digits): Apple supports multitouch, so you have to specify the finger index when posting touching events. The range of finger index is 1-20 (0 is reserved, don't use 0 as finger index).

x Coordinate(5 digits): The x coordinate of the place you want to touch. The first 4 digit is for integer part while the last one is for the decimal part. For example, if you want to touch (123.4, 2432.1) on the screen, you should fill "01234" for this.

y Coordinate(5 digits): The y coordinate of the place you want to touch. The first 4 digit is for integer part while the last one is for the decimal part. For example, if you want to touch (123.4, 2432.1) on the screen, you should fill "24321" for this.

Moreover

So if you want to touch down (123.4, 1032.1) with finger "3" on the screen, just connect to the tweak using socket and send "11030123410321".

Digit 0: "1" indicates there is only one event to perform.

Digit 1: "1" indicates event type: TOUCH_DOWN (the flag is 1).

Digit 2-3: "03" indicates this event is performed by finger "3".

Digit 4-8: "01234" indicates the x coordinate 123.4.

Digit 9-13: "10321" indicates the y coordinate 1032.1.

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.

这篇关于是否可以在越狱的 ios 上使用外部键盘模拟触摸事件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-29 21:45