Introduction
This is a Python exercise that is used to automatically generate 10,000 sets of random open AI keys and can search for usable keys using Python code.
The code is relatively simple. gen.py is used for generation, and hack.py is used to execute the two py files under the hack folder.
Generation Results
Usage Notes
In fact, when using it, we only need the gen.py file, which can be used to verify whether the key is valid. You can use the API-KEY information query to query at https://chatc.vip/key.html.
The generated keys have randomness and cannot guarantee that they are always valid. It depends on luck.
Random generation code is as follows:
import random
import string
import base64
for key in range(1, 10001):
prefix = "sk-"
random_string = ''.join(random.choices(string.ascii_letters + string.digits, k=36))
encoded_string = base64.b64encode(random_string.encode()).decode()
generated_string = prefix + encoded_string.replace("=", "")
print(f"Key {key} : {generated_string}")
with open("keys_1", "a") as f:
f.write(generated_string + "\n")