Use HTML to log in to the PHPChina Chinese developer community through the POST method

HttpWatch's packet capture process/C/C++ TCP/IP protocol submission method can be found at: c++ submit POST information through TCP/IP protocol to log in to PHPChina Chinese developer community

For the submission method of C++ through Wininet library, please refer to: C++ submit POST information through Wininet library to log in to PHPChina Chinese developer community

This time I use the developer tools on IE that comes with Win7 to capture the package!

The first step is to open IE and enter the official website of the PHPChina Chinese developer community: http://www.phpchina.com/


Now start to open the developer tools, find the developer tools in the drop-down menu that pops up from the settings icon in the upper right corner of IE, or you can directly press F12!


Select Network in the developer tools that pop up:



You can start capturing packets

Don't capture the packet immediately, first enter the login page (to prevent invalid HTTP protocol from being caught during page operation):


After entering the account password, start capturing packets



Click to log in:



We don't need to worry about it if the login fails, because the account and password are all casually lost!

Here, let's see if the package capture tool has captured the package:


You can see that three packets were captured, one POST and two GETs. Obviously, POST is the protocol request we are looking for, because we just performed the click operation:


Right-click to copy the URL:


Then save the URL:

URL Protocol Method Result Type Received Spent Initiator Waiting‎‎ Start‎‎ Request‎‎ Response‎‎ Read Cache‎‎ Gap‎‎
/member.php?mod=logging&action=login&loginsubmit=yes&loginhash=Lt4DQ&inajax=1 HTTP POST 200 text/xml .69 KB 109 ms Click 76223 31 0 78 0 156

Then double-click the selected URL protocol - select the request body:



Note that the Chinese characters in the username in the first line are replaced with the hexadecimal number corresponding to the u code, and the password is also encrypted!

Here is the protocol I caught:

Request URL, method POST:

/member.php?mod=logging&action=login&loginsubmit=yes&loginhash=Lt4DQ&inajax=1

POST request data:

formhash=225be104&referer=http%3A%2F%2Fwww.phpchina.com%2F&username=17%E5%B2%81boy%E5%8D%9A%E5%AE%A2&password=c8837b23ff8aaa8a2dde915473ce0991&questionid=0&answer=

Let's start writing the HTML code:

<!--standard start-->
<html>
<body>

Submit as a form, note that the requested page must be a complete absolute address, (use target="_blank" to request the page):

<!--Submit as form: POST-->
<form action="http://www.phpchina.com//member.php?mod=logging&action=login&loginsubmit=yes&loginhash=Lfi72&inajax=1" method="post" target="_blank">
<h1>formhash:</h1>
<input type="text" name="formhash" value="225be104">				<!--formhash-->
<br>
<h1>referer:</h1>
<input type="text" name="referer" value="http%3A%2F%2Fwww.phpchina.com%2F">	<!--referer-->
<br>
<h1>Account:</h1>
<input type="text" name="username" value="17%E5%B2%81boy%E5%8D%9A%E5%AE%A2">	<!--账号-->
<br>
<h1>Password:</h1>
<input type="text" name="password" value="c8837b23ff8aaa8a2dde915473ce0991">	<!--密码-->
<br>
<h1>questionid:</h1>
<input type="text" name="questionid" value="0">					<!--questionid-->
<br>
<h1>answer:</h1>
<input type="text" name="answer" value="">					<!--answer-->
<br>
<h1>POST:</h1>
<input type="submit" value="Submit"> <!--Submit button-->
</form> <!--end of form-->


<!--End of page-->
</body>
</html>

running result:


After clicking submit, the browser will automatically jump to the request page and display the request result:


Full code:

<!--standard start-->
<html>
<body>
<!--Submit as form: POST-->
<form action="http://www.phpchina.com//member.php?mod=logging&action=login&loginsubmit=yes&loginhash=Lfi72&inajax=1" method="post" target="_blank">
<h1>formhash:</h1>
<input type="text" name="formhash" value="225be104">				<!--formhash-->
<br>
<h1>referer:</h1>
<input type="text" name="referer" value="http%3A%2F%2Fwww.phpchina.com%2F">	<!--referer-->
<br>
<h1>Account:</h1>
<input type="text" name="username" value="17%E5%B2%81boy%E5%8D%9A%E5%AE%A2">	<!--账号-->
<br>
<h1>Password:</h1>
<input type="text" name="password" value="c8837b23ff8aaa8a2dde915473ce0991">	<!--密码-->
<br>
<h1>questionid:</h1>
<input type="text" name="questionid" value="0">					<!--questionid-->
<br>
<h1>answer:</h1>
<input type="text" name="answer" value="">					<!--answer-->
<br>
<h1>POST:</h1>
<input type="submit" value="Submit"> <!--Submit button-->
</form> <!--end of form-->
<!--End of page-->
</body>
</html>


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325773157&siteId=291194637