Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Headless inject javascript #2067

Open
michael2to3 opened this issue Jan 12, 2025 · 0 comments
Open

Headless inject javascript #2067

michael2to3 opened this issue Jan 12, 2025 · 0 comments
Labels
Type: Enhancement Most issues will probably ask for additions or changes.

Comments

@michael2to3
Copy link
Contributor

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:
aeac78fedf7723ec14905191d3d34d975109f9b9

@michael2to3 michael2to3 added the Type: Enhancement Most issues will probably ask for additions or changes. label Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Most issues will probably ask for additions or changes.
Projects
None yet
Development

No branches or pull requests

1 participant