Skip to content

Instantly share code, notes, and snippets.

@yfe404
Created July 8, 2019 10:04
Show Gist options
  • Save yfe404/99e185ef633f1d4279b53f294f2c3a0d to your computer and use it in GitHub Desktop.
Save yfe404/99e185ef633f1d4279b53f294f2c3a0d to your computer and use it in GitHub Desktop.
Create a persistent reverse shell
IDENTITY="$USER/.ssh/identity.pem"
SRC_PORT=19999
DST_PORT=22
DST_USER=gandalf
DST_HOST=120.88.7.11
autossh -M 0 -N -o ServerAliveInterval 15 -i $IDENTITY -R $SRC_PORT:localhost:$DST_PORT $DST_USER@$DST_HOST
## You can connect back from DST_HOST using ssh -p $SRC_PORT local_user_on_SRC@localhost
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment