httpx
httpx copied to clipboard
Headless inject javascript
Please describe your feature request:
Support for embedding JavaScript code to change data on the client side in the browser, especially for changing data in localStorage, which allows you to manipulate the state of web pages or checks, for example, tokens or user settings.
Describe the use case of this feature:
This feature is useful for situations where you need to execute JavaScript code on the client side by changing the page state, for example, to edit data in localStorage, which can be used to verify authorization or configure the page. For example: I wrote a simple website that checks localstorage, after which we launch httpx with the introduction of js to change localstorage. index.html
<!DOCTYPE html>
<html>
<head>
<title>check</title>
</head>
<body>
<h1>check</h1>
<script>
const check = () => {
const h1 = document.querySelector('h1')
h1.innerText += JSON.stringify(window.localStorage);
h1.innerHTML += '<br />';
}
check();
setInterval(() => {
check();
}, 1000);
</script>
</body>
</html>
t.js tt.js ttt.js
() => window.localStorage.setItem("a", "boba") // t.js
() => window.localStorage.setItem("ab", "oba") // tt.js
() => window.localStorage.setItem("abo", "ba") // ttt.js
echo 'http://127.0.0.1:8888/' | ./httpx -sid 15 -js "$(cat ./t.js)" -ss -srd ./test -js "$(cat ./tt.js)" --javascript-inject $(cat ttt.js)
Result from httpx: