- 595
- 245
Решил попробовать python. набросал код, вроде работает, но через 505 генераций - крашит
Python:
import hashlib
import random
import string
vals = 0
def random_char(y):
return ''.join(random.choice(string.ascii_letters) for x in range(y))
def Start(vals):
#strInp = input("Введите пароль: ")
strInp = random_char(6)
vals += int(1)
return PassGen(strInp, vals)
def PassGen(str1, vals):
hash = hashlib.md5(str1.encode("UTF-8")).hexdigest()
codeTrue = 0
with open('MD5Default.txt', 'r+') as file:
isFileFound = 0
#print("\n===========================\n MD5 BASE\n===========================\n")
for line in file:
cr, reg = line.split(":")
reg = reg.rstrip()
if cr == hash:
#print("[MD5] Найден пароль: "+reg)
isFileFound = 1
if isFileFound == 0:
#print("[MD5] Пароль не был найден в БД")
file.write(hash+":"+str1+"\n")
codeTrue = 1
#print("[MD5] Записан в БД "+hash+":"+str1)
file.close()
hash1 = hashlib.sha256(str1.encode("UTF-8")).hexdigest()
with open('SHA256Default.txt', 'r+') as file:
isFileFound = 0
#print("\n===========================\n SHA256 BASE\n===========================\n")
for line in file:
cr, reg = line.split(":")
reg = reg.rstrip()
if cr == hash1:
#print("[SHA256] Найден пароль: "+reg)
isFileFound = 1
if isFileFound == 0:
#print("[SHA256] Пароль не был найден в БД")
file.write(hash1+":"+str1+"\n")
codeTrue = 1
#print("[SHA256] Записан в БД "+hash1+":"+str1)
file.close()
hash2 = hashlib.sha512(str1.encode("UTF-8")).hexdigest()
with open('SHA512Default.txt', 'r+') as file:
#print("\n===========================\n SHA512 BASE\n===========================\n")
isFileFound = 0
for line in file:
cr, reg = line.split(":")
reg = reg.rstrip()
if cr == hash2:
#print("[SHA512] Найден пароль: "+reg)
isFileFound = 1
codeTrue = 1
if isFileFound == 0:
#print("[SHA512] Пароль не был найден в БД")
file.write(hash2+":"+str1+"\n")
#print("[SHA512] Записан в БД "+hash2+":"+str1)
file.close()
print(str(vals)+" | "+str1+" ("+str(codeTrue)+")")
str1 = ""
Start(vals)
Start(vals)