首页 > 其他 > 详细

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

时间:2016-11-26 20:52:20      阅读:417      评论:0      收藏:0      [点我收藏+]

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

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

技术分享

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

 1 #!usr/bin/env python
 2 #!coding=utf-8
 3 
 4 import requests
 5 import re
 6 __author__ = ‘zhengjim‘
 7 
 8 
 9 url = ‘http://ctf.idf.cn/game/pro/37/‘
10 res = requests.get(url)
11 _cookies = res.cookies
12 a = res.text
13 b = re.findall(r‘<hr />(.*)<hr />‘,a,re.S)
14 c = ‘,‘.join(b)
15 w = str(c.count(‘w‘))
16 o = str(c.count(‘o‘))
17 l = str(c.count(‘l‘))
18 d = str(c.count(‘d‘))
19 y = str(c.count(‘y‘))
20 anw = w+o+l+d+y
21 print anw
22 
23 payload = {‘anwser‘:anw}
24 asd = requests.post("http://ctf.idf.cn/game/pro/37/",cookies=_cookies, data=payload)
25 print asd.content

程序很简单。  

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

技术分享

 

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

原文:http://www.cnblogs.com/zhengjim/p/6105020.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!