(fiddler, postman, jmeter) tools use image upload

Interface address: http://www.testingedu.com.cn:8000/index.php/Home/user/index.html

Capture tool: fiddler 

Interface testing tools: fiddler, postman, jmeter, requests 

idea:pycharm+python3.9

foreword

Hope you get something after reading it. V: qing_an_an, official account:

fiddler

premise

What is the prerequisite for changing the avatar? Log in, of course. ead8bdb6a85ea13f858cf12266a5107f.pngGo through the sessions, pause the packet capture, find the personal information on the web page, and then open fiddler to manually change the avatar. It can be seen that the replacement was successful. Why is this an interface for changing the avatar? In addition to success, you can also capture packets step by step! 9aaf8a2c044b05f99114159b40aab4c4.pngOnce the key information is obtained, we use the tool to repeat the operation.

Step 1: Get the cookie

506fac94ed2ee909fc542ffc06d94729.pngSelect Cookie directly CTRL+C

Step 2: Add parameters

f0ddcc9809ca45d79ab47357739a816b.pngHow to change the packet capture parameters, see below:1b24f0c86990083bc2c832f13fac74f5.png

Step 3: Initiate a request

d3af47573823c6e27c6b882047ec9b3d.png
image.png

important point:

Why is one parameter enough? Because others can be regarded as no need to pass parameters. After adding pictures in step 2, a column of parameters will be added in Psrsed, which is a must.

postman

775134198ea2c5e988dda95b5b6a91a9.pngAfter fiddler, the parameters are all there, and the rest is just copying.

Step 1: Fill in the parameters

The url address can be taken directly from fiddler.5d094b789f282947ca0ed99663cbda77.png

Step 2: Initiate a request

3133669d8673c3a410ebd65edf493eaa.png
image.png

Notice:

The parameters of step 1 and step 2 are the same, here is just to tell you that the parameters are optional

jmeter

Step 1: Add Appliances

65b69410df79f30cc8a130e5727e12fa.png
image.png

Test Plan >> Add >> >> Thread (User)

Add Thread Group》》》Add》》》"Sampler》》》HTTP Request (Avatar Upload)

Add thread group """Add"""Listener"""View result tree

Add Thread Group》》》Add》》》Configuration Originals》》》HTTP Information Header Management


"Just add the above four"

Step 2: Parameters of each appliance

a7f39c701b2b54f9c30f45a81b15d319.pngThe parameter here is the cookie. Refer to step 1 in fiddler d810fb3983c69a77eeaeae73ac8f903f.pngand pay attention to the port number, because the project has already been specified. The parameters here are also optional. 39bc61e0a948a07316e6835e34453e05.pngThe important thing is this step, pay attention. Exactly the same as postman.

Step 3: Initiate a request

f3238c572a26180783b2d1c8e89f2574.png
image.png

python

Step 1: Import package

import requests

If not, pip install requests

Step 2: Go back to postman

4a35aa59ae60dfa02135323c5fde1277.pngPay attention to the three items circled in the picture, step by step from left to right.

Step 3: Back to pycharm

import requests

url = "http://www.testingedu.com.cn:8000/index.php/home/Uploadify/imageUp/savepath/head_pic/pictitle/banner/dir/images.html?"

payload={'filename': '2.jpg'}
files=[
  ('file',('2.jpg',open('E:/VUE_DEMO/src/2.jpg','rb'),'image/jpeg'))
]
headers = {
  'Cookie': 'PHPSESSID=3dl8qf3crfk0mo9e6lu4td6gl6; is_distribut=0; is_mobile=0; uname=%25E7%25A7%258B%25E7%25A7%258B; user_id=8'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)

Just copy it in. The cookies and headers here are all parameters in postman. If you can't understand the code, it's okay to use the tool well. The code will be explained later.

Step 4: Run the code

26826dc574742e23ff089c6111523c41.png
image.png

Actual combat:

CSDN actual combat interface to change the avatar:

Step 1: Go through the process

First register an account and log in. We only change the avatar on the actual combat interface, no need to grab other packages!

Step 2: Open fiddler and enter csdn

Be sure to enter the personal data interface first, then start packet 093b7f3ed31d032e395b76443bf74345.pngcapture, and manually change the avatar once. 7803919bfc7464d7f939ec142b57d405.pngWhy can you quickly determine the interface, you can see the name, and the location of the avatar picture. Under normal circumstances, the upper part of the picture is enough, and you can check the parameters to confirm.

Step 3: Get started

d885b32aab0a2568f648dd5702aaead0.png58c809fa9b3711e1996d85cc7d660672.pngcf5d372f31901414fc47bd465d88656c.pngFinally, the request is initiated. You can go to CSDN to see for yourself, the avatar is already under review. Don't forget to modify the filename parameter, which is the location of your picture.b3d2445dffa52814bde342969def4c0f.png

Guess you like

Origin blog.csdn.net/weixin_52040868/article/details/129891717