tweaselORG / appstraction

An abstraction layer for common instrumentation functions (e.g. installing and starting apps, setting preferences, etc.) on Android and iOS.
MIT License
4 stars 1 forks source link

Fixes #43, tweaselORG/cli#24: Use iproxy for ssh #112

Closed zner0L closed 11 months ago

zner0L commented 12 months ago

This enables SSH connections via USB and minimal setup after the jailbreak. Running (rooted) SSH commands via the mobile user is also supported via this PR. I tested it on freshly jailbroken iOS 15 and 16.

baltpeter commented 11 months ago

When trying to run this, I get an error on both phones:

/home/benni/coding/JS/tweasel/appstraction/src/util.ts:393
        throw new Error(`Usbmux proxy exited with code ${code}: ${proc.stderr?.read()}`);
        ^

Error: Usbmux proxy exited with code 0: Exception ignored in: <module 'threading' from '/home/benni/.cache/autopy/python/3.11.3/lib/python3.11/threading.py'>
Traceback (most recent call last):
  File "/home/benni/.cache/autopy/python/3.11.3/lib/python3.11/threading.py", line 1583, in _shutdown
    lock.acquire()
TypeError: <lambda>() takes 1 positional argument but 2 were given

    at ChildProcess.<anonymous> (/home/benni/coding/JS/tweasel/appstraction/src/util.ts:393:15)
    at ChildProcess.emit (node:events:525:35)
    at ChildProcess.emit (node:domain:489:12)
    at ChildProcess._handle.onexit (node:internal/child_process:291:12)
baltpeter commented 11 months ago

Now, ensureDevice() works but I get this error in installCertificateAuthority() (I uninstalled various Sileo packages to make sure the autosetup is still working):

Installed apps: [
  'com.airbnb.app',
  'com.audible.iphone',
  'com.deliveroo.orderapp',
  'com.deutschebahn.navigator',
  'com.gimb.paydirect',
  'com.okcupid.app',
  'de.check24.check24',
  'de.dwd.warnapp',
  'de.otto.shop',
  'de.wetteronline.RegenRadar',
  'net.whatsapp.WhatsApp'
]
/home/benni/coding/JS/tweasel/appstraction/src/ios.ts:171
                throw new Error(`SSH command failed with exit code ${res.code}: ${res.stderr}`);
                      ^

Error: SSH command failed with exit code 127: [sudo] password for mobile: zsh:1: command not found: sqlite3
    at Object.ssh (/home/benni/coding/JS/tweasel/appstraction/src/ios.ts:171:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at Object.installCertificateAuthority (/home/benni/coding/JS/tweasel/appstraction/src/ios.ts:436:9)
    at <anonymous> (/home/benni/coding/JS/tweasel/appstraction/examples/ios-device.ts:25:9)
baltpeter commented 11 months ago

Oh, I think I've found the problem:

https://github.com/tweaselORG/appstraction/blob/f6ab51ffc4e836953eec1445eb7afc92f7eee9c9/src/ios.ts#L184

Uninstalling sqlite3 left behind this line:

# apt list --installed
libsqlite3-1/stable,now 3.34.1 iphoneos-arm [installed,auto-removable]

That needs to be pL.split().some(l => l.startsWith(p + '/'))[^1].

[^1]: Failing to escape the backtick in the template string I had there originally took me longer than finding a fix. :'D