Skip to content

Instantly share code, notes, and snippets.

@poweld
Last active October 1, 2015 14:42
Show Gist options
  • Save poweld/120c3041c9d8f26e435a to your computer and use it in GitHub Desktop.
Save poweld/120c3041c9d8f26e435a to your computer and use it in GitHub Desktop.
How to make SSH holes
function deploy_pubkey() {
return $( cat ~/.ssh/id_rsa.pub | `which ssh` "$@" 'cat - >> ~/.ssh/authorized_keys' )
}
function ssh()
{
args="$@"
ssh=`which ssh`
$ssh -oBatchMode=yes $args : 2>&1 >/dev/null
if [ $? -eq 0 ]; then
$ssh $args
else
deploy_pubkey $args
if [ $? -eq 0 ]; then
$ssh $args
else
return 1
fi
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment