1 import requests 2 import hashlib 3 4 sha1hash = input('Please input the hashed password for cracking.\n>') 5 # sample encrypted password: cbfdac6008f9cab4083784cbd1874f76618d2a97 6 # below is the top 10000 common passwords list 7 url = 'https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10-million-password-list-top-10000.txt' 8 res = requests.get(url).text 9 10 count = 0 11 for i in res.split('\n'): 12 #print(i) 13 hashedGuess = hashlib.sha1(bytes(str(i), 'utf-8')).hexdigest() #或 hashlib.sha1(i.encode('utf-8')).hexdigest() 14 if hashedGuess == sha1hash: 15 print('The password is ', str(i)) 16 break 17 else: 18 print(f'Password {i} does not match') 19 count+= 1 20 print('count: ', count) 21 print('Done') 22
使用hashlib破解password
猜你喜欢
转载自www.cnblogs.com/dyuan8888/p/11926925.html
今日推荐
周排行