iOS逆向之三 authorized_keys ssh登陸越獄手機免驗證設置

iOS逆向之三-authorized_keys ssh登陸越獄手機免驗證設置

默認狀況下使用ssh登陸到iPhone每次都是須要輸入密碼的,比較繁瑣,能夠配置ios的authorized_keys和電腦端的一致來簡化這個步驟ios

電腦配置

刪除 ~/.ssh/known_hosts文件的配置

known_hosts 的文件以下git

➜  .ssh cat known_hosts  
192.168.8.220 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7ZyuWzvOD7ZvO4cvz+OI9npOmCLkqIPIEMUg+A0/TL3MxB+KGEC7XaEI4tZb/617w9sIJbH0LeXlwAb7be0lrLDntXnH9mQV0DcI94mfOmMKCZtzBcPiHqYVFiEXi4Gtdn2Ki8wH8s5EvIB+Xtad2ZCoR9KpDFxINw9SkMvxAK5zO6RkoQbe8EHKK2986d+QrnT39HfqymP744RhCABuSkGTyeIFBYJlqjUT+HocLfIrF4MBdQul4JJa7rcm7F3NDp+DLryAh6/yJRsXSlM2RcdkbvhD2Cvvd+YJCcD0LPht1Nibf91htvd2glUjoU4DpIUwd7RI8OvVH+QETXjO9
192.168.8.215 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7ZyuWzvOD7ZvO4cvz+OI9npOmCLkqIPIEMUg+A0/TL3MxB+KGEC7XaEI4tZb/617w9sIJbH0LeXlwAb7be0lrLDntXnH9mQV0DcI94mfOmMKCZtzBcPiHqYVFiEXi4Gtdn2Ki8wH8s5EvIB+Xtad2ZCoR9KpDFxINw9SkMvxAK5zO6RkoQbe8EHKK2986d+QrnT39HfqymP744RhCABuSkGTyeIFBYJlqjUT+HocLfIrF4MBdQul4JJa7rcm7F3NDp+DLryAh6/yJRsXSlM2RcdkbvhD2Cvvd+YJCcD0LPht1Nibf91htvd2glUjoU4DpIUwd7RI8OvVH+QETXjO9
複製代碼

好比說你的iPhone手機IP是192.168.8.215,那麼就把這一項的配置刪除,刪除以後的配置以下便可。bash

➜  .ssh cat known_hosts  
192.168.8.220 ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC7ZyuWzvOD7ZvO4cvz+OI9npOmCLkqIPIEMUg+A0/TL3MxB+KGEC7XaEI4tZb/617w9sIJbH0LeXlwAb7be0lrLDntXnH9mQV0DcI94mfOmMKCZtzBcPiHqYVFiEXi4Gtdn2Ki8wH8s5EvIB+Xtad2ZCoR9KpDFxINw9SkMvxAK5zO6RkoQbe8EHKK2986d+QrnT39HfqymP744RhCABuSkGTyeIFBYJlqjUT+HocLfIrF4MBdQul4JJa7rcm7F3NDp+DLryAh6/yJRsXSlM2RcdkbvhD2Cvvd+YJCcD0LPht1Nibf91htvd2glUjoU4DpIUwd7RI8OvVH+QETXjO9
複製代碼

生成authorized_keys

➜  ~ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/aron/.ssh/id_rsa): 
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /Users/aron/.ssh/id_rsa.
Your public key has been saved in /Users/aron/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:EH+sVXPn72+iXqGMLMEXMtuW9/PNlZcvOixBXezJWBo aron@aron-MacBook-Pro.local
The key's randomart image is: +---[RSA 2048]----+ | . o.. .| | o . .Eo+o | | . + =. O ..| | o O.o+ + .| | S.= . . .| | =.+ o oo| | . ooo +o+| | .. o.o+B| | o++ +*| +----[SHA256]-----+ 複製代碼

拷貝authorized_keys文件dom

➜  ~ cd ~/.ssh
➜  .ssh cp id_rsa.pub ~/authorized_keys
複製代碼

ios手機配置

iPhone:/User root# ssh-keygen 
Generating public/private rsa key pair.

Enter file in which to save the key (/var/root/.ssh/id_rsa): Created directory '/var/root/.ssh'.
Enter passphrase (empty for no passphrase): 
Enter same passphrase again: 
Your identification has been saved in /var/root/.ssh/id_rsa.
Your public key has been saved in /var/root/.ssh/id_rsa.pub.
The key fingerprint is:
de:f8:4c:d6:32:9b:6d:68:c9:c0:f5:17:29:3c:94:1e root@iPhone
The key's randomart image is: +---[RSA 2048]----+ | . | | E | | + . . | | . = o | | .S. . o . | | .oo .. . | | oo*o.. | | ==*. | | .=.. | +-----------------+ 複製代碼

退出ssh登陸,拷貝電腦的authorized_keys文件到iPhone中ssh

iPhone:/User root# logout
Connection to 192.168.1.86 closed.
➜  theos git:(master) ✗ scp ~/authorized_keys root@192.168.1.86:/var/root/.ssh
The authenticity of host '192.168.1.86 (192.168.1.86)' can't be established. RSA key fingerprint is SHA256:1X8esSMK4inAEDTDKkfVoI+YeFxcatt9HVZONu9UG7M. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.1.86' (RSA) to the list of known hosts. root@192.168.1.86's password: 
authorized_keys                                                                               100%  409     3.6KB/s   00:00    
複製代碼

從新登陸,這時候就不須要密碼了,包括在tweak的時候也是不用繁瑣的密碼輸入步驟了。ide

➜  theos git:(master) ✗ ssh root@192.168.1.86
複製代碼
相關文章
相關標籤/搜索