Skip to content

Commit 867792b

Browse files
committed
add functionality with generating specified category
1 parent d4e1c92 commit 867792b

3 files changed

Lines changed: 31 additions & 8 deletions

File tree

16 KB
Binary file not shown.
3.21 KB
Binary file not shown.

faststone_Capture_keyGen/keygen.py

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,22 @@ def randomString(stringLength=8):
1414
letters = string.ascii_uppercase
1515
return ''.join(random.choice(letters) for i in range(stringLength))
1616

17+
def generate_8_upper_case():
18+
# Family License that covers up to 5 computers 1111
19+
family_registeration_code = "{0}{1}{2}{3}{4}{5}{6}{7}".format(randomString(1), 'P', randomString(1), 'N', randomString(1), 'K', randomString(1), 'E')
20+
# Educational Site License 4997
21+
education_site_registeration_code = "{0}{1}{2}{3}{4}{5}{6}{7}".format(randomString(1), 'V', randomString(1), 'Q', randomString(1), 'R', randomString(1), 'M')
22+
# Educational Worldwide License 4998
23+
education_worldwide_registeration_code = "{0}{1}{2}{3}{4}{5}{6}{7}".format(randomString(1), 'W', randomString(1), 'Q', randomString(10), 'R', randomString(1), 'M')
24+
# Corporate Site License 4999
25+
Corporate_site_registeration_code = "{0}{1}{2}{3}{4}{5}{6}{7}".format(randomString(1), 'X', randomString(1), 'Q', randomString(1), 'R', randomString(1), 'M')
26+
# Corporate Worldwide License 5000
27+
corporate_worldwide_registeration_code = "{0}{1}{2}{3}{4}{5}{6}{7}".format(randomString(1), 'T', randomString(1), 'R', randomString(1), 'K', randomString(1), 'E')
28+
29+
return [family_registeration_code, education_site_registeration_code, education_worldwide_registeration_code, Corporate_site_registeration_code, corporate_worldwide_registeration_code]
30+
31+
32+
1733
def get_sha_one_value(data, is_hex):
1834
sha_one = hashlib.sha1(data)
1935
if is_hex:
@@ -177,10 +193,10 @@ def middle_8_character():
177193
return upper_character[:4] if len(upper_character) >= 4 else []
178194

179195
def check(data):
180-
first = str(ord(data[4-1]) - ord('M'))
181-
second = str(ord(data[8-1]) - ord('D'))
182-
third = str(ord(data[6-1]) - ord('I'))
183-
forth = str(ord(data[2-1]) - ord('O'))
196+
first = str(ord(data[4-1]) - ord('M')) # 3
197+
second = str(ord(data[8-1]) - ord('D')) # 7
198+
third = str(ord(data[6-1]) - ord('I')) # 5
199+
forth = str(ord(data[2-1]) - ord('O')) # 1
184200
s = first + second + third + forth
185201
if '-' in s:
186202
return False
@@ -192,16 +208,23 @@ def main():
192208
global register_code
193209
username = input('please input a username: ')
194210
username = username.upper()
195-
while True:
196-
register_code = randomString()
211+
registeration_code = generate_8_upper_case()
212+
hint_information = [
213+
"Family License",
214+
"Educational Site License",
215+
"Educational Worldwide License",
216+
"Corporate Site License",
217+
"Corporate Worldwide License"
218+
]
219+
for i in range(len(registeration_code)):
220+
register_code = registeration_code[i]
197221
first = front_8_character() # front 8 character
198222
second = middle_8_character()
199223
if len(first) > 0 and len(second) > 0:
200224
full_register_code = register_code + first + second
201225
result = check(full_register_code)
202226
if result:
203-
print("register code: {0}".format(full_register_code))
204-
break
227+
print("{0}: {1}".format(hint_information[i], full_register_code))
205228

206229

207230

0 commit comments

Comments
 (0)