Skip to content

Headless inject javascript #2067

Closed

Description

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

Activity

  1. ghost added
    Type: Enhancement
    on Jan 12, 2025
  2. removed
    Type: Enhancement
    on May 9, 2025
  3. added
    Type: Enhancement
    on Aug 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: Enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions