Skip to content

Commit

Permalink
feat: warp+ key generator
Browse files Browse the repository at this point in the history
  • Loading branch information
taotao7 committed Jul 13, 2023
1 parent c99f40a commit 843c973
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
11 changes: 11 additions & 0 deletions warp-generator/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[[source]]
url = "https://pypi.tuna.tsinghua.edu.cn/simple"
verify_ssl = true
name = "pip_conf_index_global"

[packages]

[dev-packages]

[requires]
python_version = "3.11"
80 changes: 80 additions & 0 deletions warp-generator/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import random
import httpx
import os
import time
import requests

ppkeys = requests.get('https://gitlab.com/Misaka-blog/warp-script/-/raw/main/files/24pbgen/base_keys')
pkeys = ppkeys.content.decode('UTF8')
keys = pkeys.split(',')
gkeys = []

value_int = int(input("请输入你需要生成的 WARP+ 密钥数量:\n> "))
a = 0

while a < value_int:
a += 1

try:
headers = {
"CF-Client-Version": "a-6.11-2223",
"Host": "api.cloudflareclient.com",
"Connection": "Keep-Alive",
"Accept-Encoding": "gzip",
"User-Agent": "okhttp/3.12.1",
}

with httpx.Client(base_url="https://api.cloudflareclient.com/v0a2223",
headers=headers,
timeout=30.0) as client:

r = client.post("/reg")
id = r.json()["id"]
license = r.json()["account"]["license"]
token = r.json()["token"]

r = client.post("/reg")
id2 = r.json()["id"]
token2 = r.json()["token"]

headers_get = {"Authorization": f"Bearer {token}"}
headers_get2 = {"Authorization": f"Bearer {token2}"}
headers_post = {
"Content-Type": "application/json; charset=UTF-8",
"Authorization": f"Bearer {token}",
}

json = {"referrer": f"{id2}"}
client.patch(f"/reg/{id}", headers=headers_post, json=json)

client.delete(f"/reg/{id2}", headers=headers_get2)

key = random.choice(keys)

json = {"license": f"{key}"}
client.put(f"/reg/{id}/account", headers=headers_post, json=json)

json = {"license": f"{license}"}
client.put(f"/reg/{id}/account", headers=headers_post, json=json)

r = client.get(f"/reg/{id}/account", headers=headers_get)
account_type = r.json()["account_type"]
referral_count = r.json()["referral_count"]
license = r.json()["license"]

client.delete(f"/reg/{id}", headers=headers_get)
gkeys.append(license)
print(f"License Key: {license}\nData Count: {referral_count} of GB(s)")

except:
print("Error occurred.")
time.sleep(15)
if a % 2 == 0:
time.sleep(60)

os.system('cls' if os.name == 'nt' else 'clear')
print("下方为生成的密钥列表,请复制粘贴备用!")
for x in gkeys:
print(x)

input('\n(Enter) to exit.\n')

0 comments on commit 843c973

Please sign in to comment.