hook cookie

// ==UserScript==
// @name         用于定位cookie中关键参数生成位置
// @namespace    <https://aiqicha.baidu.com/>
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        https://*/*
// @grant        none
// ==/UserScript==
(function(){
    'use strict'
    Object.defineProperty(document, 'cookie', {
        get: function() {
            debugger;
            return "";
        },
        set: function(value) {
            debugger;
            return value;
        },
});
})()

其他

注意:一个页面只能定义一次
Object.defineProperty(window, 'a', {
        get: function(x) {
            debugger
            console.log(x);
            return x 
        }
})
Object.defineProperty(obj, 'attr', 
{        get: function() {            
console.log(cookie_cache);            
return old_attr 	},       
 set: function(val) {		 
return  ......
})
String.prototype 是 String的实例,那么我们就修改它的实例内容!
String.prototype.split = function(){   console.log('我是你爸爸')}

原型链hook

Untitled