实验吧-web-python编程-天下武功唯快不破
2018-03-20 本文已影响0人
Cookie_hunter
流程
![](https://img.haomeiwen.com/i11013380/728187650b21f7b0.png)
查看源代码,发现要上传的东西为:key
![](https://img.haomeiwen.com/i11013380/2cad63436bb80d2f.png)
按F12,点网络,重新加载
![](https://img.haomeiwen.com/i11013380/3dc85bd26669530c.png)
点击
![](https://img.haomeiwen.com/i11013380/78f4c9c652289c0c.png)
发现响应头中flag,base64密文
![](https://img.haomeiwen.com/i11013380/98871be15df96c00.png)
然后代码跑起来
import requests
import base64
print(requests.post(url,data = {'key':str(base64.b64decode(requests.get(url).headers["flag"])).split(':')[1][:-1]}).text)
相当于以下代码
import requests
import base64
url = "http://ctf5.shiyanbar.com/web/10/10.php" #获取url
flag = requests.get(url).headers["flag"] #从响应头中获取flag密文
# print(flag)
temp =str(base64.b64decode(flag)) #base64解码转字符形数据
# print(temp)
key = temp.split(':')[1][:-1] #截取要提交的key
# print(key)
anwser = requests.post(url,data = {'key':key}).text #提交
print(anwser) #输出结果