You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
2.0 KiB
56 lines
2.0 KiB
import string, itertools
|
|
from progress.bar import Bar
|
|
|
|
# buchstaben = string.ascii_uppercase + string.ascii_lowercase + string.digits
|
|
anfangsbuchstaben = ('S', 's', 'K', 'k', 'A', 'a', 'P', 'p', 'B', 'b', 'M', 'm', 'D', 'd', 'E', 'e', 'I', 'i', 'W', 'w')
|
|
buchstaben = ('e', 'n', 'i', 'r', 's', 't', 'a', 'd', 'h', 'u', 'l', 'c', 'e', 'g', 'm', 'o', 'b', 'w', 'f', 'k', 'z')
|
|
ziffern = tuple(string.digits)
|
|
test_passwort = "Saal"
|
|
LINE_UP = '\033[1A'
|
|
LINE_CLEAR = '\x1b[2K'
|
|
DEBUG = False
|
|
|
|
|
|
def get_time_forMax(MaxChoices):
|
|
# maxSek = int(MaxChoices / 309598)
|
|
maxSek = int(MaxChoices / 200000)
|
|
max = int(maxSek/60)
|
|
if max > 60:
|
|
max = int(max/60)
|
|
if max > 24:
|
|
max = int(max/24)
|
|
return f"{max} Days"
|
|
return f"{max}h"
|
|
else:
|
|
return f"{max}min"
|
|
|
|
|
|
def get_choices(letters: list) -> int:
|
|
choices = 1
|
|
maxZeichen = len(buchstaben) + len(ziffern)
|
|
for i in letters:
|
|
choices += pow(maxZeichen, i)
|
|
return choices * len(anfangsbuchstaben)
|
|
|
|
|
|
def crack_password(letter_range: range) -> None:
|
|
num_versuch = 0
|
|
maxChoices = get_choices(list(letter_range))
|
|
print("Möglichkeiten: {:,}".format(maxChoices))
|
|
print(f"MaxTime/100% Power: {get_time_forMax(maxChoices)}")
|
|
for num in letter_range:
|
|
for anfang in anfangsbuchstaben:
|
|
|
|
for versuch in itertools.product(buchstaben+ziffern, repeat=num-1):
|
|
versuch = "".join(versuch)
|
|
versuch = anfang + versuch
|
|
print("Aktuell: {:,}".format(num_versuch), f" Versuch: {versuch}") if DEBUG else None
|
|
print(LINE_UP, end=LINE_CLEAR) if DEBUG else None
|
|
num_versuch += 1
|
|
if versuch == test_passwort:
|
|
print(f"\n\nRichtiges Passwort lautet: {versuch}","\nNötige Versuche: {:,}".format(num_versuch))
|
|
return
|
|
|
|
minChoice = input("please enter choices: ")
|
|
|
|
crack_password(range(int(minChoice), int(minChoice)+1)) |