Exemplo n.º 1
0
def hashcompare(md5hash_compare, guess_compare):
    # reference global variables end and attempts
    global end
    global attempts

    # hash the common passwords from the list
    hashedGuess = hashlib.md5(bytes(guess_compare, 'utf-8')).hexdigest()

    # comparing each of the hashed common passwords to the user input to determine if there is a match
    if hashedGuess == md5hash_compare:
        end = time.time()
        # if they match, print the correct guess and stats.
        print("\nThe password is", str(guess_compare))
        if attempts == 1:
            print("It took", str(round((end - start), 6)), "seconds\nand",
                  str(attempts), "attempt to crack your password\n")
        else:
            print("It took", str(round((end - start), 6)), "seconds\nand",
                  str(attempts), "attempts to crack your password\n")
        menulist()

    # or else, if they don't match, continue to the next hashed password and compare those (used to debug.  Commented out the print of each incorrect attempt).
    elif hashedGuess != md5hash_compare:
        # print("Password guess", str(guess_compare), "does not match, trying next...")
        attempts += 1
Exemplo n.º 2
0
	def wordlist(self, wordlist, *words):
		self.wordlist = wordlist
		self.words = list(words)
		self.countTotal = str(len(self.words))

		count = 0
		for word in self.words:
			if(word != ''):
				os.system('clear')
				print(banner)
				md5 = hashlib.md5(word.encode('utf-8'))
				status = bc.BC + ' Hashing: ' + bc.GC + str(word.replace('\n', ''))
				md5Result = md5.hexdigest()
				try:
					count += 1
					print(bc.BC + ' Progress: ' + bc.GC + str(count) + bc.BC + '/' + bc.GC + self.countTotal)
					print(bc.BC + ' Updating Database with wordlist: ' + bc.GC + wordlist)
					print(status + bc.BC + '\t' + bc.RC + md5Result)
					self.db.execute('INSERT OR IGNORE INTO MD5_HASHES(PLAIN_TEXT, HASH) VALUES (?,?) ', (word, md5Result))
					self.conn.commit()
				except sqlite3.IntegrityError:
					continue
			else:
				continue

		os.system('clear')
		print(banner)
		print(sBan + ' Updated Database with wordlist: ' + bc.GC + wordlist)
		print(bc.BC + ' ' + str(count) + ' Hashes successfully added to database')
		input(bc.BC + '\n Press Enter to Continue...\n')
		from brutoNova import brutoNova
		brutoNova()
Exemplo n.º 3
0
 def getWord(self, word : str):
     if(self.verbose):
         print(word+"\n")
     if(self.hashNumber == passwordCracker.SHA1):
         return hashlib.sha1(bytes(word, 'utf-8')).hexdigest()
     if(self.hashNumber == passwordCracker.MD5):
         return hashlib.md5(bytes(word, 'utf-8')).hexdigest()
     return word
Exemplo n.º 4
0
def md5_hash(md5_hashed_string):
    hash_object = hashlib.md5(md5_hashed_string.encode())
    print(hash_object.hexdigest())
    back2menu = input('\nDo you want to choose another option: y/n\n')
    if back2menu == 'y':
        return
    else:
        quit()
Exemplo n.º 5
0
	def single_word(self, word):
		self.plainText = word
		self.md5Result = hashlib.md5(self.plainText.encode('utf-8'))
		self.md5 = self.md5Result.hexdigest()

		try:
			self.db.execute('INSERT OR IGNORE INTO MD5_HASHES(PLAIN_TEXT, HASH) VALUES (?,?) ', (self.plainText, self.md5))
			self.conn.commit()
		except Exception:
			print('\n' + eBan + bc.RC + ' ERROR: ' + bc.BC + 'Hash Failed')
			input(bc.BC + ' Press Enter to Continue...\n')
			from brutoNova import brutoNova
			brutoNova()

		print('\n' + sBan + bc.GC + ' Hash Successfully Added')
		print(bc.BC + ' Plain-Text: ' + bc.GC + self.plainText)
		print(bc.BC + ' Hash: ' + bc.GC + self.md5Result.hexdigest())
		input(bc.BC + '\n Press Enter to Continue...\n')
		os.system('clear')
		print(banner)
		from brutoNova import brutoNova
		brutoNova()
Exemplo n.º 6
0
def md5_crack(md5_string):
    plist = str(
        urlopen(
            'https://raw.githubusercontent.com/cryptshoe/mastersofcyber/main/wordlist.txt'
        ).read(), 'utf-8')
    for guess in plist.split('\n'):
        hashedGuess = hashlib.md5(bytes(guess, 'utf-8')).hexdigest()
        if hashedGuess == md5_string:
            print("\nCongratulations!! The password is ", str(guess))
            back2menu = input('\nDo you want to choose another option: y/n\n')
            if back2menu == 'y':
                return
            else:
                quit()
        elif hashedGuess != md5_string:
            print("Password guess ", str(guess),
                  " does not match, trying next...")
    print("Password not in list. Please try another")
    back2menu = input('\nDo you want to choose another option: y/n\n')
    if back2menu == 'y':
        return
    else:
        quit()
Exemplo n.º 7
0
def get_md5(word):
    return hashlib.md5(bytes(word, 'utf-8')).hexdigest()
Exemplo n.º 8
0
from urllib.request import urlopen, hashlib

sha1_hash = input("Please enter a hash to crack: ")

list = ["polony", "test", "poop", "lice"]
for l in list:
    setpass = bytes(l, 'utf-8')

    hash_objectsha1 = hashlib.sha1(setpass)
    guess_pw_sha1 = hash_objectsha1.hexdigest()

    hash_object_md5 = hashlib.md5(setpass)
    guess_pw_md5 = hash_object_md5.hexdigest()

    if guess_pw_sha1 == sha1_hash:
        print(guess_pw_sha1)
        print("\n The password is:")
        print(setpass)

    if guess_pw_md5 == sha1_hash:
        print(guess_pw_md5)
        print("\n The password is:")
        print(setpass)
Exemplo n.º 9
0
'''
Created by Vedant Christian
Created on 06 / 10 / 2019

You will need to download the file, "rockyou.txt", from the internet as it is a very large file and would not be uploaded onto the repository.
'''

from urllib.request import urlopen, hashlib
import time

MD5Hash = input("Please input the hash to crack.\n>")
HashedMD = hashlib.md5(bytes(MD5Hash, 'utf-8')).hexdigest()

LIST_OF_COMMON_PASSWORDS = str(
    urlopen(
        'https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10-million-password-list-top-10000.txt'
    ).read(), 'utf-8')

for guess in LIST_OF_COMMON_PASSWORDS.split('\n'):
    hashedGuess = hashlib.md5(bytes(guess, 'utf-8')).hexdigest()

    if hashedGuess == HashedMD:
        print("The password is ", str(guess))
        time.sleep(5)

    elif hashedGuess != HashedMD:
        print("Password guess ", str(guess), " does not match, trying next...")

print("Password not in database, we'll get them next time.")
time.sleep(5)
inp1 = input(
Exemplo n.º 10
0
def menulist():
    global attempts
    # resets the number of attempts to 0 for a new attack run.
    attempts = 0
    print(
        "Welcome to the password cracker. \n\n" \
        + "Press 1 if you need to hash your password. \n" \
        + "Press 2 to enter an already hashed password for a dictionary attack. \n" \
        + "Press 3 to enter an already hashed password for a brute force attack. \n" \
        + "Press 4 to exit. \n")
    menu = input("How would you like to proceed:  ")

    # checks to see that the end user entered a number for the menu item - coded by Bobbie
    if menu.isdigit():
        menu = int(menu)
    else:
        print("Please enter a number 1 - 4")
        menulist()

    # if you only have the plaintext password, this will provide an md5 hash of that password, and then prompt user on how to move forward - coded by Nathan
    if menu == 1:

        password = input("\nInput the password to hash:\n>")
        print("\nMD5 hash:\n")
        setpass = bytes(password, 'utf-8')
        hash_object = hashlib.md5(setpass)
        guess_pw = hash_object.hexdigest()
        print(guess_pw)
        print(
            "\nCopy and paste the above hash into the password cracker.\n\nHow would you ready to proceed?"
        )
        passwordhashmenu = input("Press 'd' for Dictionary Attack, " \
                                 + "'b' for Brute Force Attack, " \
                                 + "or any other key to return to the main menu:\n").lower()

        # prompt user on how to move forward - coded by Preston
        if passwordhashmenu == "d":
            dictionaryattack()

        elif passwordhashmenu == "b":
            bruteforceattack()

        else:
            menulist()

    # if you already have an md5 hash, then dictionaryattack() (defined below) will run for a dictionary attack - coded by Nathan
    elif menu == 2:
        dictionaryattack()

    # if you already have an md5 hash, then bruteforceattack() (defined below) will run for a dictionary attack - coded by Preston
    elif menu == 3:
        bruteforceattack()

    # if you select this option the program will end - option added by Bobbie
    elif menu == 4:
        sys.exit("\nThank you for using our password cracking program!\n")

    # if you provide an option other than 1, 2, 3 or 4
    else:
        print("\nInvalid entry.  Try again\n")
        menulist()