-
Notifications
You must be signed in to change notification settings - Fork 166
Expand file tree
/
Copy pathkeygenerator.py
More file actions
34 lines (28 loc) · 866 Bytes
/
keygenerator.py
File metadata and controls
34 lines (28 loc) · 866 Bytes
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
31
32
import os
import random
import sys
# Checks if the key has the correct combination of ASCII values
def bruteforce_key(key):
chsum = 0
for ch in key:
chsum += ord(ch)
sys.stdout.write("{0:3} | {1} \r".format(chsum, key))
sys.stdout.flush()
return chsum
# Creates a key based on all possible characters used in a reasonable password
def initializekey():
key = ""
inc = 0
while True and inc <= 100:
key += random.choice("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_!@#$%^&*")
ascii_code = bruteforce_key(key)
if ascii_code > 916:
key = ""
elif ascii_code==916:
print("Password key: {0}\t{1}".format(key, inc))
inc += 1
def main():
initializekey()
print("100 password options found.")
if __name__ == "__main__":
main()