标签:lex 请求头 用户表 content 获取 伪造 二手 nes http请求
今日概要:
1、cookie和session
2、csrf 跨站请求伪造
3、自定义分页
- Http请求本质
浏览器(socket客户端):
2. socket.connect(ip,端口)
3. socket.send("http://www.xiaohuar.com/index.html....")
规则:http协议
GET请求:
"GET /index.html?k1=1&k2=2 Http/1.1\r\nhost:www.xiaohuar.com\r\ncontent-type:application/json\r\n\r\n"
请求头和请求体使用\r\n\r\n分割,前面头,后面是体
POST请求:
"POST /index.html?k1=1&k2=2 Http/1.1\r\nhost:www.xiaohuar.com\r\ncontent-type:application/json\r\n\r\nusername=alex&pwd=123123"
请求头和请求体使用\r\n\r\n分割,前面头,后面是体
www.xiaohuar.com/index.html?k1=1&k2=2
6. 获取相应
响应头,响应体 = data.split(‘\r\n\r\n‘)
7. 断开连接
网站(socket服务端):
1. 服务端运行: ip,端口
4. 字符串 = server.recv()
头,体 = data.split("\r\n\r\n=")
request.POST.get()
5. 服务端响应:
conn.send(‘......‘)
响应头:
响应体:
7. 断开连接
总结:
a. Http请求中本质都是字符串
b. Http请求短连接(请求,响应断开连接)
c. 请求和响应都有:头、体
请求:
请求头
\r\n\r\n
请求体
响应:
响应头
\r\n\r\n
响应体
<html>
....
</html>
- 创建表: 业务线
- models.xx.objects.create(name=‘canada‘)
- models.xx.objects.create(**dic)
- models.xx.objects.filter(id__gt=1).delete()
- models.xx.objects.filter(id=1).delete()
- models.xx.objects.exclude(id=1).delete()
- models.xx.objects.filter(id=1).update(name=‘ddd‘)
- models.xx.objects.filter(id=1).update(**dic)
- 创建表:
业务线
主机表
id host port bs
# queryset = [对象,对象,...]
- objs = models.xx.objects.all()
for row in objs:
row.id
row.host
row.port
row.bs.name
# queryset = [{},{},...]
- objs = models.xx.objects.all().values(‘id‘,‘host‘,‘port‘,‘bs__name‘)
for row in objs:
row[‘id‘]
row[‘bs__name‘]
# queryset = [(1,1.1.11,80,‘Web‘),(),()...]
- objs = models.xx.objects.all().values_list(‘id‘,‘host‘,‘port‘,‘bs__name‘) #正向查找bs的名字
for row in objs:
row[0]
row[1]
model操作
- 创建表:
用户表(id, user,pwd,email,mm)
业务线(id, name) # 用户表_set
主机表(id host port bs)
用户业务线关系表(id uid bid) ******
1 22 1
2 22 11
- obj = modes.userinfo.objects.filter(user=‘日语哥‘).first()
obj.mm.add(1)
obj.mm.add(11)
# 日语哥负责的所有业务线 -> [业务线对象,业务线对象,]
queryset = obj.mm.all()
for row in queryset:
row.id
row.name
- 二手车业务线是由那些人负责 通过对象_set方法进行反向查找
obj = models.business_unit.objects.filter(name=‘二手车‘).first()
queryset = obj.userinfo_set.all() #[用户对象,用户对象,]
for row in queryset:
row.user
row.pwd
python自动化开发-[第十九天]-分页,cookie,session
标签:lex 请求头 用户表 content 获取 伪造 二手 nes http请求
原文地址:http://www.cnblogs.com/liujiliang/p/7492622.html