登录 ok 了
This commit is contained in:
+8
-3
@@ -5,6 +5,7 @@ import hashlib
|
||||
from Crypto.PublicKey import RSA
|
||||
from Crypto.Cipher import PKCS1_v1_5
|
||||
from Crypto.Cipher import AES
|
||||
from Crypto.Cipher import ARC4
|
||||
|
||||
|
||||
# 斗鱼RSA公钥(从JS中提取)
|
||||
@@ -18,6 +19,9 @@ o2kz+dJoGnZM0b99VwIDAQAB
|
||||
# 斗鱼AES密钥(16位)
|
||||
DOUYU_AES_KEY = "1234567890abcdef"
|
||||
|
||||
# 斗鱼登录页 cryptoData 使用的 RC4 密钥
|
||||
DOUYU_RC4_KEY = "7TkbRSEWvVWebXbr"
|
||||
|
||||
|
||||
def md5(text: str) -> str:
|
||||
"""MD5加密"""
|
||||
@@ -58,6 +62,7 @@ def encrypt_password(password: str) -> str:
|
||||
|
||||
def encrypt_nickname_or_phone(text: str) -> str:
|
||||
"""加密昵称或手机号"""
|
||||
# 斗鱼使用特殊的Base64编码
|
||||
encoded = base64.b64encode(text.encode('utf-8')).decode('utf-8')
|
||||
return encoded
|
||||
key = DOUYU_RC4_KEY.encode('utf-8')
|
||||
cipher = ARC4.new(key)
|
||||
encrypted = cipher.encrypt(text.encode('utf-8'))
|
||||
return base64.b64encode(encrypted).decode('utf-8')
|
||||
|
||||
Reference in New Issue
Block a user