{"id":1249,"date":"2020-03-18T00:20:11","date_gmt":"2020-03-17T16:20:11","guid":{"rendered":"http:\/\/www.xiaosuigu.top\/?p=1249"},"modified":"2020-03-18T00:20:11","modified_gmt":"2020-03-17T16:20:11","slug":"hook","status":"publish","type":"post","link":"https:\/\/www.xiaosuigu.top\/index.php\/2020\/03\/18\/hook\/","title":{"rendered":"hook"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">\u65e0\u9650debugger<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>var _constructor = constructor;\nFunction.prototype.constructor = function(s) {\n    if (s == \"debugger\") {\n        console.log(s);\n        return null;\n    }\n    return _constructor(s);\n}\n\n\/\/\u53bb\u9664\u65e0\u9650debugger\nFunction.prototype.__constructor_back = Function.prototype.constructor ;\nFunction.prototype.constructor = function() {\n    if(arguments &amp;&amp; typeof arguments&#91;0]==='string'){\n        \/\/alert(\"new function: \"+ arguments&#91;0]);\n        if( \"debugger\" === arguments&#91;0]){\n            \/\/ arguments&#91;0]=\"consoLe.Log(\\\"anti debugger\\\");\";\n            \/\/arguments&#91;0]=\";\";\n            return\n    }\n    }\n    return Function.prototype.__constructor_back.apply(this,arguments);\n};\n\nvar _Function = Function;\nFunction = function(s) {\n    if (s == \"debugger\") {\n        console.log(s);\n        return null;\n    }\n    return _Function(s);\n}<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">cookie<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u5f53\u4fee\u6539cookie\u503c\u7684\u65f6\u5019\u8fdb\u884c\u6253\u5370\n(function () {\n    var cookieTemp = '';\n    Object.defineProperty(document, 'cookie', {\n        set: function (v) {\n            debugger;\n            console.log(v);\n            cookieTemp = v;\n            return v;\n        },\n        get: function () {\n            return cookieTemp;\n        }\n    });\n})();<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">json<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ JSON.stringify hook\n(function () {\n    var _stringify = JSON.stringify;\n    JSON.stringify = function (ps) {\n        console.log(ps);\n        debugger;\n        return _stringify(ps); \/\/ \u4e0d\u6539\u53d8\u539f\u6765\u903b\u8f91\n    }\n})();\n\n\n\/\/ JSON.parse hook\n(function () {\n    var _parse = JSON.parse();\n    JSON.parse = function (ps) {\n        console.log(ps);\n        debugger;\n        return _parse(ps); \/\/ \u4e0d\u6539\u53d8\u539f\u6765\u903b\u8f91\n    }\n})();<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">header<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>(function () {\n    \/\/ \u5934\u90e8\u53c2\u6570 \u8bf7\u6c42\u5bf9\u8c61\u5f53\u4e2d\u7684 \u8bbe\u80c3\u8bf7\u6c42\u5934\u90e8\u53c2\u6570\n   var org = window.XMLHttpRequest.prototype.setRequestHeader;\n   window.XMLHttpRequest.prototype.setRequestHeader = function (key, value) {\n       \/\/ \u5173\u952e\u5b57 \u5728\u8bf7\u6c42\u5f53\u4e2d\u53d1\u73b0\u6709\u952e\u662fAuthorization \u65ad\u70b9\n       if (key == 'Authorization') {\n            debugger;\n        }\n       return org.apply(this, arguments);\n   }\n})();\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">eval<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>(function() {\n    \/\/ \u4fdd\u5b58\u539f\u59cb\u65b9\u6cd5\n    window.__cr_eval = window.eval;\n    \/\/ \u91cd\u5199 eval\n    var myeval = function(src) {\n        console.log(src);\n        console.log(\"=============== eval end ===============\");\n        debugger;\n        return window.__cr_eval(src);\n    }\n    \/\/ \u5c4f\u853d JS \u4e2d\u5bf9\u539f\u751f\u51fd\u6570 native \u5c5e\u6027\u7684\u68c0\u6d4b\n    var _myeval = myeval.bind(null);\n    _myeval.toString = window.__cr_eval.toString;\n    Object.defineProperty(window, 'eval', {\n        value: _myeval\n    });\n})();<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u65e0\u9650debugger cookie json header eval<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1249","post","type-post","status-publish","format-standard","hentry","category-js"],"_links":{"self":[{"href":"https:\/\/www.xiaosuigu.top\/index.php\/wp-json\/wp\/v2\/posts\/1249","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xiaosuigu.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xiaosuigu.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xiaosuigu.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xiaosuigu.top\/index.php\/wp-json\/wp\/v2\/comments?post=1249"}],"version-history":[{"count":0,"href":"https:\/\/www.xiaosuigu.top\/index.php\/wp-json\/wp\/v2\/posts\/1249\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.xiaosuigu.top\/index.php\/wp-json\/wp\/v2\/media?parent=1249"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xiaosuigu.top\/index.php\/wp-json\/wp\/v2\/categories?post=1249"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xiaosuigu.top\/index.php\/wp-json\/wp\/v2\/tags?post=1249"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}