Python crawler-reverse example notes-2

Notice! ! ! ! The reverse example of a data website is only used as a learning case, and other individuals and groups are prohibited from making profit! ! ! !

case analysis

Step 1: Analyze the request and response content. Any request and content of this website cannot be read directly

 

The second step: through analysis (as for the analysis, it is all based on experience). Individuals searched for AES keywords globally through encrypted content, but did not find it. Therefore, you can find more than one in the search JSON.parse. After filtering, select the object object that can be passed in. Or the website can determine the payload and sig of the request parameters. Anyway, I'm based on experience

 The third step: break point, through the json.parse search, you can break the key point. After refreshing you can see some important information. Can be viewed in the console. As shown in the figure below, you can see

t : is the first request

s: is the parameter before encryption

f: is the encrypted parameter one

p: is the encrypted parameter two

 Step 4: After the first request, the response content is loaded and parsed

l: is the encrypted response content after the first request

v: is to decrypt the response content after the first request

 

Step 5: After the second request, the response and content

t : is the first request

s: is the parameter before encryption

f: is the encrypted parameter one

p: is the encrypted parameter two

 Step 6: Put the mouse on the back of the object to see the called function. When a prompt appears, click in to view, encrypt and decrypt the kernel. Example: e2 and d1 The site calls a few, more than the examples given. use as you learn! Finally v is the decrypted content

 

 

 

Finally encrypt and decrypt

I have limited ability and only tested it in the js file, but failed to rewrite it into python

var md5 = require('md5');
var _p = "W5D80NFZHAYB8EUI2T649RT2MNRMVE2O";
var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
function d1(e) {
                var t, n, r, o, i, a, c = "", u = 0;

                for (e = e.replace(/[^A-Za-z0-9\+\/\=]/g, ""); u < e.length; )
                    t = _keyStr.indexOf(e.charAt(u++)) << 2 | (o = _keyStr.indexOf(e.charAt(u++))) >> 4,
                    n = (15 & o) << 4 | (i = _keyStr.indexOf(e.charAt(u++))) >> 2,
                    r = (3 & i) << 6 | (a = _keyStr.indexOf(e.charAt(u++))),
                    c += String.fromCharCode(t),
                    64 != i && (c += String.fromCharCode(n)),
                    64 != a && (c += String.fromCharCode(r));
                return c
            }
function _u_d(e) {
                for (var t = "", n = 0, r = 0, o = 0, i = 0; n < e.length; )
                    (r = e.charCodeAt(n)) < 128 ? (t += String.fromCharCode(r),
                    n++) : r > 191 && r < 224 ? (o = e.charCodeAt(n + 1),
                    t += String.fromCharCode((31 & r) << 6 | 63 & o),
                    n += 2) : (o = e.charCodeAt(n + 1),
                    i = e.charCodeAt(n + 2),
                    t += String.fromCharCode((15 & r) << 12 | (63 & o) << 6 | 63 & i),
                    n += 3);
                return t
            }

function d2(e) {

                for (var t = "", n = 0; n < e.length; n++) {
                    var r = _p.charCodeAt(n % _p.length);
                    t += String.fromCharCode(e.charCodeAt(n) ^ r)
                }
                return t = _u_d(t)
            }

 function _u_e(e) {
     if (null == e)
         return null;
     e = e.replace(/\r\n/g, "\n");
     for (var t = "", n = 0; n < e.length; n++) {
         var r = e.charCodeAt(n);
         r < 128 ? t += String.fromCharCode(r) : r > 127 && r < 2048 ? (t += String.fromCharCode(r >> 6 | 192),
             t += String.fromCharCode(63 & r | 128)) : (t += String.fromCharCode(r >> 12 | 224),
             t += String.fromCharCode(r >> 6 & 63 | 128),
             t += String.fromCharCode(63 & r | 128))
     }
     return t
 }
function e1(e) {
                if (null == e)
                    return null;
                for (var t, n, r, o, i, a, c, u = "", s = 0; s < e.length; )
                    o = (t = e.charCodeAt(s++)) >> 2,
                    i = (3 & t) << 4 | (n = e.charCodeAt(s++)) >> 4,
                    a = (15 & n) << 2 | (r = e.charCodeAt(s++)) >> 6,
                    c = 63 & r,
                    isNaN(n) ? a = c = 64 : isNaN(r) && (c = 64),
                    u = u + _keyStr.charAt(o) + _keyStr.charAt(i) + _keyStr.charAt(a) + _keyStr.charAt(c);
                return u
            }

function e2(e) {
                if (null == (e = _u_e(e)))
                    return null;
                for (var t = "", n = 0; n < e.length; n++) {
                    var r = _p.charCodeAt(n % _p.length);
                    t += String.fromCharCode(e.charCodeAt(n) ^ r)
                }
                return t
            }
function sig(e) {
                return md5(e + _p).toUpperCase()
            }

function s1(n) {
    var s = JSON.stringify(n)
        , l = JSON.parse(s);
    var f = e1(e2(JSON.stringify(l.payload)))
        ,p = sig(f);
    l.payload = f
    l.sig = p
    return l;
}


n = {}
// l = s1(n)
// console.log(l)
// l1 = d1(l.payload)
// l2 = d2(l1)
// console.log(l2)

 Just as a note record, if you have any questions, please guide me

Guess you like

Origin blog.csdn.net/weixin_43124425/article/details/131398203