import httplib
from HTMLParser import HTMLParser
import urlparse
import urllib
from bs4 import BeautifulSoup
import re
from time import sleep
'''
usage: input your wooyun cookies,then just go crawl!! author: Elliott ''' domain = 'wooyun.org'
cookies = '' # !!!!here input your wooyun cookies
user_agent = 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:29.0) Gecko/20100101 Firefox/29.0' def countnumber(): # the function to get page num
global domain
global cookies
global user_agent
conn = httplib.HTTPConnection(domain)
conn.request('GET','/user.php?action=openbugs','',{'Cookie':cookies,'User-Agent':user_agent,'Referer':'http://wooyun.org/index.php','Host':'wooyun.org'})
content = conn.getresponse()
content = content.read()
soup = BeautifulSoup(content)
tag = soup.find_all('p',attrs={'class':'page'})
if len(tag) == 0:
tag = 'None'
else:
tag = str(tag[0])
pattern = re.compile('>.*<a class=\"current\">')
result = pattern.findall(tag)
if len(result) == 0:
result = 'None'
else:
result = str(result[0])
number = filter(str.isdigit, result)
num = number[5:] #get then total page number
return int(num) def dealthepage(content):
global domain
global cookies
global user_agent
conn = httplib.HTTPConnection(domain)
soup = BeautifulSoup(content)
k = soup.find_all('a')
item = k[27:47]
pattern = re.compile('href=\"(.+?)\"')
hreaf = []
for i in range(len(item)):
ss = pattern.findall(str(item[i]))
if len(ss) == 0:
break
hreaf.append(str(ss[0]))
for i in hreaf:
#sleep(0.5)
conn.request('GET',i,'',{'Cookie':cookies,'User-Agent':user_agent,'Referer':'http://wooyun.org/index.php','Host':'wooyun.org'})
content2 = conn.getresponse()
content2 = content2.read()
soup2 = BeautifulSoup(content2)
imgtag = soup2.find_all(class_='credit')
'''may be $ or cloud'''
if len(imgtag) != 0:
findcloud = re.compile('src=\"\/images\/credit\.png\"')
findmoney = re.compile('src=\"\/images\/m(.?)\.png\"')
cloudnum = findcloud.findall(content2)
moneylevel = findmoney.findall(content2)
cloud = 0
money = 0
if len(cloudnum) != 0:
if len(cloudnum) == 1:
cloud = 1
if len(cloudnum) == 2:
cloud = 2
if len(cloudnum) == 3:
cloud = 3
if len(moneylevel) != 0:
if len(moneylevel) == 1:
money = 1
if len(moneylevel) == 2:
money = 2
if len(moneylevel) == 3:
money = 3
title = soup2.findAll(attrs={"class":"wybug_title"})
if len(title) == 0:
title = 'No Title'
else:
title = str(title[0])
deltag = re.compile('r<[^>]+>')
title = deltag.sub('',title)
author = soup2.findAll(attrs={"class":"wybug_author"})
if len(author) == 0:
author = 'No name'
else:
author = str(author[0])
author = deltag.sub('',author)
date = soup2.findAll(attrs={"class":"wybug_date"})
if len(date) == 0:
date = 'No time'
else:
date = str(date[0])
date = deltag.sub('',date)
link = "http://www.wooyun.org"+i
link = str(link)
f = open("test.html","a+")
s = "<tr><td>level:cloud="+str(cloud)+"money="+str(money)+"</td><th>"+date+"</th><td><a href='"+link+"'>"+title+"</a></td><th>"+author+"</th></tr><br>"
f.write(s)
f.close if __name__ == '__main__':
num = countnumber() #get page num
for i in range(num):
conn = httplib.HTTPConnection(domain)
conn.request('GET','/user.php?action=openbugs&pNO='+str(i+1),'',{'Cookie':cookies,'User-Agent':user_agent,'Referer':'http://wooyun.org/index.php','Host':'wooyun.org'})
content = conn.getresponse()
content = content.read()
dealthepage(content)

附章效果图:

爬取乌云上所有人民币和乌云符号的漏洞(python脚本)的更多相关文章

  1. 使用python爬取MedSci上的期刊信息

    使用python爬取medsci上的期刊信息,通过设定条件,然后获取相应的期刊的的影响因子排名,期刊名称,英文全称和影响因子.主要过程如下: 首先,通过分析网站http://www.medsci.cn ...

  2. 爬虫入门(三)——动态网页爬取:爬取pexel上的图片

    Pexel上有大量精美的图片,没事总想看看有什么好看的自己保存到电脑里可能会很有用 但是一个一个保存当然太麻烦了 所以不如我们写个爬虫吧(๑•̀ㅂ•́)و✧ 一开始学习爬虫的时候希望爬取pexel上的 ...

  3. Python编写网页爬虫爬取oj上的代码信息

    OJ升级,代码可能会丢失. 所以要事先备份. 一開始傻傻的复制粘贴, 后来实在不能忍, 得益于大潇的启示和聪神的原始代码, 网页爬虫走起! 已经有段时间没看Python, 这次网页爬虫的原始代码是 p ...

  4. steam夏日促销悄然开始,用Python爬取排行榜上的游戏打折信息

    前言 本文的文字及图片来源于网络,仅供学习.交流使用,不具有任何商业用途,版权归原作者所有,如有问题请及时联系我们以作处理. 不知不觉,一年一度如火如荼的steam夏日促销悄然开始了.每年通过大大小小 ...

  5. Python爬取网站上面的数据很简单,但是如何爬取APP上面的数据呢

  6. C# 爬取网页上的数据

    最近工作中需求定时爬取不同城市每天的温度.其实就是通过编程的方法去抓取不同网站网页进行分析筛选的过程..NET提供了很多类去访问并获得远程网页的数据,比如WebClient类和HttpWebReque ...

  7. 爬取 StackOverFlow 上有关于 Python 的问题

    给定起始页面以及爬取页数,要求得到每一个问题的标题.票数.回答数.查看数 stackflow <- function(page){ url <- "http://stackove ...

  8. python爬虫16 | 你,快去试试用多进程的方式重新去爬取豆瓣上的电影

    我们在之前的文章谈到了高效爬虫 在 python 中 多线程下的 GIL 锁会让多线程显得有点鸡肋 特别是在 CPU 密集型的代码下 多线程被 GIL 锁搞得效率不高 特别是对于多核的 CPU 来说 ...

  9. 利用Python爬取OPGG上英雄联盟英雄胜率及选取率信息

    一.分析网站内容 本次爬取网站为opgg,网址为:” http://www.op.gg/champion/statistics” 由网站界面可以看出,右侧有英雄的详细信息,以Garen为例,胜率为53 ...

随机推荐

  1. Template类的使用指南【python】

    转自:http://www.jb51.net/article/55011.htm

  2. cocos2dx游戏--欢欢英雄传说--添加攻击按钮

    接下来添加攻击按钮用于执行攻击动作.同时修复了上一版移动时的bug.修复后的Player::walkTo()函数: void Player::walkTo(Vec2 dest) { if (_seq) ...

  3. iOS性能调优系列(全)

    总结: 三类工具 基础工具 (NSLog的方式记录运行时间.) 性能工具.检测各个部分的性能表现,找出性能瓶颈 内存工具.检查内存正确性和内存使用效率 性能工具: 可以衡量CPU的使用,时间的消耗,电 ...

  4. ajax的历史

    ajax (AJAX开发) 编辑 AJAX即“Asynchronous Javascript And XML”(异步JavaScript和XML),是指一种创建交互式网页应用的网页开发技术. AJAX ...

  5. POJ 3461 Oulipo[附KMP算法详细流程讲解]

      E - Oulipo Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u Submit ...

  6. [MongoDB]安装MongoDB遇到问题

    1. 首先,当然是下载 MongoDB MongoDB的官方网站是:http://www.mongodb.org/, 最新版本下载在:http://www.mongodb.org/downloads  ...

  7. .net asp 在1.asp页面嵌入另一个页面2.asp

    <iframe src="http://www.baidu.com" width="100%" height="100%" onloa ...

  8. RMAN备份详解

    1.7.1数据库备份与RMAN备份的概念 1.数据库完全备份:按归档模式分为归档和非归档 归档模式 打开状态,属于非一致性备份 关闭状态,可以分为一致性和非一致性 非归档模式 打开状态,非一致性备份无 ...

  9. 关于string的length

    在C++里面,std::string的length()返回的是字节数,与编码方式有关. int main() { std::string s = "我是中国人"; std::cou ...

  10. 提醒事项 1. 冥想TX 2.下班路上听歌激励自己 3. 不戴眼镜 4. 困难任务拆解

    1. 冥想TX 2.下班路上听歌激励自己 3. 不戴眼镜 4. 困难任务拆解