对iOSOpenDev的简单修改,兼容最新theos

首先iOSOpenDev是啥? 他是个直接通过Xcode新建Hook的工程模板,然后编译生成安装deb。

网站:http://www.iosopendev.com/

可惜作者13年就不更新了,最新的还是1.6-2的版本。

这个版本在新版Xcodetheos都存在很多问题。

比如因为新版Xcode找不到某些文件导致安装出错,新版theos的修改导致新建出来的工程编译报错找不到HBLogDebug,以及很多问题。

对于习惯用Xcode来写代码的人,还是有点不能忍的。

所以就把iOSOpenDev的脚本和项目模板拿过来改了改。

暂只支持CaptainHook TweakLogos Tweak

使用起来方便很多。

MonkeyDev

这是我的修改版本。

安装很简单:

git clone https://github.com/AloneMonkey/MonkeyDev.git
cd MonkeyDev/bin
sudo ./md-install

如果不用,运行下面的命令卸载:

sudo ./md-uninstall

然后新建项目就会出现了:

image

iOSOpenDev共存。

当然使用前,你要安装最新版本的theos:

https://github.com/theos/theos/

包括

brew install ldid

然后设备免密码登录:

ssh-keygen -t rsa -P ''
ssh-copy-id -i /Users/用户名/.ssh/id_rsa root@IP

Commonand + B 编译,不安装,设置MonkeyDevInstallOnAnyBuildYES

会自动打包安装到设备。

Command + Shift + i 编译安装,但是这种方式是Release模式。看不到log输出。

在编译设置中可以自定义设备ip和ssh的端口:

image

不设置的话,ip默认为localhost,port默认为2222

当然你也可以在~/.zshrc或其它profile里面设置MonkeyDevDeviceMonkeyDevPort

查看log的会可以使用idevicesyslog查看,毕竟带颜色。。。。

后续

后续会慢慢去完善这个工具,在使用中有什么问题也可以提出来,还是有很多东西需要去改进的。

恩,就这样。。。

3 个赞

Well played

CommandLine无所畏惧

能否增加个 Command-line Tool 支持呢?

新版Xcode不支持iphone平台的command line tool。要弄的话只能改成其它类型应用,然后去提取可执行文件,感觉还不如theos来的方便:joy:

这帖子解决了这个问题,能不能集成进去?

多谢,我看下

已经增加了,有时间帮我测试一下。

我用着两行代码无法实现免密码连接iphone。咋弄啊。

看下/var/root/.ssh/authorized_keys文件中有没有 /Users/用户名/.ssh/id_rsa.pub公钥。

然后尝试

chmod 700 /var/root/.ssh/
chmod 600 /var/root/.ssh/authorized_keys

我尝试过您的方法了。但ssh连接的时候还是需要密码。
iosopendev cmd+shit+i 提示错误
Failed to create directory /var/root/MonkeyDevPackages on device 192.168.4.123
Command /bin/sh failed with exit code 255

我手机系统是iOS9.3.2

/var/root/.ssh/authorized_keys 文件中已经存在公钥了。

/var/root/.ssh/ 和 /var/root/.ssh/authorized_keys 权限也是对的?

ssh -vvv root@xxxx 看下log信息?

/膜
/用大号和小号都给了你Star

膜,Leader是什么级别

什么leader?lea什么der?leader什么?

我手动加的TrustLevel4自动会冒出来那玩意

OpenSSH_7.4p1, LibreSSL 2.5.0
debug1: Reading configuration data /etc/ssh/ssh_config
debug2: resolving “192.168.4.123” port 22
debug2: ssh_connect_direct: needpriv 0
debug1: Connecting to 192.168.4.123 [192.168.4.123] port 22.
debug1: Connection established.
debug1: identity file /Users/mazhipeng/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/mazhipeng/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/mazhipeng/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/mazhipeng/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/mazhipeng/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/mazhipeng/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/mazhipeng/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/mazhipeng/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.7
debug1: match: OpenSSH_6.7 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to 192.168.4.123:22 as ‘root’
debug3: hostkeys_foreach: reading file “/Users/mazhipeng/.ssh/known_hosts”
debug3: record_hostkey: found key type RSA in file /Users/mazhipeng/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from 192.168.4.123
debug3: order_hostkeyalgs: prefer hostkeyalgs: ssh-rsa-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa
debug3: send packet: type 20
debug1: SSH2_MSG_KEXINIT sent
debug3: receive packet: type 20
debug1: SSH2_MSG_KEXINIT received
debug2: local client KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,ext-info-c
debug2: host key algorithms: ssh-rsa-cert-v01@openssh.com,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-ed25519
debug2: ciphers ctos: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc
debug2: ciphers stoc: chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-cbc,aes192-cbc,aes256-cbc
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com,zlib
debug2: compression stoc: none,zlib@openssh.com,zlib
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug2: peer server KEXINIT proposal
debug2: KEX algorithms: curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1
debug2: host key algorithms: ssh-rsa,ssh-dss
debug2: ciphers ctos: aes128-ctr,aes192-ctr,aes256-ctr,chacha20-poly1305@openssh.com
debug2: ciphers stoc: aes128-ctr,aes192-ctr,aes256-ctr,chacha20-poly1305@openssh.com
debug2: MACs ctos: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: MACs stoc: umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
debug2: compression ctos: none,zlib@openssh.com
debug2: compression stoc: none,zlib@openssh.com
debug2: languages ctos:
debug2: languages stoc:
debug2: first_kex_follows 0
debug2: reserved 0
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: compression: none
debug3: send packet: type 30
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug3: receive packet: type 31
debug1: Server host key: ssh-rsa SHA256:nhLgaHWnXjE9U+mDEAS5OFGRX9VSfDnAT8M26t5qCHQ
debug3: hostkeys_foreach: reading file “/Users/mazhipeng/.ssh/known_hosts”
debug3: record_hostkey: found key type RSA in file /Users/mazhipeng/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from 192.168.4.123
debug1: Host ‘192.168.4.123’ is known and matches the RSA host key.
debug1: Found key in /Users/mazhipeng/.ssh/known_hosts:1
debug3: send packet: type 21
debug2: set_newkeys: mode 1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug3: receive packet: type 21
debug1: SSH2_MSG_NEWKEYS received
debug2: set_newkeys: mode 0
debug1: rekey after 134217728 blocks
debug2: key: /Users/mazhipeng/.ssh/id_rsa (0x7f9bf4600830)
debug2: key: /Users/mazhipeng/.ssh/id_dsa (0x0)
debug2: key: /Users/mazhipeng/.ssh/id_ecdsa (0x0)
debug2: key: /Users/mazhipeng/.ssh/id_ed25519 (0x0)
debug3: send packet: type 5
debug3: receive packet: type 6
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug3: send packet: type 50
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: start over, passed a different list publickey,password,keyboard-interactive
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/mazhipeng/.ssh/id_rsa
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /Users/mazhipeng/.ssh/id_dsa
debug3: no such identity: /Users/mazhipeng/.ssh/id_dsa: No such file or directory
debug1: Trying private key: /Users/mazhipeng/.ssh/id_ecdsa
debug3: no such identity: /Users/mazhipeng/.ssh/id_ecdsa: No such file or directory
debug1: Trying private key: /Users/mazhipeng/.ssh/id_ed25519
debug3: no such identity: /Users/mazhipeng/.ssh/id_ed25519: No such file or directory
debug2: we did not send a packet, disable method
debug3: authmethod_lookup keyboard-interactive
debug3: remaining preferred: password
debug3: authmethod_is_enabled keyboard-interactive
debug1: Next authentication method: keyboard-interactive
debug2: userauth_kbdint
debug3: send packet: type 50
debug2: we sent a keyboard-interactive packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug3: userauth_kbdint: disable: no info_req_seen
debug2: we did not send a packet, disable method
debug3: authmethod_lookup password
debug3: remaining preferred:
debug3: authmethod_is_enabled password
debug1: Next authentication method: password

麻烦您帮我解决一下这个问题。这个问题困扰我很久了。一直没办法解决。非常感谢您!

debug1: Offering RSA public key: /Users/mazhipeng/.ssh/id_rsa
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey,password,keyboard-interactive

从这个来看就是公钥验证有问题,ls -l给看下那两个的权限。

把手机/etc/ssh/sshd_config这个文件里面的

RSAAuthentication yes
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys

注释去掉试试

/Users/mazhipeng/.ssh/id_rsa 目录权限
-rw------- 1 mazhipeng staff 1675 6 30 16:05 id_rsa
-rw-r–r-- 1 mazhipeng staff 410 6 30 16:05 id_rsa.pub
-rw-r–r-- 1 mazhipeng staff 395 6 30 15:46 known_hosts

手机上的/etc/ssh/sshd_config文件中
只有RSAAuthentication yes 我已经去掉注释了。
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
这两条文件中没有。