This commit is contained in:
cilame 2022-05-05 20:56:03 +08:00
parent 62e135f742
commit 6e8e8d1d2f
3 changed files with 14 additions and 2 deletions

View File

@ -1038,7 +1038,7 @@ function injectfunc(e, window) {
if (expurl.v_test(expstr)){
window.v_log(..._mk_logs('[cookie get]', r, get_log_at(expstr.trim())))
}
if (e["config-hook-cookie-add-debugger"]){ debugger }
if (e["config-hook-cookie-add-debugger"] && r.indexOf(e["config-hook-cookie-match"]) != -1){ debugger }
}
}
return r
@ -1054,7 +1054,7 @@ function injectfunc(e, window) {
if (expurl.v_test(expstr)){
window.v_log(..._mk_logs('[cookie set]', v, get_log_at(expstr.trim())) )
}
if (e["config-hook-cookie-add-debugger"]){ debugger }
if (e["config-hook-cookie-add-debugger"] && v.indexOf(e["config-hook-cookie-match"]) != -1){ debugger }
}
}
return _old_cookie_set.apply(this, arguments)
@ -1261,6 +1261,7 @@ var hookers = [
"config-hook-cookie-add-debugger",
"config-hook-cookie-get",
"config-hook-cookie-set",
"config-hook-cookie-match",
"config-hook-encrypt-normal",
"config-hook-JSON.parse",
"config-hook-JSON.stringify",
@ -1325,6 +1326,7 @@ chrome.storage.local.get(hookers, function (result) {
if (result["config-hook-global"]){
var replacer_injectfunc = (injectfunc + '').replace('$domobj_placeholder', make_domhooker_funcs())
var replacer_injectfunc = replacer_injectfunc.replace('$make_v_func', make_v+';')
result["config-hook-cookie-match"] = (result["config-hook-cookie-match"] || '').trim()
inject_script(`(${replacer_injectfunc})(${JSON.stringify(result)},window)`);
}

View File

@ -72,6 +72,8 @@
<br/>
<label style="margin-left: 20px"><input type="checkbox" data-key="config-hook-cookie-add-debugger">hook-cookie-add-debugger</label>
<br/>
<input style="margin-left: 40px; width: 150px; height: 12px; margin-top: 3px" type="text" data-key="config-hook-cookie-match" id="cookie_match"><label>对匹配字符串的cookie才下断不设置则为全部都下断</label>
<br/>
<label style="margin-left: 20px"><input type="checkbox" data-key="config-hook-cookie-get">hook-cookie-get</label>
<br/>
<label style="margin-left: 20px"><input type="checkbox" data-key="config-hook-cookie-set">hook-cookie-set</label>

View File

@ -510,6 +510,14 @@ get_now.addEventListener("click", function(){
})
})
var cookie_match = document.getElementById('cookie_match');
cookie_match.addEventListener("click", function(){
var show_now = document.getElementById('show_now')
show_now.value = +new Date+''
chrome.storage.local.set({
[show_now.dataset.key]: show_now.value
})
})