🎨 Update ds salt

This commit is contained in:
xtaodada 2022-12-23 23:44:40 +08:00
parent a7eefa8c68
commit 0ca0739903
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
5 changed files with 20 additions and 23 deletions

View File

@ -1,16 +1,15 @@
import asyncio
import json
import random
import qrcode
from io import BytesIO
from string import ascii_letters, digits
from typing import Dict
import qrcode
from genshin.utility import generate_cn_dynamic_secret
from httpx import AsyncClient
from ...logger import logger
from ...utility.helpers import get_device_id
from ...utility.helpers import get_device_id, get_ds
__all__ = ("SignIn",)
@ -66,8 +65,6 @@ class SignIn:
async def get_ltoken_by_game_token(self, game_token: str):
data = {"account_id": self.uid, "game_token": game_token}
headers = {
"x-rpc-app_version": "2.41.2",
"DS": generate_cn_dynamic_secret(body=data, salt="osgT0DljLarYxgebPPHJFjdaxPfoiHGt"),
"x-rpc-aigis": "",
"Content-Type": "application/json",
"Accept": "application/json",
@ -78,9 +75,12 @@ class SignIn:
"x-rpc-device_name": "Chrome 108.0.0.0",
"x-rpc-device_model": "Windows 10 64-bit",
"x-rpc-app_id": "bll8iq97cem8",
"x-rpc-client_type": "4",
"User-Agent": "okhttp/4.8.0",
}
app_version, client_type, ds_sign = get_ds(new_ds=True, data=data)
headers["x-rpc-app_version"] = app_version
headers["x-rpc-client_type"] = client_type
headers["DS"] = ds_sign
res = await self.client.post(
self.GAME_LTOKEN_API,
headers=headers,

View File

@ -54,22 +54,19 @@ def get_ds(ds_type: str = None, new_ds: bool = False, data: Any = None, params:
c = hex_digest(f"salt={salt}&t={t}&r={r}")
return f"{t},{r},{c}"
app_version = "2.36.1"
app_version = "2.41.2"
client_type = "5"
salt = "YVEIkzDFNHLeKXLxzqCA9TzxCpWwbIbk"
salt = "osgT0DljLarYxgebPPHJFjdaxPfoiHGt"
ds = old()
if ds_type in ("android", "2"):
app_version = "2.36.1"
client_type = "2"
salt = "n0KjuIrKgLHh08LWSCYP0WXlVXaYvV64"
salt = "TsmyHpZg8gFAVKTtlPaL6YwMldzxZJxQ"
ds = old()
if ds_type == "android_new":
app_version = "2.36.1"
client_type = "2"
salt = "t0qEgfub6cvueAPgR5m9aQWWVciEer7v"
ds = new()
if new_ds:
app_version = "2.36.1"
client_type = "5"
salt = "xV8v4Qu54lUKrEYFZkJhB8cuOh9Asafs"
ds = new()

View File

@ -51,7 +51,7 @@ class SetUserCookies(Plugin.Conversation, BasePlugin.Conversation):
cookies = {}
v1_keys = ["ltoken", "ltuid", "login_uid", "cookie_token"]
v2_keys = ["ltoken_v2", "ltmid_v2", "account_mid_v2", "cookie_token", "cookie_token_v2", "login_ticket"]
v2_keys = ["ltoken_v2", "ltmid_v2", "account_mid_v2", "cookie_token_v2", "login_ticket", "stoken"]
cookie_is_v1 = None

View File

@ -1,16 +1,14 @@
from typing import Optional
from genshin import Client
from genshin.utility import recognize_genshin_server, generate_dynamic_secret
from genshin.utility import recognize_genshin_server
from modules.apihelper.utility.helpers import hex_digest
from modules.apihelper.utility.helpers import hex_digest, get_ds
AUTHKEY_API = "https://api-takumi.mihoyo.com/binding/api/genAuthKey"
GACHA_HEADERS = {
"User-Agent": "okhttp/4.8.0",
"x-rpc-app_version": "2.28.1",
"x-rpc-sys_version": "12",
"x-rpc-client_type": "5",
"x-rpc-channel": "mihoyo",
"x-rpc-device_id": "",
"x-rpc-device_name": "",
@ -34,7 +32,9 @@ async def get_authkey_by_stoken(client: Client) -> Optional[str]:
device = "Paimon Build " + device_id[0:5]
headers["x-rpc-device_name"] = device
headers["x-rpc-device_model"] = device
ds = generate_dynamic_secret("ulInCDohgEs557j0VsPDYnQaaz6KJcv5")
headers["ds"] = ds
app_version, client_type, ds_sign = get_ds()
headers["x-rpc-app_version"] = app_version
headers["x-rpc-client_type"] = client_type
headers["ds"] = ds_sign
data = await client.cookie_manager.request(AUTHKEY_API, method="POST", json=json, headers=headers)
return data.get("authkey")

View File

@ -204,13 +204,13 @@ class BaseClient:
else:
device_id = DEVICE_ID
ds_sign = generate_dynamic_secret("ulInCDohgEs557j0VsPDYnQaaz6KJcv5")
ua = get_ua(device="Paimon Build " + device_id[0:5], version="2.40.0")
app_version, _, ds_sign = get_ds()
ua = get_ua(device="Paimon Build " + device_id[0:5], version=app_version)
add_headers = {
"User-Agent": ua,
"Referer": "https://www.miyoushe.com/ys/",
"x-rpc-device_id": get_device_id(device_id),
"x-rpc-app_version": "2.40.0",
"x-rpc-app_version": app_version,
"x-rpc-client_type": "4",
"ds": ds_sign,
}