天下武功,唯快不破
原题链接
http://ctf5.shiyanbar.com/web/10/10.php
分析
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 -->
发现响应头有FLAG,并且FLAG会变
HTTP/1.1 200 OK
Date: Tue, 07 Aug 2018 07:36:40 GMT
Server: Apache/2.4.18 (Win32) OpenSSL/1.0.2e PHP/5.3.29
X-Powered-By: PHP/5.3.29
FLAG: UDBTVF9USElTX1QwX0NINE5HRV9GTDRHOnpoN1dtNlMzQQ==
Content-Length: 216
Connection: close
Content-Type: text/html
解码为P0ST_THIS_T0_CH4NGE_FL4G:zh7Wm6S3A
,大概意思是我们要POST key='ChangeString'
但是问题是,这个key在响应头里,不可能直接POST,至少得先接受一下。
猜测是有时间限制,但是session会保留一小会,这段时间的key是一样的。
但是由于时间的限制,所以只能写脚本接受数据,POST。
#coding:utf-8
import requests
import base64
url = 'http://ctf5.shiyanbar.com/web/10/10.php'
res = requests.get(url)
key = base64.b64decode(res.headers['FLAG']).split(':')[1]
print key
Postdata = {'key':key}
res = requests.post(url=url,data=Postdata)
print res.text
结果
Ee28JfTyP
CTF{Y0U_4R3_1NCR3D1BL3_F4ST!}
[Finished in 0.4s]
flag
CTF{Y0U_4R3_1NCR3D1BL3_F4ST!}
知识点
requests库,base64编码,session