各种 Anti-warning 合规性改动
This commit is contained in:
@@ -26,7 +26,7 @@ class WahlapServerBoomedError(Exception):
|
||||
class Request500Error(Exception):
|
||||
pass
|
||||
|
||||
class aes_pkcs7(object):
|
||||
class AES_PKCS7(object):
|
||||
def __init__(self, key: str, iv: str):
|
||||
self.key = key.encode('utf-8')
|
||||
self.iv = iv.encode('utf-8')
|
||||
@@ -60,20 +60,20 @@ def SDGBApiHash(api):
|
||||
return hashlib.md5((api+"MaimaiChn"+ObfuscateParam).encode()).hexdigest()
|
||||
|
||||
def apiSDGB(data:str, useApi, agentExtraData, noLog=False):
|
||||
'''
|
||||
"""
|
||||
舞萌DX 2024 API 通讯用函数
|
||||
:param data: 请求数据
|
||||
:param useApi: 使用的 API
|
||||
:param agentExtraData: UA 附加信息,机台相关则为狗号(如A63E01E9564),用户相关则为 UID
|
||||
:param noLog: 是否不记录日志
|
||||
'''
|
||||
"""
|
||||
maxRetries = 3
|
||||
|
||||
# 历史遗留代码有时候会传入 int,故先全部转 str
|
||||
agentExtra = str(agentExtraData)
|
||||
|
||||
# 编码好请求,准备发送
|
||||
aes = aes_pkcs7(AesKey,AesIV)
|
||||
aes = AES_PKCS7(AesKey, AesIV)
|
||||
data = data
|
||||
data_enc = aes.encrypt(data)
|
||||
data_def = zlib.compress(data_enc)
|
||||
@@ -145,7 +145,7 @@ def apiSDGB(data:str, useApi, agentExtraData, noLog=False):
|
||||
|
||||
|
||||
def calcSpecialNumber():
|
||||
'''使用 c_int32 实现的 SpecialNumber 算法'''
|
||||
"""使用 c_int32 实现的 SpecialNumber 算法"""
|
||||
rng = random.SystemRandom()
|
||||
num2 = rng.randint(1, 1037933) * 2069
|
||||
num2 += 0x400
|
||||
@@ -159,7 +159,7 @@ def calcSpecialNumber():
|
||||
|
||||
|
||||
def calcSpecialNumber2():
|
||||
'''实验性替代 SpecialNumber 算法'''
|
||||
"""实验性替代 SpecialNumber 算法"""
|
||||
max = 1037933
|
||||
num2 = random.randint(1, max) * 2069
|
||||
|
||||
|
||||
Reference in New Issue
Block a user