Skip to content

Instantly share code, notes, and snippets.

@Esonhugh
Last active January 9, 2025 06:27
Show Gist options
  • Save Esonhugh/379835e3d44f5689f1a687486bdf0c52 to your computer and use it in GitHub Desktop.
Save Esonhugh/379835e3d44f5689f1a687486bdf0c52 to your computer and use it in GitHub Desktop.
Chrome content script - Current environment hooks and debug tool for reversing js on website. Released on https://update.greasyfork.org/scripts/523279/ConsoleHook.user.js
<html>
<head>
<title>Playground of hooks</title>
<script src="/hook.js"></script>
</head>
<body>
<script>
// console.hooks.hookfunc(console, "log")
obj = {
keyA: "As",
KeyB: 1231213123,
func: () => {
return "123231"
},
func2: (res) => {
return res + 1
}
}
// obj = console.hooks.hookValueViaProxy("objx", obj)
obj.keyA
obj.Key = "C"
obj.KeyB = "1231"
// console.hooks.hookValueViaGetSet("objx",obj, "Key")
obj.keyA = "12312"
obj.Key = "B"
obj.Key = "C"
console.log(obj.func())
console.hooks.hookfunc(obj, "func", function (res) {
let [ret, originalFunction, arguments, env] = res;
return "114514"
})
console.log(obj.func())
setInterval(function () {
console.log("debugger!");
debugger
}, 123);
console.hooks.hookfunc(obj, "func2", ()=>{}, (res)=>{
let [originalFunction, arguments, t] = res;
var handler = arguments[0];
console.log(handler)
return [123]
})
obj.func2(12);
function re(){ Function["constructor"]("return () => {debugger}")["call"]("action")}
setInterval(re, 123);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment