拼刀刀店鋪后臺的參數(shù)anti-content逆向分析

大家好,我是黑臉怪。今天給大家分享pin嘻嘻逆向。

分析網(wǎng)址:'aHR0cHM6Ly9tbXMucGluZHVvZHVvLmNvbS9nb29kcy9nb29kc19saXN0'

1.介紹-為什么要逆向anti-content參數(shù)

用代碼訪問后臺數(shù)據(jù)不帶anti參數(shù)的話會提示“訪問頻繁”,所以需要逆向出這個參數(shù)!

image

2.開始逆向js

2.1 找參數(shù)所在位置-先在控制臺全局搜索參數(shù)名字

image

搜索出來10個結(jié)果 不算多,每個都點進去 在差不多的關(guān)鍵詞位置打上斷點先。

image

因為它Ajax請求每個頁面都要anti參數(shù) 所以我們下斷點之后隨便點個按鈕都能用 已經(jīng)斷下來了,這個aa1d開頭的js文件(你們的不一定叫這名),可以把其他斷點取消了,現(xiàn)在來著重分析這個。

image

2.2 跟棧-找加密的方法

image

這里是一個異步代碼調(diào)用,我們把斷點打到它上一層這里先。

return Promise.resolve(u(t.rawFetch, d).catch((function() {}

直接f8放過去 再重新點一次 會到達上面那個斷點

f11單步調(diào)試進來 會跟到這里

getCrawlerInfo: function(t) {
                return Promise.resolve(G((function() {
                    var e = I.a.getInstance(t);
                    return Promise.resolve(e.getServerTime()).then(F)
                }
                ), (function() {
                    return ""
                }
                )))
            }

對于異步不太懂的 我這里強行演示一波 (百度小抄一下改改)

image
//1. Promise.resolve("111")

 Promise.resolve("111")
//Promise {<fulfilled>: '111'}
//    [[Prototype]]: Promise
//    [[PromiseState]]: "fulfilled"  這是完成的狀態(tài) 
//    [[PromiseResult]]: "111"       這是結(jié)果

//2.Promise.resolve("").then(函數(shù)())

Promise.resolve("我是參數(shù)?").then(function(a){console.log("111",a);return "123"})
//111 我是參數(shù)?
//Promise {<fulfilled>: '123'}
//    [[Prototype]]: Promise
//    [[PromiseState]]: "fulfilled"
//    [[PromiseResult]]: "123"

所以e是時間戳,f是主要函數(shù) 下斷點到這 f8直接過來 再單步兩次到F

[圖片上傳失敗...(image-3651ca-1647853411465)]

要的是里面的這串代碼 :new一個對象 對象傳入一個包含serverTime的對象這里我也不太理解 最后messagePack肯定就是方法了。。。不管他直接復(fù)制在控制臺跑一下出結(jié)果了。

new (n("eDaA"))({
    serverTime: t
}).messagePack()

image

2.3 代碼分析

n("eDaA") 我第一眼看這不就是個webpack嗎 當(dāng)時覺得還是以前的玩法 找到n方法的加載器 再復(fù)制eDaA這個模塊就可以跑了。沒想到跟進去發(fā)現(xiàn) eDaA里面又是一個加載器和模塊 第一次見到這樣的 沒玩過,研究了半天

eDaA導(dǎo)出fbeZ fbeZ又導(dǎo)出里面的整個webpack

所以最后我們只要fbeZ里面的webpack 跳過第一層直接取它, 因為它是第二層的 加載器不適用,需要找個通用的加載器

image.png

下面的加載器可以輸出"111"就行

window=global;
!(function (e) {
    var i = {}
        , o = {
        index: 0
    }

    function c(t) {
        if (i[t])
            return i[t].exports;
        var n = i[t] = {
            i: t,
            l: !1,
            exports: {}
        };
        // console.log(t)
        return e[t].call(n.exports, n, n.exports, c),
            n.l = !0,
            n.exports
    }

    window.hliang1 = c
}
)([
    function(e,t,n){
        console.log("111")
    }
])
window.hliang1(0)

image

復(fù)制過來后 把前面列表的[和屁股后面的}]刪除掉一個 因為會復(fù)制多

因為用notepad++代碼格式化的問題,有一個模塊會提示代碼有問題

去網(wǎng)站重新粘貼一下這串代碼到vscode(pycharm)

image

這樣就完成了,用window.hliang1 就可以調(diào)用模塊了

下面開始復(fù)制qe對象

它new 的qe對象就在模塊里面啊,我不知道怎么直接new 所以新建了一個函數(shù) 然后對它改寫

image

全部復(fù)制下來

function  hliang_qe(){

    //復(fù)制進這里來

}

(function (e, t) {}).call(this,a,b) 這種就是 把a,b傳參到e,t

所以改寫 匿名刪除去掉,.call去掉,傳參的e,t直接設(shè)置成

var e=window.hliang1(3) 還有其他地方n() 這里加載器名字改一下

t原本的作用是導(dǎo)出(t.exports)那我這里不要t了 直接導(dǎo)出改成return

如下圖

image
image

復(fù)制到瀏覽器執(zhí)行,成功出結(jié)果。但是這個代碼在node.js還需要補環(huán)境和改環(huán)境。

image

3.環(huán)境檢測

在瀏覽器能跑 在node.js跑不了 需要補環(huán)境。

這都啥報錯啊,看不懂。 先上環(huán)境吧。

image

算了懶得寫了。

直接告訴你們要補啥吧。

cookie和localStorage.Item傳入自己的就行了 過期的也沒事

window = global
document={
    addEventListener:function addEventListener(a,b){
        // console.log("addevent",a,b)
        return undefined
    },
    referrer:'',
    getElementById:function getElementById(a){
      console.log("getbyid",a)
      return "<head></head>"
    },
    cookie:''//這里傳一個自己的cookie 過期了的也沒事
}
var Plugins={0:{}}
navigator={
    webdriver:false,
    plugins: Plugins,
    languages:["zh-CN","zh"],
    hasOwnProperty:function hasOwnProperty(a){
      // console.log(a,"hasOwnProperty");
      if (a=="webdriver"){
        return false
      }

    },
    userAgent:"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.81 Safari/537.36"
}

screen={availWidth:1920,availHeight:1040}
history={
  back:function back(){console.log("back",arguments)}
}
location={
  href:"https://mms.pinduoduo.com/goods/goods_list",
  port:""
}
chrome={}

localStorage={
  getItem:function getItem(a){

    // console.log("item",arguments)
    if (a=="_nano_fp"){
      return "" //這里也傳一個自己的
    }
  }
}

window["chrome"]=chrome
window["location"]=location
window["navigator"]=navigator
window["history"]=history
window["document"]=document
window["screen"]=screen
window["localStorage"]=localStorage

Object.defineProperty && Object.defineProperty(window, "outerHeight", {
    value: 1040,
    writable: false
});
Object.defineProperty && Object.defineProperty(window, "outerWidth", {
    value: 1920,
    writable: false
});

function DeviceOrientationEvent(){
   console.log("DeviceOrientationEvent",arguments)
}
window["DeviceOrientationEvent"]=DeviceOrientationEvent
function DeviceMotionEvent(){
  console.log("DeviceMotionEvent",arguments)
 }
 window["DeviceMotionEvent"]=DeviceMotionEvent
//delete window.Buffer //e("0x3c", "anZ%")
document.getElementById.toString=function(){
    return 'function getElementById() { [native code] }'
}

可以了。環(huán)境+上面的代碼就能跑了

{"success":true,"errorCode":1000000,"errorMsg":null,"result":{"sessionId":"e70ae011c9c64f8fbf0e70fada362385","total":0,"goods_list":[]}}

演示地址:

http://z.hl98.cn/index.php?share/file&user=102&sid=CiAXx7ry

小伙伴們,快快用實踐一下吧!如果在學(xué)習(xí)過程中,有遇到任何問題,歡迎加我好友,我拉你進Python學(xué)習(xí)交流群共同探討學(xué)習(xí)。

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容