mirror of
https://git.mirrors.martin98.com/https://github.com/cilame/v_jstools
synced 2025-07-04 10:45:14 +08:00
add
This commit is contained in:
parent
efb13726d1
commit
1dab3cd1c4
@ -26,12 +26,35 @@ chrome.contextMenus.create({
|
|||||||
AttachDebugger();
|
AttachDebugger();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
chrome.contextMenus.create({
|
||||||
|
title: "修改发送请求",
|
||||||
|
contexts: ['all'],
|
||||||
|
onclick: function(){
|
||||||
|
init_edit_function()
|
||||||
|
edit_request = true
|
||||||
|
AttachDebugger();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function init_edit_function(){
|
||||||
|
chrome.storage.local.get(["config-request_hook"], function (res) {
|
||||||
|
try{
|
||||||
|
var code = res["config-request_hook"]
|
||||||
|
|
||||||
|
}catch(e){
|
||||||
|
console.log(e)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
var ast_dyn_hook = false
|
var ast_dyn_hook = false
|
||||||
var html_copy = false
|
var html_copy = false
|
||||||
|
var edit_request = false
|
||||||
function close_debugger(){
|
function close_debugger(){
|
||||||
attached = false
|
attached = false
|
||||||
ast_dyn_hook = false
|
ast_dyn_hook = false
|
||||||
html_copy = false
|
html_copy = false
|
||||||
|
edit_request = false
|
||||||
}
|
}
|
||||||
function sendCommand(method, params, source, chainfun){
|
function sendCommand(method, params, source, chainfun){
|
||||||
chrome.debugger.sendCommand(source, method, params, function(result){
|
chrome.debugger.sendCommand(source, method, params, function(result){
|
||||||
@ -105,7 +128,24 @@ chrome.debugger.onEvent.addListener(function (source, method, params){
|
|||||||
})
|
})
|
||||||
return
|
return
|
||||||
});
|
});
|
||||||
break; }
|
break;
|
||||||
|
}else{
|
||||||
|
var options = { requestId: params.requestId }
|
||||||
|
if (edit_request){
|
||||||
|
var url = params.request.url
|
||||||
|
var method = params.request.method
|
||||||
|
var postData = params.request.postData
|
||||||
|
var headers = params.request.headers
|
||||||
|
// console.log(method, url, headers, postData)
|
||||||
|
// 这里处理更新操作
|
||||||
|
// options.url = url
|
||||||
|
// options.method = method
|
||||||
|
// options.postData = postData
|
||||||
|
// options.headers = headers // 这里直接放进去似乎还会有问题
|
||||||
|
}
|
||||||
|
sendCommand("Fetch.continueRequest", options, source);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
chrome.debugger.onDetach.addListener(function(){
|
chrome.debugger.onDetach.addListener(function(){
|
||||||
@ -144,6 +184,8 @@ function AttachDebugger() {
|
|||||||
// {urlPattern:"*",resourceType:"Manifest",requestStage:"Response"},
|
// {urlPattern:"*",resourceType:"Manifest",requestStage:"Response"},
|
||||||
// {urlPattern:"*",resourceType:"SignedExchange",requestStage:"Response"},
|
// {urlPattern:"*",resourceType:"SignedExchange",requestStage:"Response"},
|
||||||
// {urlPattern:"*",resourceType:"Preflight",requestStage:"Response"},
|
// {urlPattern:"*",resourceType:"Preflight",requestStage:"Response"},
|
||||||
|
|
||||||
|
{urlPattern:"*",requestStage:"request"},
|
||||||
] }, currtab);
|
] }, currtab);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -138,6 +138,10 @@
|
|||||||
<div>适用的本地文件后缀:txt,html,htm,css,js,json,xml,jpg,gif,png,webp</div>
|
<div>适用的本地文件后缀:txt,html,htm,css,js,json,xml,jpg,gif,png,webp</div>
|
||||||
<table id="response_changer"></table>
|
<table id="response_changer"></table>
|
||||||
|
|
||||||
|
<h2 style="margin-bottom: 0px;margin-top: 50px;">动态修改请求包</h2>
|
||||||
|
<hr>
|
||||||
|
<textarea id='fetch_hook' data-key="config-request_hook" style="width: 100%; height: 500px"></textarea>
|
||||||
|
|
||||||
<h2 style="margin-bottom: 0px;margin-top: 50px;">动态修改被调试页面的所有js代码</h2>
|
<h2 style="margin-bottom: 0px;margin-top: 50px;">动态修改被调试页面的所有js代码</h2>
|
||||||
<hr>
|
<hr>
|
||||||
<div>这里的功能:在目标网页上右键菜单选择 “打开 ast 动态挂钩” 即可开启,使用用插件的方式 hook 住目标页面的所有代码,像是在 node 里面一样使用 ast 将原始的代码修改成期望的样子</div>
|
<div>这里的功能:在目标网页上右键菜单选择 “打开 ast 动态挂钩” 即可开启,使用用插件的方式 hook 住目标页面的所有代码,像是在 node 里面一样使用 ast 将原始的代码修改成期望的样子</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user