How to inject JavaScript to auto-login to a web site.

Questions and comments about currently under development PWB v4

Moderators: Tyler, Scott

Post Reply
Scott
Site Admin
Site Admin
Posts: 2586
Joined: Mon Dec 16, 2002 12:31 pm
Location: Rochester, MN
Contact:

How to inject JavaScript to auto-login to a web site.

Post by Scott »

You can use the PWB version 3.2/4.0 ability to inject JavaScript into a web page by setting up a JavaScript filter to detect the URL, and inject JavaScript code to fill in the user name and password and click the submit button.

Test web site:
https://beta.team2s.com/inject/

[Files]
JavaScriptFilterFile=signinfilter.txt

[Security]
CheckJavaScriptAccess=True
signinjavascript.txt
(229 Bytes) Downloaded 1 time
signinfilter.txt
(61 Bytes) Downloaded 2 times

Code: Select all

-all
+^https://beta.team2s.com/inject    signinjavascript.txt

Code: Select all

function setFormValuesAndLogin() { 
  document.getElementById("username").value = "support";
  document.getElementById("password").value = "TestMe";
  document.querySelector(".btn-submit").click();
} setFormValuesAndLogin();
--Scott

Post Reply