本帖最后由 奶昔 于 2024-7-27 00:09 编辑 import base64
import json
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.backends import default_backend
MagicKey = b"41100c93a65cfb71d5b0672c0d60d7ec"
MagicKey2 = b"70ba69d67bf7e61e17ac565c6093a325"[:16]
def create_cipher(key, iv):
return Cipher(algorithms.AES(key), modes.CFB(iv), backend=default_backend())
def MagicKeyEncode(data):
cipher = create_cipher(MagicKey, MagicKey2)
encryptor = cipher.encryptor()
return encryptor.update(data) + encryptor.finalize()
def MagicKeyDecode(data):
cipher = create_cipher(MagicKey, MagicKey2)
decryptor = cipher.decryptor()
return decryptor.update(data) + decryptor.finalize()
_json = {
"id": "", # TODO:请填写您想要的ID
"dayFrom": "1145-01-01", # TODO:请填写您想要的开始日期
"dayTo": "2077-06-04", # TODO:请填写您想要的结束日期
"macAddresses": [],
"requestCode": "",
"hostname": "*",
"company": "", # TODO:请填写您的公司/组织名
"nodes": 114514, # TODO:请填写您的节点数,0为无限制
"updatedAt": 1700000000, # TODO:请填写您的更新时间戳
"components": ["*"],
"edition": "ultra", # TODO:请填写您的版本 basic/pro/ent/maxsub/ultra
"email": "", # TODO:请填写您的邮箱,如果您想填,这个非必填项
"method": "local"
}
_json = json.dumps(_json).encode()
encoded = MagicKeyEncode(_json)
print(base64.b64encode(encoded).decode())
|