- Učlanjen(a)
- 12.07.2013
- Poruke
- 675
- Poena
- 195
Kod:
import hashlib
hashesfile = open ("user_file.txt")
lines = hashesfile.readlines()
hashesfile.close()
passwordsfile = open ("dictionary.txt")
pswds = passwordsfile.readlines()
passwordsfile.close()
userpass = {} # Dictionary for storing user+pass combos
for line in lines:
cutIndex = line.find(':')
username = line[:cutIndex]
password = line[cutIndex+1:]
userpass[username] = password # fill in the dict
for pswd in pswds:
[B]hashed_pswd = hashlib.sha1(pswd.encode('utf-8')).hexdigest()[/B]
for combination in userpass:
if hashed_pswd == userpass.get(combination):
print("---MATCH FOUND---MATCH FOUND---")
userpass[combination] = pswd
print(userpass)
Boldovao sam ovo sto je kljucno. U pitanju je python program koji koristi dictionary sa nekim siframa da nadje koja od tih se poklapa sa nekim pass hash-om (sha1 hash). Ovo je vezba za faks, naravno da niko normalan nece cuvati sifre uz pomoc sha1. Iz nekog razloga, nijedna od ovih hash-a iz dictionary se ne poklapa sa bilo kojom od datih hash-eva. Imam utisak kao da mi ovo boldovano ne valja, jer daje pogresan hash? Gde gresim?