mirror of
https://github.com/ovosimpatico/quebrando-senhas.git
synced 2026-01-15 16:12:52 -03:00
More efficient word generation
This commit is contained in:
@@ -35,37 +35,17 @@ def senhas(senha_com_nome):
|
|||||||
return listadesenhas, listadenomes
|
return listadesenhas, listadenomes
|
||||||
|
|
||||||
def combinations():
|
def combinations():
|
||||||
#Gera todas as combinações de palavras possíveis
|
# Generate all possible combinations of words from the "palavras.txt" file
|
||||||
#com as palavras do arquivo "palavras.txt"
|
|
||||||
from rich.progress import track
|
from rich.progress import track
|
||||||
from src.generic import lista
|
from src.generic import lista
|
||||||
lista = lista()
|
words = lista()
|
||||||
listafinal = []
|
combinations = []
|
||||||
|
|
||||||
lista1 = list(product(lista, repeat=1))
|
|
||||||
lista2 = list(product(lista, repeat=2))
|
|
||||||
lista3 = list(product(lista, repeat=3))
|
|
||||||
lista4 = list(product(lista, repeat=4))
|
|
||||||
lista5 = list(product(lista, repeat=5))
|
|
||||||
listatotal = lista1 + lista2 + lista3 + lista4 + lista5
|
|
||||||
|
|
||||||
for i in track(range(len(listatotal)), "Computando as combinações..."):
|
for n in range(1, 6):
|
||||||
if len(listatotal[i]) == 1:
|
for combo in track(product(words, repeat=n), f"Computing {n}-word combinations..."):
|
||||||
listafinal.append(listatotal[i][0])
|
combinations.append(" ".join(combo))
|
||||||
|
|
||||||
elif len(listatotal[i]) == 2:
|
return combinations
|
||||||
listafinal.append(listatotal[i][0]+' '+listatotal[i][1])
|
|
||||||
|
|
||||||
elif len(listatotal[i]) == 3:
|
|
||||||
listafinal.append(listatotal[i][0]+' '+listatotal[i][1]+' '+listatotal[i][2])
|
|
||||||
|
|
||||||
elif len(listatotal[i]) == 4:
|
|
||||||
listafinal.append(listatotal[i][0]+' '+listatotal[i][1]+' '+listatotal[i][2]+' '+listatotal[i][3])
|
|
||||||
|
|
||||||
elif len(listatotal[i]) == 5:
|
|
||||||
listafinal.append(listatotal[i][0]+' '+listatotal[i][1]+' '+listatotal[i][2]+' '+listatotal[i][3]+' '+listatotal[i][4])
|
|
||||||
|
|
||||||
return listafinal
|
|
||||||
|
|
||||||
def criptografaCombinacoes(combinacoes):
|
def criptografaCombinacoes(combinacoes):
|
||||||
#Criptografa todas as combinações geradas
|
#Criptografa todas as combinações geradas
|
||||||
|
|||||||
Reference in New Issue
Block a user