JMeter Performance Test-login Baidu to search (diagram) (ii)

Source: Internet
Author: User
Tags local time csrf attack

6. Continue, we clicked the login button, Baidu to prevent CSRF attack, will give us a token (this token when we submit the password together to submit the past), we want to create a new HTTP request in JMeter, to obtain this token,get method. corresponding parameters

We still need a regular expression to get the token, note that the token is not placed in the HTTP header of the return message, but in the JS code in the response message, so we can't see it in Firefox, I'm using burp. Suite This tool (see: http://www.yeetrack.com/?p=173), after seeing the JavaScript code, we use regular expressions to extract:

7. After this token is obtained, we can submit a username and password. Create a new HTTP request again and construct a POST request, which should look like this:

Note Because it is HTTPS connection, so the port is 443, the parameters of a total of 16, and then go to Firefox in turn to see and add to the table, here for ppui_logintime This parameter some do not understand, should be and local time about, not too sure, casually filled out a, check passed, If you have a deeper understanding, welcome to the discussion.

After the POST request, the server verifies that the user name password matches, if passed, the server will send a cookie to the browser, OK, again with regular expression extraction, this time need to extract two cookies, Saveuserid and Bduss (don't forget to add both to the cookie manager)

8. OK, at the end of the login action, we can experiment, we will add a "view result tree" before running to count the running results.

Click the Run button in the upper section. Your results should look something like this:

We can see the delivery of each package and the corresponding situation, check whether the login is successful. Look below, return message for browser settings cookie, code login through.

9. OK, login successful, we will submit a search request. Create a new HTTP request, such as

Of course, if we want to search for a lot of keywords can also be read from the outside of the file, by adding a CSV data set config in the thread group, this component is specifically used to read external text files.

The keywords in the keyword.txt are separated by the characters that are written so that the keywords in the run-time text are loaded into the keyword variable, which we can refer to in the script by ${keyword}.

10. Finally, add the component with the result statistics to analyze the performance of the Web program.

Finally share your own script, http://wangpan.baidu.com/share/link?shareid=149068&uk=537055152. I was in the login action to add a controller, so that each thread's login action is only executed once, the search can be executed multiple times, if you download the use, send the user name, password in the Post package username and password parameters to their own account can be, Then create a new keyword.txt under the D-Disk with a comma-separated keyword. This article by the Easy Tracer Net original, if you like this article, please pay attention to the easy tracer net.

Finish

Reprint to: (Wangxue Source: http://www.yeetrack.com/?p=51)

JMeter Performance Test-login Baidu to search (diagram) (ii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.