FastMoss 国际电商Tiktok数据分析 JS 逆向 | MD5加密

1.目标

目标网址:https://www.fastmoss.com/zh/e-commerce/saleslist


切换周榜出现目标请求

只有请求头fm-sign签名加密

2.逆向分析

直接搜fm-sign

可以看到 i["fm-sign"] = A

进入encryptParams方法

里面有个S()方法加密,是MD5加密

3.代码示例

js代码示例

javascript 复制代码
const crypto = require('crypto')


function MD5Encrypt(e) {
    return crypto.createHash("md5").update(e.toString()).digest("hex")
}

function encryptParams(e) {
    this.salt = "LAA6edGHBkcc3eTiOIRfg89bu9ODA6PB"
    let t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : ""
      , o = Object.keys(e).sort()
      , n = "";
    o.forEach(t => {
        n += t + e[t] + this.salt
    }
    );
    let r = MD5Encrypt(n + t)
      , a = ""
      , i = 0
      , s = r.length - 1;
    for (; i < r.length && !(i >= s); i++,
    s--)
        a += (parseInt(r[i], 16) ^ parseInt(r[s], 16)).toString(16);
    return a + r.substring(i)
}

let S =   {
    _time: Math.floor(Date.now() / 1e3),
    cnonce: Math.floor(1e7 + 9e7 * Math.random())
}
    , r = {
    "time": 1748321467,
    "system": "windows",
    "platform": 1,
    "id": 206,
    "type": 1,
    "ext": {
        "uri": "https://www.fastmoss.com/zh/e-commerce/newProducts",
        "_src": null
    }
} ,
    d = JSON.stringify(r),
    A = encryptParams({...S}, d);
console.log(A)

python代码示例

python 复制代码
import hashlib
import json
import random
import time

# MD5 加密
def md5_encrypt(data):
    return hashlib.md5(str(data).encode('utf-8')).hexdigest()

# 加密函数 encryptParams
def encrypt_params(e, t=""):
    salt = "LAA6edGHBkcc3eTiOIRfg89bu9ODA6PB"

    # 排序后的 key 列表
    keys = sorted(e.keys())

    n = ""
    for key in keys:
        n += f"{key}{e[key]}{salt}"

    r = md5_encrypt(n + t)
    a = ""
    i = 0
    s = len(r) - 1

    while i < len(r) and i < s:
        # 将十六进制字符转为整数,异或后再转回十六进制
        char_i = r[i]
        char_s = r[s]
        xor_result = int(char_i, 16) ^ int(char_s, 16)
        a += format(xor_result, 'x')  # 转为十六进制字符
        i += 1
        s -= 1

    a += r[i:]
    return a


S = {
    '_time': int(time.time()),
    'cnonce': random.randint(1e7, 1e8)
}

r = {
    "time": 1748321467,
    "system": "windows",
    "platform": 1,
    "id": 206,
    "type": 1,
    "ext": {
        "uri": "https://www.fastmoss.com/zh/e-commerce/newProducts",
        "_src": None
    }
}

d = json.dumps(r, separators=(',', ':'))

A = encrypt_params(S, d)
print(A)

请求不要sign也是可以的

相关推荐
伊玛目的门徒8 分钟前
HTTP SSE 流式响应处理:调用腾讯 智能应用开发平台ADP智能体的 API
python·网络协议·http·腾讯智能体·adp·智能应用开发平台
倔强的小石头_11 分钟前
Python 从入门到实战(八):类(面向对象的 “对象模板”)
服务器·开发语言·python
qq_2147826144 分钟前
GWalkR,部分替代Tableau!
ide·python·jupyter
Yuner20001 小时前
Python机器学习:从零基础到深度实战
人工智能·python·机器学习
猿究院_xyz1 小时前
微信小程序与echarts联动安卓真机测试出现黑色阴影
前端·javascript·微信小程序·小程序·echarts
r i c k1 小时前
办公小程序开发----提高工作效率
python·python程序开发
wha the fuck4041 小时前
(渗透脚本)TCP创建连接脚本----解题----极客大挑战2019HTTP
python·网络协议·tcp/ip·网络安全·脚本书写
qq_356196951 小时前
day39模型的可视化和推理@浙大疏锦行
python
深蓝电商API1 小时前
从 “能爬” 到 “稳爬”:Python 爬虫中级核心技术实战
开发语言·爬虫·python
ASD123asfadxv1 小时前
基于YOLO11的汽车车灯状态识别与分类_C3k2-wConv改进_1
分类·数据挖掘·汽车