小工具知识网

当前位置: 首页 > 行业知识 > cp文书

行业知识

cp文书

2026-11-15 17:07:48 来源:互联网转载

一:首次请求

可以发现 是rs5反爬

套了下药x监x局的环境代码 稍微改了下后

运行自调用js的时候 , 要补的环境也是 document.scripts

和药x监x局有一点区别就是 第二段自执行js里面有个return ret 直接删除这段代码就行了

同版本的瑞 数 不同网站检测点会有点不一样 但大致的流程都是一样的

生成cookie之后

成功访问

之后查看接口数据

可以发现 接口有个 HifJzoc9 参数 这个同理药#监#局 通过XMLHttpRequest.prototype.open方法调用之后 生成

然后这里面这个post请求有这些参数 ciphertext __RequestVerificationToken

ciphertext在其 strToBinary.js文件里面能看到

这里面会调用一个random方法 在其他js文件里面也能找到

random = function (size) {    var str = "",        arr = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'];    for (var i = 0; i  

然后里面还用到了DES3对象 也能找到 都扣出来

var DES3 = {    iv: function() {        return formatDate(new Date(), "yyyyMMdd")    },    encrypt: function(b, c, a) {        if (c) {            return (CryptoJS.TripleDES.encrypt(b, CryptoJS.enc.Utf8.parse(c), {                iv: CryptoJS.enc.Utf8.parse(a || DES3.iv()),                mode: CryptoJS.mode.CBC,                padding: CryptoJS.pad.Pkcs7            })).toString()        }        return ""    },    decrypt: function(b, c, a) {        if (c) {            return CryptoJS.enc.Utf8.stringify(CryptoJS.TripleDES.decrypt(b, CryptoJS.enc.Utf8.parse(c), {                iv: CryptoJS.enc.Utf8.parse(a || DES3.iv()),                mode: CryptoJS.mode.CBC,                padding: CryptoJS.pad.Pkcs7            })).toString()        }        return ""    }};

这里面就用到了crypto-js库 需要安装 npm install crypto-js 然后最后调用了strToBinary函数

function strTobinary(str) {var result = [];var list = str.split("");for (var i = 0; i  

这几个函数都扣出来之后 ciphertext的值就生成了

至于这个__RequestVerificationToken

// 创建页面访问唯一标识$("body").append('');

可以发现 也是调用的random函数 参数是24

二.接口数据解密

这里会发现 无论是 列表页还是详情页 数据都是加密的

这里分析到 加密的数据 可以通过DES3里面的 decrypt函数解密

key就是接口返回的secretKey result就是加密数据了

直接调用就行了 ,该补的函数就补

完整js

const CryptoJS = require('crypto-js')formatDate = function(v, format) {            if (!v)                return "";            var d = v;            if (typeof v === 'string') {                if (v.indexOf("/Date(") > -1)                    d = new Date(parseInt(v.replace("/Date(", "").replace(")/", ""), 10));                else                    d = new Date(Date.parse(v.replace(/-/g, "/").replace("T", " ").split(".")[0]));                // 用来处理出现毫秒的情况,截取掉.xxx,否则会出错            } else if (typeof v === "number") {                d = new Date(v);            }            var o = {                "M+": d.getMonth() + 1,                // month                "d+": d.getDate(),                // day                "h+": d.getHours(),                // hour                "m+": d.getMinutes(),                // minute                "s+": d.getSeconds(),                // second                "q+": Math.floor((d.getMonth() + 3) / 3),                // quarter                "S": d.getMilliseconds()// millisecond            };            format = format || "yyyy-MM-dd";            if (/(y+)/.test(format)) {                format = format.replace(RegExp., (d.getFullYear() + "").substr(4 - RegExp..length));            }            for (var k in o) {                if (new RegExp("(" + k + ")").test(format)) {                    format = format.replace(RegExp., RegExp..length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));                }            }            return format;        };var DES3 = {    iv: function() {        return formatDate(new Date(), "yyyyMMdd")    },    encrypt: function(b, c, a) {        if (c) {            return (CryptoJS.TripleDES.encrypt(b, CryptoJS.enc.Utf8.parse(c), {                iv: CryptoJS.enc.Utf8.parse(a || DES3.iv()),                mode: CryptoJS.mode.CBC,                padding: CryptoJS.pad.Pkcs7            })).toString()        }        return ""    },    decrypt: function(b, c, a) {        if (c) {            return CryptoJS.enc.Utf8.stringify(CryptoJS.TripleDES.decrypt(b, CryptoJS.enc.Utf8.parse(c), {                iv: CryptoJS.enc.Utf8.parse(a || DES3.iv()),                mode: CryptoJS.mode.CBC,                padding: CryptoJS.pad.Pkcs7            })).toString()        }        return ""    }};parseJSON = function(b) {        if (JSON && JSON.parse)            return JSON.parse(b + "");        var c, d = null, e = n.trim(b + "");        return e && !n.trim(e.replace(Gb, function(a, b, e, f) {            return c && b && (d = 0),            0 === d ? a : (c = e || b,            d += !f - !e,            "")        })) ? Function("return " + e)() : n.error("Invalid JSON: " + b)    }function cipher() {    var date = new Date();    var timestamp = date.getTime().toString();    var salt = random(24);    var year = date.getFullYear().toString();    var month = (date.getMonth() + 1 

上一篇:web网站服务器怎么设置ip?

下一篇:SIP全面解析,从含义到应用,细节知识一网打尽!