A, install,Productivity AIDS on the Mac(optional)

Second, the introduction of

1. We often do things on the Mac terminal by typing commands.

2. IOS and Mac OS X are both based on Darwin, so iOS also supports terminal command line operations.

3. In reverse engineering, we often manipulate the iPhone from the command line.

4. In order for the Mac command line to work on the iPhone, we have to connect the Mac to the iPhone.

5. Establish a connection by remotely logging in to iPhone through Mac.

Three,SSHOpenSSH

  • IOS Reverse programming (6) SSH, OpenSSH, SSL, OpenSSL introduction and relationship

  • SSH:

    • Secure ShellAn abbreviation of, meaningSecure shell protocolIs a protocol that provides security for remote login
    • useSSHCan encrypt all transmitted data,A middlemanThe attack is impossible. It can be preventedDNSDeception andIPSpoofing, intercept tampering with data.
  • OpenSSH:

    • isSSHFree open source implementation of the protocol.
    • Can be achieved byOpenSSHIn a way thatMacLog in remotely toiPhone.

Four, the use ofOpenSSHLog in remotely toiPhoneTo installOpenSSH

  • OpenSSH is not supported on iPhone by default, we need to install OpenSSH via Cydia (apt.saurik.com)

  • Open Cydia and search OpenSSH to install it. If you can’t find the software source above, it should be available by default. If you have network problems, you are advised to change the network environment. (Attached: Cydia Store installation)

Five,OpenSSHUsing the step

1. SSH communicates over TCP, so make sure your Mac and iPhone are on the same LOCAL area network, such as WiFi.

2. Then on the Mac terminal, enter the command in the format of SSH account name @server host address to connect to iPhone.

3. There are two common iOS accounts: root and Mobile

  • Root: the highest permission account, $HOME(path) is /var/root

  • Mobile: a common permission account that can only operate common files but not OS files. $HOME(path) is /var/mobile

4. The account name is root.

5, the server host address is the IP address, the computer and mobile phone are connected to a Wifi, and then open the mobile phone Settings -> unlimited LAN -> click the exclamation mark behind your Wifi connection -> then see the IP address.

6. Then use SSH [email protected] from the command line (the default OpenSSH password is alpine).

Dengzemiaodemacbook-pro :~ Dengzemiao $SSH [email protected] // This IP address is The authenticity of Host '10.0.89.184 (10.0.89.184)' can't be established. Two so as not to have the same IP address of the server as RSA key fingerprint is SHA256: TmFvst8CU2JJqrFZ1QIANzprd1rUckdYjV4lcVaS8Gk. / / ask if you sure connections, SSH /known_hosts: $ssh-keygen -r 10.0.89.184: $SSH -keygen -r 10.0.89.184: $SSH -keygen -r 10.0.89.184 Then return to the question Are you sure you want to continue connecting (yes/no)? The default password for OpenSSH is Alpine, so you can enter it directly. There is also a tutorial for changing the password [email protected]'s password: // If the input is successful, you are in the iPhone. You can run the following commands to open the iPhone:~ root# // exit Logout Connection to 10.0.89.184 Closed.Copy the code

Six, modify,root,mobileUser login password

1. Log in to the root account. Only the root account has the permission to modify.

2. Change the password of user root

-Pro:~ dengzemiao$SSH [email protected] // Enter old password [email protected]'s password: IPhone :~ root# passwd Changing password for root. // Enter the New password New password: // Enter the new password Retype new password:Copy the code

3. Change the password of the mobile account and also change the password of the root account

// Run the passwd command to change the password, passwd mobile: IPhone :~ root# passwd mobile Changing password for mobile. // Enter New password: // Enter the new password Retype new password:Copy the code

Seven, (with extended knowledge) according to the above link mobile phone ask, how to view the comparison of public and private keys?

If the connection is confirmed, the public key will be stored in the ~/.ssh/known_hosts folder.

SSH file dengzemiaodeMacBook-Pro:~ dengzemiao$CD ~/. SSH // Display list file dengzemiaodeMacBook-Pro:. SSH dengzemiao$ls Pub known_hosts // Check the known_hosts file dengzemiaodemacbook-pro :. SSH dengzemiao$cat known_hosts....... There's a bunch of other port numbers that I'm going to skip, 10.0.89.184 Ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCHckZZQzMFLhuHGwSQleU13ygF7Kv5URZSw88L1MtpL1jRo+Sa6IvNF9HMKScLxRed+XPSorBlt7vxaQbvSd2ESeqn 3EW52S44z3Jnc4R4jUPfLqd1QgGbXbXc8emnTnqXv/o6aZcWQNlcNX8WBRJuXU5Tfr8NX9Sp8nERi2tiRKx01uh4S5eAEr7TUXE+Vh5kcXU6m0jQWsqTnwz3 nHNTYlKyGz5qCpU/RufhavTxeaQyE9MH3E7RxTpjeSuYb3xNF7p3emXqnlrSZx3/RCvPMELDMiFlUCRRWxVCm6TtvUAkFwS6sMgT1lDWJvsF8ycr3qgUkkgw BAwsp +ZCz6xx // Public key of client computer see, SSH dengzemiao$SSH [email protected] [email protected]'s password: /etc/ssh/iphone :~ root# CD /etc/ssh/iphone :~ root# CD /etc/ssh/iphone Open the public key file iPhone:/etc/ssh root# cat ssh_host_rsa_key.pub ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCHckZZQzMFLhuHGwSQleU13ygF7Kv5URZSw88L1MtpL1jRo+Sa6IvNF9HMKScLxRed+XPSorBlt7vxaQbvSd2ESeqn 3EW52S44z3Jnc4R4jUPfLqd1QgGbXbXc8emnTnqXv/o6aZcWQNlcNX8WBRJuXU5Tfr8NX9Sp8nERi2tiRKx01uh4S5eAEr7TUXE+Vh5kcXU6m0jQWsqTnwz3 nHNTYlKyGz5qCpU/RufhavTxeaQyE9MH3E7RxTpjeSuYb3xNF7p3emXqnlrSZx3/RCvPMELDMiFlUCRRWxVCm6TtvUAkFwS6sMgT1lDWJvsF8ycr3qgUkkgw bAwsp+ZCz6xxCopy the code