webpack模板
1.在控制台用webpackJsonp去找全部的文件,拼接到一起后干掉初始化的函数(一般在加载的最后一行删掉就行)再全局导出加载器,最后想用什么方法就可以直接调用了
window.code=""
var c_
(function (e){
function c(t){
var n =i[t] = {
i:t,
l:!1,
exports:{}
};
window.code + = "\""+t+"\":"+e[t]+"," ; //调试全文件时输出调用的代码函数
return e[t].call(n.exports,n,n.exports,c),n.l=!0,n.exports
}
c_=c;
})({
//填充函数
})
https://github.com/JSREI/ast-hook-for-js-REmhttps://github.com/JSREI/ast-hook-for-js-RE
漫游HOOK模块,先下载,在安装依赖
npm install anyproxy -g
下载后安装证书这个自己安哦
运行这个之前先在文件路径下运行npm install 安装依赖
node proxy-server.js
ajax HOOK
XMLHttpRequest.prototype.send1=XMLHttpRequest.prototype.send;
XMLHttpRequest.prototype.send=function () {
debugger;
return XMLHttpRequest.prototype.send1
}
cooke1 hook
(function () {
'use strict';
var cookieTemp = '';
Object.defineProperty(document, 'cookie', {
set: function (val) {
if (val.indexOf('v=') != -1) {
debugger;
}
console.log('Hook捕获到cookie设置->', val);
cookieTemp = val;
return val;
},
get: function () {
return cookieTemp;
},
});
})();
var code = function(){
var org = document.cookie.__lookupSetter__('cookie');
document.__defineSetter__("cookie",function(cookie){
if(cookie.indexOf('abcdefghijk')>-1){
debugger;
}
org = cookie;
});
document.__defineGetter__("cookie",function(){
return org;
});
}
var script = document.createElement('script');
script.textContent = '(' + code + ')()';
(document.head||document.documentElement).appendChild(script);
script.parentNode.removeChild(script);
var cookie_cache = document.cookie;
Object.defineProperty(document, 'cookie', {
get: function () {
return cookie_cache;
},
set: function (val) {
console.log('Setting cookie', val);
// 填写cookie名
if (val.indexOf('v=') !== -1) {
// if (val.indexOf('m') !== -1) {
debugger;
}
var cookie = val.split(";")[0];
var ncookie = cookie.split("=");
var flag = false;
var cache = cookie_cache.split("; ");
cache = cache.map(function (a) {
if (a.split("=")[0] === ncookie[0]) {
flag = true;
return cookie;
}
return a;
})
cookie_cache = cache.join("; ");
if (!flag) {
cookie_cache += cookie + "; ";
}
return cookie_cache;
}
});
evel hook
https://www.cnblogs.com/c-x-a/p/11733677.htmlhttps://www.cnblogs.com/c-x-a/p/11733677.html
window.__cr_eval = window.eval;
var myeval = function(src) {
// src就是eval运行后 最终返回的值
console.log(src);
console.log("========= eval end ===========");
return window.__cr_eval;
}
var _myeval = myeval.bind(null);
_myeval.toString = window.__cr_eval.toString;
Object.defineProperty(window, 'eval',{value: _myeval});
window._cr_fun = window.Function
var myfun = function(){
var args = Array.prototype.slice.call(arguments, 0, -1).join(","), src = arguments[arguments.lenght -1];
console.log("======== Function end =============");
return window._cr_fun.apply(this, arguments)
}
myfun.toString = function() {return window._cr_fun + ""} //小花招,这里防止代码里检测原生函数
Object.defineProperty(window, "Function",{value: myfun});
josn hook
var my_stringify=JSON.stringify;
JSON.stringify=function (params) {
console.log('打印',params);
return my_stringify;
}
var my_parse=JSON.parse;
JSON.parse=function (params) {
console.log('yemu',params);
return my_parse;
}
websocket hook
WebSocket.prototype.senda=WebSocket.prototype.send;
WebSocket.prototype.send=function (data) {
console.info('打印出来了',data);
return this.senda(data)
}
、