from random import randint
import time
target_pass = str(randint(1000, 10 ** 4)) #. Генерирую случайный целевой пароль длиной 4 цифры.
start_time = time.time()
int_pass = int(target_pass)
result = None
for next_pass in range(10 ** len(target_pass)):
if next_pass == int_pass:
result = next_pass
break
print(result)
print(time.time() - start_time)
# Далее твой код, но без печати (с печатью вообще не дождаться).
start_time = time.time()
password = target_pass
words = [
1, 2, 3, 4, 5, 6, 7, 8, 9, 0
]
end_password = ''
old = []
length = len(words) - 1
def func():
global end_password
while end_password != password:
for i in range(1_0_0_0_0):
end = ''
for letter in range(len(password)):
guess = words[randint(0, length)]
end += str(guess)
if end not in old:
old.append(end)
if end == password:
end_password = end
else:
pass
# print(f'{end}')
# print(end,end=' ')
func()
print(f'\n\n\n\n\n\tHack : {end_password} | {(time.time() - start_time)}(sec);')