mirror of
https://github.com/baiqwerdvd/ArknightsUID.git
synced 2025-05-04 19:17:33 +08:00
123
This commit is contained in:
parent
610d91672a
commit
89bd33fe63
@ -38,8 +38,8 @@ async def get_resp_msg(bot: Bot, ev: Event):
|
|||||||
logger.info(code.text)
|
logger.info(code.text)
|
||||||
login.token_by_phone_code(code.text)
|
login.token_by_phone_code(code.text)
|
||||||
# login.post_account_info_hg()
|
# login.post_account_info_hg()
|
||||||
login.user_oauth2_v2_grant()
|
await login.user_oauth2_v2_grant()
|
||||||
login.generate_cred_by_code()
|
await login.generate_cred_by_code()
|
||||||
uid = login.ark_uid
|
uid = login.ark_uid
|
||||||
skd_uid = login.skland_userId
|
skd_uid = login.skland_userId
|
||||||
|
|
||||||
|
@ -137,7 +137,13 @@ class SklandLogin:
|
|||||||
self.token = data.token
|
self.token = data.token
|
||||||
self.get_ark_uid()
|
self.get_ark_uid()
|
||||||
|
|
||||||
def user_oauth2_v2_grant(self):
|
async def user_oauth2_v2_grant(self):
|
||||||
|
self.client.headers["platform"] = "3"
|
||||||
|
self.client.headers["vName"] = "1.0.0"
|
||||||
|
self.client.headers["origin"] = "https://zonai.skland.com/"
|
||||||
|
self.client.headers["referer"] = "https://zonai.skland.com/"
|
||||||
|
self.client.headers["dId"] = await get_d_id()
|
||||||
|
self.client.headers["timestamp"] = str(int(datetime.now().timestamp()))
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
ARK_USER_OAUTH2_V2_GRANT,
|
ARK_USER_OAUTH2_V2_GRANT,
|
||||||
json={"appCode": "4ca99fa6b56cc2ba", "token": self.token, "type": 0},
|
json={"appCode": "4ca99fa6b56cc2ba", "token": self.token, "type": 0},
|
||||||
@ -173,13 +179,13 @@ class SklandLogin:
|
|||||||
result_data = response.json()
|
result_data = response.json()
|
||||||
self.ark_uid: str = result_data["data"]["uid"]
|
self.ark_uid: str = result_data["data"]["uid"]
|
||||||
|
|
||||||
def generate_cred_by_code(self):
|
async def generate_cred_by_code(self):
|
||||||
self.client.headers["platform"] = "3"
|
self.client.headers["platform"] = "3"
|
||||||
self.client.headers["vName"] = "1.0.0"
|
self.client.headers["vName"] = "1.0.0"
|
||||||
self.client.headers["origin"] = "https://zonai.skland.com/"
|
self.client.headers["origin"] = "https://zonai.skland.com/"
|
||||||
self.client.headers["referer"] = "https://zonai.skland.com/"
|
self.client.headers["referer"] = "https://zonai.skland.com/"
|
||||||
|
self.client.headers["dId"] = await get_d_id()
|
||||||
self.client.headers["timestamp"] = str(int(datetime.now().timestamp()))
|
self.client.headers["timestamp"] = str(int(datetime.now().timestamp()))
|
||||||
self.client.headers["dId"] = get_d_id()
|
|
||||||
response = self.client.post(
|
response = self.client.post(
|
||||||
GENERATE_CRED_BY_CODE,
|
GENERATE_CRED_BY_CODE,
|
||||||
json={"code": self.code, "kind": 1},
|
json={"code": self.code, "kind": 1},
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
# https://gitee.com/FancyCabbage/skyland-auto-sign/blob/master/SecuritySm.py
|
# ID: 1
|
||||||
|
# 来自https://gitee.com/FancyCabbage/skyland-auto-sign/blob/master/SecuritySm.py
|
||||||
|
# 协议:MIT(https://gitee.com/FancyCabbage/skyland-auto-sign/blob/master/LICENSE)
|
||||||
import base64
|
import base64
|
||||||
import gzip
|
import gzip
|
||||||
import hashlib
|
import hashlib
|
||||||
@ -8,13 +10,13 @@ import json
|
|||||||
import time
|
import time
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import httpx
|
|
||||||
from cryptography.hazmat.decrepit.ciphers.algorithms import TripleDES
|
from cryptography.hazmat.decrepit.ciphers.algorithms import TripleDES
|
||||||
from cryptography.hazmat.primitives import serialization
|
from cryptography.hazmat.primitives import serialization
|
||||||
from cryptography.hazmat.primitives.asymmetric import padding
|
from cryptography.hazmat.primitives.asymmetric import padding
|
||||||
from cryptography.hazmat.primitives.ciphers.algorithms import AES
|
from cryptography.hazmat.primitives.ciphers.algorithms import AES
|
||||||
from cryptography.hazmat.primitives.ciphers.base import Cipher
|
from cryptography.hazmat.primitives.ciphers.base import Cipher
|
||||||
from cryptography.hazmat.primitives.ciphers.modes import CBC, ECB
|
from cryptography.hazmat.primitives.ciphers.modes import CBC, ECB
|
||||||
|
from httpx import AsyncClient
|
||||||
|
|
||||||
# 查询dId请求头
|
# 查询dId请求头
|
||||||
devices_info_url = "https://fp-it.portal101.cn/deviceprofile/v4"
|
devices_info_url = "https://fp-it.portal101.cn/deviceprofile/v4"
|
||||||
@ -130,7 +132,7 @@ def get_tn(o: dict):
|
|||||||
|
|
||||||
for i in sorted_keys:
|
for i in sorted_keys:
|
||||||
v = o[i]
|
v = o[i]
|
||||||
if isinstance(v, (int, float)):
|
if isinstance(v, int | float):
|
||||||
v = str(v * 10000)
|
v = str(v * 10000)
|
||||||
elif isinstance(v, dict):
|
elif isinstance(v, dict):
|
||||||
v = get_tn(v)
|
v = get_tn(v)
|
||||||
@ -147,7 +149,7 @@ def get_smid():
|
|||||||
return v + smsk_web + "0"
|
return v + smsk_web + "0"
|
||||||
|
|
||||||
|
|
||||||
def get_d_id() -> str:
|
async def get_d_id() -> str:
|
||||||
# storageName = '.thumbcache_' + md5(SM_CONFIG['organization']) // 用于从本地存储获得值
|
# storageName = '.thumbcache_' + md5(SM_CONFIG['organization']) // 用于从本地存储获得值
|
||||||
# uid = uuid()
|
# uid = uuid()
|
||||||
# priId=md5(uid)[0:16]
|
# priId=md5(uid)[0:16]
|
||||||
@ -190,21 +192,22 @@ def get_d_id() -> str:
|
|||||||
|
|
||||||
des_result = _AES(GZIP(_DES(des_target)), priId.encode("utf-8"))
|
des_result = _AES(GZIP(_DES(des_target)), priId.encode("utf-8"))
|
||||||
|
|
||||||
response = httpx.post(
|
async with AsyncClient() as client:
|
||||||
devices_info_url,
|
response = await client.post(
|
||||||
json={
|
devices_info_url,
|
||||||
"appId": "default",
|
json={
|
||||||
"compress": 2,
|
"appId": "default",
|
||||||
"data": des_result,
|
"compress": 2,
|
||||||
"encode": 5,
|
"data": des_result,
|
||||||
"ep": ep,
|
"encode": 5,
|
||||||
"organization": SM_CONFIG["organization"],
|
"ep": ep,
|
||||||
"os": "web", # 固定值
|
"organization": SM_CONFIG["organization"],
|
||||||
},
|
"os": "web", # 固定值
|
||||||
)
|
},
|
||||||
|
)
|
||||||
resp = response.json()
|
response.raise_for_status()
|
||||||
|
resp = response.json()
|
||||||
if resp["code"] != 1100:
|
if resp["code"] != 1100:
|
||||||
raise Exception("did计算失败,请联系作者")
|
raise Exception("通过本地计算 did 失败,请联系机器人所有者调整 did 获取方式!")
|
||||||
# 开头必须是B
|
# 开头必须是B
|
||||||
return "B" + resp["detail"]["deviceId"]
|
return "B" + resp["detail"]["deviceId"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user