兼容v2,操作cookie前检查CC的key等信息。

This commit is contained in:
ramen
2024-10-28 01:45:44 +08:00
parent 9f283fb3f9
commit 44192f5e67
2 changed files with 36 additions and 28 deletions

View File

@@ -1,9 +1,8 @@
import hashlib
from typing import Dict, Any
import json
import requests
import base64
from hashlib import md5
import hashlib
from Crypto import Random
from Crypto.Cipher import AES
@@ -12,10 +11,10 @@ def bytes_to_key(data: bytes, salt: bytes, output=48) -> bytes:
# 兼容v2 将bytes_to_key和encrypt导入
assert len(salt) == 8, len(salt)
data += salt
key = md5(data).digest()
key = hashlib.md5(data).digest()
final_key = key
while len(final_key) < output:
key = md5(key + data).digest()
key = hashlib.md5(key + data).digest()
final_key += key
return final_key[:output]
@@ -51,7 +50,6 @@ class PyCookieCloud:
resp = requests.get(self.url, timeout=3) # 设置超时为3秒
return resp.status_code == 200
except Exception as e:
print(str(e))
return False
def update_cookie(self, cookie: Dict[str, Any]) -> bool: