diff --git a/main.py b/main.py index e69de29..d238224 100644 --- a/main.py +++ b/main.py @@ -0,0 +1,56 @@ +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)) \ No newline at end of file diff --git a/test.py b/test.py new file mode 100644 index 0000000..648cc49 --- /dev/null +++ b/test.py @@ -0,0 +1,6 @@ +import string + +buchstaben = ['e', 'n', 'i', 'r', 's', 't', 'a', 'd', 'h', 'u', 'l', 'c', 'e', 'g', 'm', 'o', 'b', 'w', 'f', 'k', 'z'] +ziffern = string.digits +gesamt = len(buchstaben) + len(ziffern) +print(gesamt) \ No newline at end of file