IDF实验室-简单编程-字符统计 writeup

题目地址:http://ctf.idf.cn/index.php?g=game&m=article&a=index&id=37

网站:http://ctf.idf.cn/game/pro/37/

主要是要有2秒的限制。写个python 脚本。

#!usr/bin/env python
#!coding=utf-8

import requests
import re
__author__ = 'zhengjim'


url = 'http://ctf.idf.cn/game/pro/37/'
res = requests.get(url)
_cookies = res.cookies
a = res.text
b = re.findall(r'<hr />(.*)<hr />',a,re.S)
c = ','.join(b)
w = str(c.count('w'))
o = str(c.count('o'))
l = str(c.count('l'))
d = str(c.count('d'))
y = str(c.count('y'))
anw = w+o+l+d+y
print anw

payload = {'anwser':anw}
asd = requests.post("http://ctf.idf.cn/game/pro/37/",cookies=_cookies, data=payload)
print asd.content

 

程序很简单。  

关键是提示时的cookies要与第一次访问的cookies一样,否则会提醒花儿都谢啦。

 

posted @ 2016-11-26 19:35  Zhengjim  阅读(749)  评论(0编辑  收藏  举报