Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import time
- import hashlib
- import string
- import sys
- global yes
- global no
- global listPassword
- answer = True
- yes = {'yes','y', 'ye', ''}
- no = {'no','n'}
- lowerCase = list(string.ascii_lowercase)
- upperCase = list(string.ascii_uppercase)
- special = list(string.punctuation)
- numbers = list(string.digits)
- startTime = time.time()
- maxAttempts = 9
- def crack():
- global realPassword
- realPassword = input("Enter your password:")
- password_hash = hashlib.md5(realPassword.encode('utf-8')).hexdigest()
- with open(r'C:\Users\Me\Desktop\Password Cracker\dictionary.txt', 'r') as f:
- words = list(f)
- for word in words:
- word_hash = hashlib.md5(word.strip().encode()).hexdigest()
- if word_hash == password_hash:
- return word
- #else:
- # print("Your Password has not been cracked")
- # choice = input("Your password was not cracked, do you want to try another password?: ")
- #if choice in yes:
- # attempts += 1
- #elif choice in no:
- # sys.exit()
- def main():
- while answer == True:
- password = crack()
- if password:
- print('-Stats-')
- print('The password is: {0}'.format(password))
- print('time: ' + str((time.time() - startTime)) + ' sec')
- else:
- print("Your Password has not been cracked")
- listPassword = list(realPassword)
- lowerCheck = any(i in listPassword for i in lowerCase)
- upperCheck = any(i in listPassword for i in upperCase)
- specialCheck = any(i in listPassword for i in special)
- numbersCheck = any(i in listPassword for i in numbers)
- if lowerCheck is False:
- print("Your password contains no lower case letters, this makes it a weak password.")
- if upperCheck is False:
- print("Your password contains no upper case letters, this makes it a weak password.")
- if numbersCheck is False:
- print("Your password contains no numbers, add some to make it a stronger password")
- if special is False:
- print("Your password contains no special characters, add some to increase the strength of your pasword.")
- choice = input("Do you want to continue").lower()
- if choice in yes:
- continue
- elif choice in no:
- break
- #password = crack()
- #if password:
- # print('-Stats-')
- # print('The password is: {0}'.format(password))
- # print('time: ' + str((time.time() - startTime)) + ' sec')
- if __name__ == "__main__":
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement