查看: 12|回覆: 0

[公众号] 油猴ajaxhook

[複製鏈接]

3

主題

0

回帖

0

積分

热心网友

金币
0
閲讀權限
220
精華
0
威望
0
贡献
0
在線時間
0 小時
註冊時間
2010-8-29
發表於 2019-12-11 09:43:00 | 顯示全部樓層 |閲讀模式
// ==UserScript==
// @name         ajaxHook
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        http://www.dianping.com/ajax/json/shopDynamic/allReview*
// @require       http://cdn.bootcss.com/jquery/3.1.0/jquery.min.js
// @require       https://unpkg.com/ajax-hook/dist/ajaxhook.min.js
// @include       http://www.dianping.com/shop/*
// @exclude       http://diveintogreasemonkey.org/*
// @exclude       http://www.diveintogreasemonkey.org/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

  hookAjax({
    onreadystatechange: function(xhr) {

    },
    onload: function(xhr) {
    let close_btn = $(".J-bonus-close")
       console.log("????")
       if(close_btn){
                  close_btn.click();
       }
        let url=xhr.responseURL
        if (~url.indexOf("shopDynamic/allReview")){
                //debugger
                console.log("url",decodeURIComponent(xhr.responseURL))
                console.log("text",xhr.responseText);
        }

                //do something!

    },
    //拦截函数
    open:function(arg){
          let url=arg[1]
           if (~url.indexOf("shopDynamic/allReview")){
                 debugger
         }

    }
  });

})();

下面是崔大的

// ==UserScript==
// @name         HookBase64
// @namespace    https://scrape.cuiqingcai.com/
// @version      0.1
// @description  Hook Base64 encode function
// @author       Germey
// @match       https://scrape.cuiqingcai.com/login1
// @grant        none
// ==/UserScript==
(function () {
    'use strict'
    function hook(object, attr) {
        var func = object[attr]
        object[attr] = function () {
            console.log('hooked', object, attr)
            var ret = func.apply(object, arguments)
            debugger
            return ret
        }
    }
    hook(window, 'btoa')
})()


来源:https://www.cnblogs.com/c-x-a/p/12020679.html
回覆

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即注册

本版積分規則

相关侵权、举报、投诉及建议等,请发 E-mail:qiongdian@foxmail.com

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部