-
Notifications
You must be signed in to change notification settings - Fork 12.4k
/
Copy pathnumeric_password_cracker.py
30 lines (24 loc) · 1.1 KB
/
numeric_password_cracker.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import itertools
def generate_password_permutations(length):
# Generate numeric password permutations of the given length
digits = "0123456789"
for combination in itertools.product(digits, repeat=length):
password = "".join(combination)
yield password
def password_cracker(target_password, max_length=8):
# Try different password lengths and generate permutations
for length in range(1, max_length + 1):
password_generator = generate_password_permutations(length)
for password in password_generator:
if password == target_password:
return password
return None
if __name__ == "__main__":
# Target numeric password (change this to the password you want to crack)
target_password = "9133278"
# Try cracking the password
cracked_password = password_cracker(target_password)
if cracked_password:
print(f"Password successfully cracked! The password is: {cracked_password}")
else:
print("Password not found. Try increasing the max_length or target a different password.")