其他分享
首页 > 其他分享> > JS 逆向爬虫——欧科云连

JS 逆向爬虫——欧科云连

作者:互联网

js:

 1 function encryptApiKey() {
 2     var t = "a2c903cc-b31e-4547-9299-b6d07b7631ab";
 3     var  e = t.split("");
 4     var r = e.splice(0, 8);
 5     return e.concat(r).join("")
 6 }
 7 function encryptTime(t)
 8         {
 9             var e = (1 * t + 1111111111111).toString().split("")
10               , r = parseInt(10 * Math.random(), 10)
11               , n = parseInt(10 * Math.random(), 10)
12               , o = parseInt(10 * Math.random(), 10);
13             return e.concat([r, n, o]).join("")
14         }
15 
16 function comb(t, e) {
17     var r2 = "".concat(t, "|").concat(e);
18         // return window.btoa(r)
19     return r2
20     }
21 function result() {
22         var t = (new Date).getTime();
23         var e = encryptApiKey(); //-b31e-4547-9299-b6d07b7631aba2c903cc
24         // return t = this.encryptTime(t);
25         var t2 = encryptTime(t);
26         var val = comb(e, t2);
27         return val
28     }

python

import execjs
import base64

url="https://www.oklink.com/btc/tx-list"
with open('ouke.js','r',encoding='utf-8') as f:
    result2 = f.read()
    print(result2)
    res = execjs.compile(result2)
    cc = res.call("result")# xx 是js 的函数名
    print(cc)
    bm = cc.encode("utf-8") # 转成byte类型
    print(bm)
    print(base64.b64encode(bm)) #base64加密
    print(str(base64.b64encode(bm),encoding='utf8')) #byte 转字符串

 

标签:10,return,bm,base64,爬虫,JS,print,var,欧科云
来源: https://www.cnblogs.com/zhang-dan/p/16181525.html