介紹
這是個 python 小練習,這是用來自動生成 10000 組隨機 open ai 的 key 並可查找可用 key 的 python 程式碼
程式碼比較簡單,gen.py 用來生成,hack.py 用來執行 hack 檔案下的兩個 py 檔案
生成效果
使用注意
實際上我們在使用時只需要 gen.py 檔案即可,用來驗證 key 是否有效你可以使用 API-KEY 資訊查詢來查詢https://chatc.vip/key.html。
生成的 key 帶有隨機性,不能保證一定是有效的,看運氣。
隨機生成程式碼如下:
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")