通过USB连接线ssh到iOS中

感谢楼主很好用啊

这招受用了

adb调试器就是这么干的

请问楼主,远程iOS上的端口:本地OSX/Windows上的端口,怎么查看这些端口?

查看端口是什么意思?你指的是查看开放了哪些端口?命令行里输入

lsof -i

你的帖子中,“本地的2222端口转发到iOS上的22端口”,我不太明白2222,22 指的是什么端口?

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
UserEvent 162 kc 6u IPv4 0xfe9d278539455291 0t0 UDP :
SystemUIS 170 kc 10u IPv4 0xfe9d2785394537e1 0t0 UDP :
sharingd 184 kc 12u IPv4 0xfe9d27853ee88479 0t0 UDP :
syncdefau 1162 kc 11u IPv4 0xfe9d27853e1a9029 0t0 TCP 192.168.10.49:51982->17.167.137.30:https (ESTABLISHED)
syncdefau 1162 kc 13u IPv4 0xfe9d278543499029 0t0 TCP 192.168.10.49:51983->17.167.137.30:https (ESTABLISHED)
syncdefau 1162 kc 17u IPv4 0xfe9d27853e1a9029 0t0 TCP 192.168.10.49:51982->17.167.137.30:https (ESTABLISHED)
syncdefau 1162 kc 19u IPv4 0xfe9d278543499029 0t0 TCP 192.168.10.49:51983->17.167.137.30:https (ESTABLISHED)

这个是 lsof -i 得到的结果,怎么看端口?

ssh的端口是22,把本地的2222端口转发到iOS上的22端口,意思就是说,我向本地2222端口发的包,全都会被转发到iOS的22端口上,所以可以直接ssh到本地的2222端口了

debugserver *:1234 -a “SpringBoard”

我运行这个命令后,报错,错误如下:

/Developer/usr/bin/debugserver *:1234 -a “SpringBoard”
debugserver-189 for armv7.
error: failed to attach to process named: “” unable to start the exception threads

debugserver用ldid签名了吗?

如果用Theos,还需要在Makefile中改下:
THEOS_DEVICE_IP = 127.0.0.1
export THEOS_DEVICE_PORT = 2222

我还以为这个是我回复的

➜ ~ python ~/USBSSH/tcprelay.py -t 22:2223
Forwarding local port 2223 to remote port 22

➜ ~ python ~/USBSSH/tcprelay.py -t 3456:3456
Forwarding local port 3456 to remote port 3456
大神,突然就不能转发端口了,明明昨天都可以的,55555,
发现转发端口后,没有占用端口~~~~
netstat | grep 2222
lsof | grep 2222
都没有找到,有什么好的解决方法吗?已经解决~~~~~~~~原来ssh 必须加-p参数要不然不能识别2222端口

有问题啊狗神你看
xiaomindeiMac:~ xiaomin$ /Users/xiaomin/Desktop/software/IOS_USB_Become_SSH/tcprelay.py
-bash: /Users/xiaomin/Desktop/software/IOS_USB_Become_SSH/tcprelay.py: Permission denied
xiaomindeiMac:~ xiaomin$ sudo /Users/xiaomin/Desktop/software/IOS_USB_Become_SSH/tcprelay.py -t 22:222
sudo: /Users/xiaomin/Desktop/software/IOS_USB_Become_SSH/tcprelay.py: command not found

cd /Users/xiaomin/Desktop/software/IOS_USB_Become_SSH/
chmod +x tcprelay.py
./tcprelay.py -t 22:2222

你的python文件没有可执行权限,像楼上那样操作一下就可以了

哈哈多谢狗神,成功了,无意中发现usbmux的用法,可以用来查看UDID,xiaomindeiMac:IOS_USB_Become_SSH xiaomin$ /Users/xiaomin/Desktop/software/IOS_USB_Become_SSH/usbmux.py -t 22:2222
Waiting for devices…
Devices:
<MuxDevice: ID 514 ProdID 0x12ab Serial ‘0e6605450d4665dc6d093f3b990d11e71125efba’ Location 0x14100000>

学习了。之前一直用iphone上的热点来ssh,iphone热点的ip是172.20.10.1

测试很好用,要是之前白苹果时能用这个方法,或许就不会用半恢复了,