0%

PPC-字符统计

字符统计

题意也没什么好说的,主要是找了找 python 好用的 http 请求库,发现 requests 真的是很好用啊。。。还有就是一定要看清楚表单。。。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import requests
import re
import string

cookie = {'Cookie' : 'wctf_think_language=zh-CN;PHPSESSID=ltbxxxxxxxxxxxxxxxxxxxxfl6'}
r = requests.get("http://ctf.idf.cn/game/pro/37/", cookies = cookie)

text = re.search(r'<hr />\s(.*)\s<hr />', r.text, re.S).group(1)
res = ""
res += str(text.count('w'))
res += str(text.count('o'))
res += str(text.count('l'))
res += str(text.count('d'))
res += str(text.count('y'))
print(res)

payload = {'anwser':res}
r = requests.post("http://ctf.idf.cn/game/pro/37/", cookies = cookie, data = payload)
print(r.text)
咖啡,亦我所需也