For a persistent reverse SSH connection, you can use AutoSSH to set up an SSH session via a wired connection on the target network, or if you've taken the time to set up a 3G connection with USB, it can run completely wireless. AutoSSH is a package that enables you to create persistent outbound SSH connections from the Raspberry Pi to a server that you control sitting somewhere on the Internet. When the Raspberry Pi boots and has a network connection, either wired or 3G, it will automatically call home and establish a secure session to the device.
Follow this example to install and configure AutoSSH on your Kali instance. This can be used to access and carry out your attacks from a remote location.
To begin, install AutoSSH on your Raspberry Pi. This can, and should, be done before using it for your penetration test. Use the
apt-getcommand to install the latest version of autossh from the repository:
#apt-get install autossh