debug bridge for iPhone / shell command prompt

可紊 提交于 2021-02-07 12:24:59

问题


For Android there is ADB (Android debug bridge) which allows to get a shell on the connected device:

adb shell

Is there something similar for iOS?

I'd like to type some shell commands on my Mac that would be executed on the connected iPhone.
Is there a built-in Terminal on iPhone?


回答1:


There isn't anything for it built in, but if you are jailbroken or can sideload apps (a.k.a., you have a mac with XCode), you can run a local terminal with apps like MobileTerminal, which aren't available on the app store.

To access a shell from a computer, if you are jailbroken (and possibly even if you aren't, if you can sideload apps) you can install openssh or openssh-server from Cydia (I believe it is just called "OpenSSH" in the GUI). Once that is running on your device, you can connect the device over USB and use this shell script I made called idb to access a shell, push and pull files, and so on. This sets up a USB link to relay TCP packets from the SSH server on the device, and then 'wraps' around SSH and SCP to perform the required tasks.

You'll have to compile a program to make it work called iproxy; this program relays TCP over the USB bus to allow ssh over a cable. The comments in the script I wrote explain how to do this (sorry... I plan to move it into README.md eventually).

The program follows most of the syntax of adb and implements some of the more commonly used operations of it.

Without jailbreaking, your options are more limited, but it may be possible to do something. I haven't tried since I don't regularly use iOS anymore.




回答2:


use ssh through network (e.g. Wi-Fi), and iphone/ipad need download and enable ssh service, firstly.



来源:https://stackoverflow.com/questions/17353010/debug-bridge-for-iphone-shell-command-prompt

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!