本帖最后由 hebeijianke 于 2024-7-27 23:39 编辑
[Python] 纯文本查看 复制代码 import requests
import time
from Crypto.Cipher import AES
from hashlib import md5
from base64 import b64encode
from urllib.parse import unquote, unquote_plus, quote, quote_plus
def md5_hash(data):
"""对字符串进行MD5散列并返回其十六进制表示"""
hash_object = md5(data.encode('utf-8')).hexdigest()
return hash_object.encode('utf-8')
def aes_encrypt(data, key, iv):
"""使用AES CBC模式加密明文"""
cipher = AES.new(key, AES.MODE_CBC, iv)
encrypted_text = cipher.encrypt(data.encode())
return b64encode(encrypted_text).decode('utf-8')
def sign(data):
plaintext = md5(data.encode('utf-8')).hexdigest()
key = md5_hash(plaintext)
iv = b'3cccf88181408f19'
encrypted = aes_encrypt(plaintext, key, iv)
return encrypted
url = quote('https://v.qq.com/x/cover/mzc00200yxnj6nj/n41009m0vya.html', safe='')
headers = {
'Host': '122.228.8.29:4433',
'Origin': 'https://jx.xmflv.com',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:128.0) Gecko/20100101 Firefox/128.0',
}
tm = int(round(time.time() * 1000))
payload = {
'wap': 1,
'url': url,
'time': tm,
'key': sign(f"{tm}{url}")
}
con_url = f'https://122.228.8.29:4433/xmflv.js'
res = requests.post(con_url, headers=headers, data=payload)
print(res.status_code)
print(res.text)
可以了 |