Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
2024 committed Jan 25, 2025
1 parent ce1af47 commit 987eeab
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 22 deletions.
26 changes: 20 additions & 6 deletions jd_wsck.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,9 @@ def main():
if os.path.exists("/ql/config/auth.json"):
config="/ql/config/auth.json"
envtype="ql"

if os.path.exists("/ql/data/db/keyv.sqlite"):
config="/ql/data/db/keyv.sqlite"
envtype="ql_latest"
if os.path.exists("/ql/data/config/auth.json"):
config="/ql/data/config/auth.json"
envtype="ql"
Expand Down Expand Up @@ -499,9 +501,21 @@ def main():
url = 'http://127.0.0.1:5678/openApi/count'
headers = {'Content-Type': 'application/json', 'Authorization': 'Bearer ', 'api-token': f'{token}'}
datas = get(url, headers=headers).json()["data"]["accountCount"]

# printf(f"token:{token}")
# printf(f"datas:{datas}")
elif envtype == "ql_latest":
with open(config, "r", encoding="latin1") as f1:
content = f1.read()
matches = re.search(r'token":"([^"]+)"', content)
try:
token = matches.group(1)
except Exception as e:
sys.exit(0)
url = 'http://127.0.0.1:5600/api/envs'
headers = {'Authorization': f'Bearer {token}'}
body = {
'searchValue': 'JD_WSCK',
'Authorization': f'Bearer {token}'
}
datas = get(url, params=body, headers=headers).json()['data']


if datas > 0 if isinstance(datas, int) else len(datas) > 0:
Expand All @@ -510,7 +524,7 @@ def main():
printf("\n错误:没有需要转换的JD_WSCK,退出脚本!")
return

if envtype == "ql":
if envtype in ('ql','ql_latest'):
for data in datas:
randomuserAgent()
if data['status']!=0:
Expand All @@ -527,7 +541,7 @@ def main():
else:
newpin=getRemark(pin,token)
if "fake_" in cookie:
message = f"pin为{newpin}的wskey过期了!"
message = f"{newpin}的wskey过期了!"
printf(message)
url = 'http://127.0.0.1:5600/api/envs/disable'
try:
Expand Down
26 changes: 18 additions & 8 deletions jd_wskey.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,24 @@ def ql_login() -> str: # 方法 青龙登录(获取Token 功能同上)
path = '/ql/config/auth.json' # 设置青龙 auth文件地址
if not os.path.isfile(path):
path = '/ql/data/config/auth.json' # 尝试设置青龙 auth 新版文件地址
if os.path.isfile(path): # 进行文件真值判断
with open(path, "r") as file: # 上下文管理
auth = file.read() # 读取文件
file.close() # 关闭文件
auth = json.loads(auth) # 使用 json模块读取
username = auth["username"] # 提取 username
password = auth["password"] # 提取 password
token = auth["token"] # 提取 authkey
if not os.path.isfile(path):
path_latest = '/ql/data/db/keyv.sqlite' # 尝试设置青龙 auth 新版文件地址
if os.path.isfile(path) or os.path.isfile(path_latest): # 进行文件真值判断

if os.path.isfile(path):
with open(path, "r") as file: # 上下文管理
auth = file.read() # 读取文件
file.close() # 关闭文件
auth = json.loads(auth) # 使用 json模块读取
username = auth["username"] # 提取 username
password = auth["password"] # 提取 password
token = auth["token"] # 提取 authkey
else:
with open(path_latest, "r", encoding="latin1") as file:
auth = file.read() # 读取文件
matches = re.search(r'token":"([^"]+)"', auth)
token = matches.group(1)

try:
twoFactorSecret = auth["twoFactorSecret"]
except Exception as err:
Expand Down
8 changes: 0 additions & 8 deletions jd_xnqf_draw.js

This file was deleted.

0 comments on commit 987eeab

Please sign in to comment.