zoukankan      html  css  js  c++  java
  • 油猴ajaxhook

    // ==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')
    })()
    
  • 相关阅读:
    省赛总结
    factorial
    poj 3842 An Industrial Spy
    最近我这是怎么了
    U盘分区的方法
    没事做贴个代码,判断是否素数,顺便打个素数表(非原创)。
    [转]ubuntu 安装code blocks全记录
    zoj 2312
    (转)Enterprise Library系列文章回顾与总结
    分布式缓存系统Memcached简介与实践
  • 原文地址:https://www.cnblogs.com/c-x-a/p/12020679.html
Copyright © 2011-2022 走看看