摘要: 以下是一个简单的demo模型,具体的注册接口替换过去就可以了 阅读全文
posted @ 2019-01-22 19:17 千年妖狐 阅读(949) 评论(0) 推荐(0) 编辑
摘要: 前面用篇专门讲了requests实现接口的参数关联案例,这里直接转化成locust脚本就行了 阅读全文
posted @ 2019-01-22 19:16 千年妖狐 阅读(1243) 评论(0) 推荐(0) 编辑
摘要: # 保存为locustfile.py # coding=utf-8 from locust import HttpLocust, TaskSet, task ''' 实现场景:先登录(只登录一次),然后访问->我的地盘页->产品页->项目页 访问我的地盘页面权重为2,产品页和项目页权重各为1 ''' 阅读全文
posted @ 2019-01-22 19:12 千年妖狐 阅读(559) 评论(0) 推荐(0) 编辑
摘要: from locust import HttpLocust, TaskSet, taskimport os, json# 性能测试任务类 TaskSet.class UserBehavior(TaskSet): # 只运行一次的方法 @task def on_start(self): pass # 阅读全文
posted @ 2019-01-22 18:27 千年妖狐 阅读(340) 评论(0) 推荐(0) 编辑
该文被密码保护。 阅读全文
posted @ 2019-01-22 18:20 千年妖狐 阅读(0) 评论(0) 推荐(0) 编辑
摘要: 对字符串传入的字典参数进行urlencode编码,就需要用到两个方法urlencode和quoteurlencode方法传字典参数 quote传字符串参数 阅读全文
posted @ 2019-01-22 18:08 千年妖狐 阅读(1785) 评论(0) 推荐(0) 编辑
摘要: s = requests.session() # 保持会话 r = s.post(loginUrl, data=body, headers=h) print r.content # 打印结果登录成功了 # 上传图片 url1 = "http://127.0.0.1:81/zentao/file-aj 阅读全文
posted @ 2019-01-22 17:29 千年妖狐 阅读(275) 评论(0) 推荐(0) 编辑
摘要: # coding:utf-8 import requests url = "http://httpbin.org/post" # python3字符串换行,在右边加个反斜杠 body ='<?xml version="1.0" encoding = "UTF-8"?>' \ '<COM>' \ '< 阅读全文
posted @ 2019-01-22 17:15 千年妖狐 阅读(776) 评论(0) 推荐(0) 编辑
摘要: 检查项 风险等级 简单测试方法 输入输出校验 SQL注入 高 1、输入单引号'看程序是否会报错。 XSS 高 1、给任意参数赋值“" '<img> abc ( ) =”看返回的页面中是否有对这些字符进行转义或其它编码处理。 命令注入 高 1、在目测可能有系统命令字符串的参数中输入常见的系统命令,看返 阅读全文
posted @ 2019-01-22 17:02 千年妖狐 阅读(258) 评论(0) 推荐(0) 编辑
摘要: import hashlib # MD5加密 def jiamimd5(src): m = hashlib.md5() m.update(src.encode('UTF-8')) return m.hexdigest() import time print(time.time) # 获取时间戳,浮点 阅读全文
posted @ 2019-01-22 16:53 千年妖狐 阅读(472) 评论(0) 推荐(0) 编辑
摘要: # coding:utf-8 import requests # url = 'http://www.xxx.com/xxx/xxx?begNy=&endNy=' herder = { "Accept": "text/html,application/xhtml+xml,application/xm 阅读全文
posted @ 2019-01-22 16:39 千年妖狐 阅读(228) 评论(0) 推荐(0) 编辑
摘要: # coding:utf-8import requests# 禁用安全请求警告from requests.packages.urllib3.exceptions import InsecureRequestWarningrequests.packages.urllib3.disable_warnin 阅读全文
posted @ 2019-01-22 16:26 千年妖狐 阅读(242) 评论(0) 推荐(0) 编辑
摘要: # coding:utf-8import requestsxxxxx if __name__ == "__main__": url = "https://passport.cnblogs.com/user/signin" payload = { "input1": "xxx", "input2": 阅读全文
posted @ 2019-01-22 16:23 千年妖狐 阅读(149) 评论(0) 推荐(0) 编辑
摘要: r2 = s.post(url2, data=body, verify=False)# 获取当前url地址print r2.url# 第三步:正则提取需要的参数值import repostid = re.findall(r"postid=(.+?)&", r2.url)print postid # 阅读全文
posted @ 2019-01-22 16:05 千年妖狐 阅读(278) 评论(0) 推荐(0) 编辑
摘要: # coding:utf-8import requests# 请求头headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0" }s = requests. 阅读全文
posted @ 2019-01-22 15:59 千年妖狐 阅读(275) 评论(0) 推荐(0) 编辑
摘要: # coding:utf-8import requestsurl = "http://www.kuaidi.com/index-ajaxselectcourierinfo-1202247993797-yunda.html"headers = { "User-Agent": "Mozilla/5.0 阅读全文
posted @ 2019-01-22 15:52 千年妖狐 阅读(190) 评论(0) 推荐(0) 编辑
摘要: paylod = {"xx":"xxxx", "xx":"xxx"} r = requests.post("xxxxxxxxxx", data=paylod) print(r.text) --json paylod = {"xx":"xxxx", "xx":"xxx"} data_json = du 阅读全文
posted @ 2019-01-22 15:13 千年妖狐 阅读(403) 评论(0) 推荐(0) 编辑
摘要: --不带参数 r = requests.get("xxxxxxxxxx") print(r.content) --带参数 pa = {"xxx":"xxx"} r = requests.get("xxxxxxxxxx", param=pa) print(r.content) -- r.status_ 阅读全文
posted @ 2019-01-22 15:01 千年妖狐 阅读(149) 评论(0) 推荐(0) 编辑
摘要: # coding:utf-8import requests# 先打开登录首页,获取部分cookieurl = "https://passport.cnblogs.com/user/signin"headers = { "User-Agent": "Mozilla/5.0 (Windows NT 10 阅读全文
posted @ 2019-01-22 14:54 千年妖狐 阅读(460) 评论(0) 推荐(0) 编辑