题目链接:
http://www.shiyanbar.com/ctf/1854
分析:
- 打开提供网站 , 发现页面中提示 :
There is no martial art is indefectible, while the fastest speed is the only way for long success.>>>>>>
----You must do it as fast as you can!----<<<<<<
没有武术的不败,而最快速度是长期成功的唯一途径。>>>>>>
----你必须尽你所能的快!---- <<<<<<
- 查看网页源码 , 发现结尾处有一段注释 :
<!-- please post what you find with parameter:key -->
- 提示让我们查看"响应头" , 并将数据以POST的形式发送 :
Paste_Image.png
在响应头中发现了KEY, 看起来像是一个Base64编码, 解码后发现是 : "P0ST_THIS_T0_CH4NGE_FL4G:FD13AeAje", 多次尝试后发现, ':'后面的数据是随机生成的
尝试是用Chrome浏览器的PostMan插件进行Post方式提交 :
(也可以利用其他的工具 : 火狐/自定义相应头是用nc进行提交/利用Python脚本)但是并没有出现结果 , 又想到刚才的提示中提到 , 要尽可能得快速提交 , 因此开始写脚本 :
# coding:utf8
import requests
import base64
url = "http://ctf4.shiyanbar.com/web/10.php" # 目标URL
s = requests.Session() # 获取 Session
response = s.get(url) # 打开链接
head = response.headers # 获取响应头
flag = base64.b64decode(head['flag']).split(':')[1] # 获取相应头中的Flag
print flag # 打印Flag
postData = {'key': flag} # 构造Post请求体
result = s.post(url=url, data=postData) # 利用Post方式发送请求
# (注意要在同一个Session中 , 有的时候还需要设置Cookies , 但是此题不需要)
print result.text # 打印响应内容
答案:
CTF{Y0U_4R3_1NCR3D1BL3_F4ST!}
知识点: