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也是可以的

相关推荐
上单带刀不带妹17 分钟前
JavaScript 中的宏任务与微任务
开发语言·前端·javascript·ecmascript·宏任务·微任务
AI视觉网奇1 小时前
音频获取长度
java·前端·python
寄思~1 小时前
学习笔记:封装和单继承
开发语言·笔记·python·学习
E_ICEBLUE1 小时前
Python 操作 Word 文档:主流库对比与选择指南
开发语言·经验分享·python·word·办公自动化
zwjapple1 小时前
Next.js 中使用 MongoDB 完整指南
开发语言·javascript·mongodb
倔强青铜三1 小时前
苦练Python第38天:input() 高级处理,安全与异常管理
人工智能·python·面试
像素之间1 小时前
elementui中rules的validator 用法
前端·javascript·elementui
小高0072 小时前
🚀把 async/await 拆成 4 块乐高!面试官当场鼓掌👏
前端·javascript·面试
大模型真好玩2 小时前
深入浅出LangChain AI Agent智能体开发教程(六)—两行代码LangChain Agent API快速搭建智能体
人工智能·python·agent
2401_837088502 小时前
AJAX快速入门 - 四个核心步骤
前端·javascript·ajax