逆向17-数位观察

1.网站详情

网址

image

2. 分析

根据响应回来的加密数据可以看出 我们需要对响应进行解密

思路一:搜索关键字decrypt(

image

根据截图可知是AES算法,并且是ECB模式,(比较简单,只需要key就行)

image

n就是key,但是给的是一个数组,我们需要转换一下

u.enc.Utf8.stringify(n)
'QV1f3nHn2qm7i3xrj3Y9K9imDdGTjTu9'

总代码

import requests
from hashlib import md5
import base64
from Crypto.Cipher import AES

headers = {
    'Accept': 'application/json, text/plain, */*',
    'Accept-Language': 'zh-CN,zh;q=0.9',
    'Cache-Control': 'no-cache',
    'Connection': 'keep-alive',
    'Content-Type': 'application/json;charset=UTF-8',
    'Origin': 'https://www.swguancha.com',
    'Pragma': 'no-cache',
    'Referer': 'https://www.swguancha.com/',
    'Sec-Fetch-Dest': 'empty',
    'Sec-Fetch-Mode': 'cors',
    'Sec-Fetch-Site': 'same-site',
    'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36',
    'deviceType': '1',
    'sec-ch-ua': '"Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"macOS"',
}

json_data = {
    'size': 6,
    'current': 1,
    'propertyCode': [
        'DISTRICT_PROP_GJ025_RJDQSCZZ',
        'DISTRICT_PROP_GJ117_NMSYGGQDCYYCLS',
        'DISTRICT_PROP_GJ001_NMHJRK',
    ],
    'dimensionTime': '2019',
    'levelType': 2,
}

response = requests.post('https://app.swguancha.com/client/v1/cPublic/consumer/baseInfo', headers=headers, json=json_data)

# print(response.text)

# (1)base64解码
encrypt_date = base64.b64decode(response.text)

# (2)解密
# 2.1 确认好解密的参数
key = 'QV1f3nHn2qm7i3xrj3Y9K9imDdGTjTu9'.encode() 

# 2.2 创建AES对象
aes = AES.new(key, AES.MODE_ECB) 

# 2.3 对数据进行解密
data = aes.decrypt(encrypt_date).decode()
print(data)
posted @ 2024-10-08 16:45  流年中渲染了微笑  阅读(0)  评论(0)    收藏  举报