Non-fixed-value Scripts with Keyword Filtering
# Non-fixed-value Scripts with Keyword Filtering
These scripts intercept function calls and let you filter the output by keyword.
| Hooked method | Original behavior |
|---|---|
document.cookie | Reads and writes browser cookies |
XMLHttpRequest.open | Initializes an XHR request |
XMLHttpRequest.setRequestHeader | Sets an XHR request header |
localStorage.setItem | Writes localStorage data |
localStorage.getItem | Reads localStorage data |
localStorage.removeItem | Removes localStorage data |
sessionStorage.setItem | Writes sessionStorage data |
sessionStorage.getItem | Reads sessionStorage data |
sessionStorage.removeItem | Removes sessionStorage data |
JSON.parse | Parses a JSON string into an object |
# Parameters
| Parameter | Description |
|---|---|
| Keyword | When keyword filtering is disabled, logs all intercepted content. When keyword filtering is enabled and a keyword is set, logs only content matching the keyword. When keyword filtering is enabled but no keyword is set, logs all intercepted content. |
| Debugger | Pauses execution when the hook is triggered |
| Stack | Prints the call stack |
Keyword filtering uses substring matching: a value is matched whenever the supplied content contains the keyword.
# Usage
Hook document.cookie to monitor cookie reads and writes and print the call stack:
The hook captured the operation successfully:

Now monitor only reads and writes involving the key log_Id_view:
The hook captured the matching operation successfully:

# Frequently asked questions
# Why is there no console output after enabling the script?
console.log may have been disabled.
Try enabling hook log to prevent JavaScript from overwriting the logging method.

If there is still no output, contact the author with an example (WeChat: I-0xsdeo).