Python爬虫系列之美拆小程序逆向算法
小程序爬虫接单、app爬虫接单、网页爬虫接单、接口定制、网站开发、小程序开发> 点击这里联系我们 <
微信请扫描下方二维码
代码仅供学习交流,请勿用于非法用途
直接上代码
import execjs
# 接口秘钥,代码仅供学习,不提供暴露签名
js = '''
function encrypt(t) {
var t = t + "&ct=3&vcode=" + a;
return e.AES.encrypt(t, secret , {
mode: e.mode.ECB,
padding: e.pad.Pkcs7
}).toString();
return t;
}
function decrypt(s) {
var decryptedData = e.AES.decrypt(s, secret , {
mode: e.mode.ECB,
padding: e.pad.Pkcs7
});
return decryptedData.toString(e.enc.Utf8)
}
var e = require("./crypto-js.js"), n = "online", a = "9.7.4";
'''
ctx = execjs.compile(js)
# 加密
encrytedStr = ctx.call("encrypt", '''mod=order&operation=carorder&uid=755312&loginid=7b8cc0c60afa288e87aa8ea2d976c32c&gcount=1&aid=158491&cid=&ginfo=[{"gid":"35171","color":"0","size":"0","count":1,"rec_goods_id":0,"rec_cart_id":0,"referee":0}]&desc=&gdt_vid=&weixinadinfo=&roomId=0&command=&isDeduct=0''')
print(encrytedStr)
# 上面参数的加密值
# ZSCMqvhxmiDQuxKZsWGAoMW+/7kO3mT9dkzkXQCaqKVweMCXnZB9dQu8lt9As8XezGqARe2nzYxO6sYNFTcf+/rCpGgU46HPHrpBxlQkc1HeizBiqmYqT968XD2ble9fVNAXYu/rlUSGl9ATBPQJMr8faKrqoEcd9JgdInbECwSzn7s0b0ahbXq4B6SEdeAHVyb0QsnS1g+ikSvxm8FcAThQWJ+Ag759D31zkDjkK6sPfE3+f2H4/CEFwczPZdpnPSW9ZAaeyj7Dr19vRwDLeaMxe496zTqBQ8fs8H21DMUsr+gDXj/Z9P69vn0CnKuvp23yZTJSPZOqOCSIZqahVw3bgaEuTWKqfP41DvHHp8PJv5Lbgw+yRjYxX8LVlYTO
# 下面解密的密文
# ZSCMqvhxmiDQuxKZsWGAoMW+/7kO3mT9dkzkXQCaqKVweMCXnZB9dQu8lt9As8XezGqARe2nzYxO6sYNFTcf+/rCpGgU46HPHrpBxlQkc1HeizBiqmYqT968XD2ble9fVNAXYu/rlUSGl9ATBPQJMr8faKrqoEcd9JgdInbECwSzn7s0b0ahbXq4B6SEdeAHVyb0QsnS1g+ikSvxm8FcAThQWJ+Ag759D31zkDjkK6sPfE3+f2H4/CEFwczPZdpnPSW9ZAaeyj7Dr19vRwDLeaMxe496zTqBQ8fs8H21DMUsr+gDXj/Z9P69vn0CnKuvp23yZTJSPZOqOCSIZqahVw3bgaEuTWKqfP41DvHHp8PJv5Lbgw+yRjYxX8LVlYTO
# 解密
decryptedStr = ctx.call("decrypt", "ZSCMqvhxmiDQuxKZsWGAoMW+/7kO3mT9dkzkXQCaqKVweMCXnZB9dQu8lt9As8XezGqARe2nzYxO6sYNFTcf+/rCpGgU46HPHrpBxlQkc1HeizBiqmYqT968XD2ble9fVNAXYu/rlUSGl9ATBPQJMr8faKrqoEcd9JgdInbECwSzn7s0b0ahbXq4B6SEdeAHVyb0QsnS1g+ikSvxm8FcAThQWJ+Ag759D31zkDjkK6sPfE3+f2H4/CEFwczPZdpnPSW9ZAaeyj7Dr19vRwDLeaMxe496zTqBQ8fs8H21DMUsr+gDXj/Z9P69vn0CnKuvp23yZTJSPZOqOCSIZqahVw3bgaEuTWKqfP41DvHHp8PJv5Lbgw+yRjYxX8LVlYTO")
print(decryptedStr)
转载:https://blog.csdn.net/qq_41287993/article/details/112371115
查看评论