Tài liệu STouchSTouch Documentation

Engine tự động hoá iOS cho iPhone jailbreak (RootHide). Viết Lua, điều khiển qua HTTP/Cloud.iOS automation engine for jailbroken iPhones (RootHide). Write Lua, control over HTTP/Cloud.

Giới thiệuOverview

STouch gồm: engine.dylib (inject SpringBoard, tổng hợp sự kiện HID), http server :8090 (điều khiển qua REST + Web IDE), vision (dò màu/khớp ảnh), và agent (nối VPS để điều khiển từ xa). Chạy trên iPhone 6s iOS 15.8.x, RootHide.STouch consists of: engine.dylib (injects SpringBoard, synthesizes HID events), http server :8090 (REST control + Web IDE), vision (color/template matching), and an agent (dials a VPS for remote control). Runs on iPhone 6s, iOS 15.8.x, RootHide.

Cài đặtInstallation

Thêm repo vào Sileo rồi cài gói STouch:Add the repo to Sileo and install the STouch package:

https://sileo.companyus.info

Kiến trúcArchitecture

Thành phầnComponentVai tròRole
engine.dylibInject SpringBoard, tổng hợp digitizer/HID (tap, vuốt, phím), chạy Lua.Injects SpringBoard, synthesizes digitizer/HID (tap, swipe, keys), runs Lua.
http :8090REST điều khiển + phục vụ Web IDE + screenshot.REST control + serves the Web IDE + screenshots.
visionfindColor / findImage đọc framebuffer.read the framebuffer.
agentDial-out VPS qua WSS → điều khiển từ xa mọi mạng.Dials a VPS over WSS → remote control on any network.

Điều khiển từ xa (Cloud Relay)Remote control (Cloud Relay)

Agent trên phone chủ động nối ra VPS bằng WebSocket, browser nói chuyện với VPS qua HTTPS → né chặn Private Network Access của Chrome. Không cần cùng mạng với phone.The on-phone agent connects out to the VPS over WebSocket; the browser talks to the VPS over HTTPS → bypasses Chrome's Private Network Access block. No shared network with the phone required.

Lua API — Hệ thốngSystem

HàmFunctionMô tảDescription
sleep(s)Ngủ (giây, hỗ trợ số thực).Sleep (seconds, floats supported).
usleep(us)Ngủ theo micro-giây.Sleep in microseconds.
toast(str)Hiện thông báo nổi trên màn.Show a floating toast on screen.
log(str)Ghi log (xem qua /log).Write to the log (view via /log).
execute(cmd)Chạy shell (posix_spawn), trả stdout.Run a shell command (posix_spawn), returns stdout.
rootDir()Thư mục gốc script.Script root directory.
getVersion() · getSN() · getLocalIP()Phiên bản engine · serial · IP LAN.Engine version · serial · LAN IP.

Lua API — Chạm & vuốtTouch & swipe

HàmFunctionMô tảDescription
tap(x, y)Chạm 1 phát tại (x,y).Single tap at (x,y).
touchDown(id, x, y)Ngón id xuống — multi-touch từng ngón.Finger id down — per-finger multi-touch.
touchMove(id, x, y)Di ngón id tới (x,y).Move finger id to (x,y).
touchUp(id, x, y)Nhấc ngón id.Lift finger id.

Vuốt = touchDown → nhiều touchMovetouchUp. Giữ (long-press) = down rồi sleep rồi up.Swipe = touchDown → several touchMovetouchUp. Long-press = down, then sleep, then up.

Lua API — Bàn phímKeyboard

HàmFunctionMô tảDescription
inputText(str)Gõ chuỗi vào ô đang focus (kể cả UTF-8).Type a string into the focused field (UTF-8 included).
keyDown(usage) · keyUp(usage)Nhấn/nhả phím theo HID usage (vd Backspace (0x07<<16)|0x2A, Enter |0x28).Press/release a key by HID usage (e.g. Backspace (0x07<<16)|0x2A, Enter |0x28).
keyboard(show)Hiện/ẩn bàn phím.Show/hide the keyboard.

Lua API — Màn hìnhScreen

HàmFunctionMô tảDescription
getScreenResolution()Trả w, h (6s = 750×1334).Returns w, h (6s = 750×1334).
getColor(x, y)Màu pixel tại (x,y).Pixel color at (x,y).
screenshot(path)Chụp màn ra file PNG.Capture the screen to a PNG file.
rgbToInt(r,g,b)Gộp RGB thành int để so màu.Pack RGB into an int for color comparison.

Lua API — Vision

HàmFunctionMô tảDescription
findColor(x1,y1,x2,y2, color, [t])Tìm pixel màu color trong vùng — trả x, y hoặc nil.Find a pixel of color in the region — returns x, y or nil.
findImage(path, [t])Khớp mẫu ảnh trên màn thật — trả x, y tâm khớp hoặc nil.Match a template image on the live screen — returns the match center x, y or nil.
local x,y = findImage("/var/mobile/tmpl/next.png", 0.9)
if x then tap(x,y) end

Lua API — App & mạngApp & network

HàmFunctionMô tảDescription
appActivate(bundle) · appRun(bundle)Mở/đưa app lên trước.Launch / bring an app to the foreground.
appState(bundle) · appInfo(bundle)Trạng thái / thông tin app.App state / info.
setVPN("on"/"off")Bật/tắt VPN đầu tiên (vd Shadowrocket).Toggle the first VPN (e.g. Shadowrocket).
setWifi(on) · setAirplaneMode(on)Wifi / máy bay.Wi-Fi / airplane mode.

Lua API — Dialog & PlistDialog & Plist

HàmFunctionMô tảDescription
dialog(spec)Hiện form nhập (Label/Input/CheckBox/Switch) — trả bảng kết quả, chặn tới khi bấm OK.Show an input form (Label/Input/CheckBox/Switch) — returns a result table, blocks until OK.
alert(msg)Hộp thoại thông báo.A message dialog.
vibrate()Rung.Vibrate.
readPlist(path) · writePlist(path, tbl)Đọc/ghi plist.Read/write a plist.
clipText([str])Đọc / ghi clipboard.Read / write the clipboard.

HTTP API — Endpoints

Cổng :8090 trên phone, hoặc qua relay /stouchr/<device-id>/…Port :8090 on the phone, or via relay /stouchr/<device-id>/…

Method · PathMô tảDescription
GET /deviceInfoModel, iOS, độ phân giải, tên máy.Model, iOS, resolution, device name.
GET /screenshotPNG màn hình hiện tại.PNG of the current screen.
POST /touch?phase=down|move|up&x=&y=Sự kiện chạm HID (dùng cho tap & vuốt).HID touch event (used for tap & swipe).
POST /tap?x=&y=Chạm nhanh 1 phát.Quick single tap.
POST /homeVề màn hình chính.Go to the home screen.
POST /run (body = Lua)Chạy đoạn Lua tức thì.Run a Lua snippet immediately.
POST /runfile?name=Chạy file script theo tên.Run a script file by name.
POST /stopDừng script đang chạy.Stop the running script.
GET /files · /file/read · POST /file/writeQuản lý file script.Manage script files.
POST /file/new · /file/delete · /file/renameTạo/xoá/đổi tên file & thư mục.Create/delete/rename files & folders.
GET /log · POST /log/clearĐọc / xoá log.Read / clear the log.
# Tap máy phone36 qua relayTap device phone36 via relay
curl -X POST "https://stouch.companyus.info/stouchr/phone36/tap?x=375&y=667"

# Chạy Lua qua relayRun Lua via relay
curl -X POST "https://stouch.companyus.info/stouchr/phone36/run" \
     --data 'toast("hello"); tap(200,400)'