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. shell基础篇(十)shell脚本的包含

    前记 写到这里:shell中基础差不多已经讲完了.希望你已经对shell有了一个基本了解.你可能跃跃欲试,要写一些程序练习一下.这会对你很有好处.建议大家去chinaunix去学习:我是li0924. ...

  2. hive与hbase的联系与区别

    hive与hbase的联系与区别: 共同点: 1.hbase与hive都是架构在hadoop之上的.都是用hadoop作为底层存储. 他们的底层是要通过mapreduce分布式计算的,hbase.hi ...

  3. Linux printf 命令

    printf 命令用来格式化输出,用法如下: [keysystem@localhost ~]$ printf "%s\n" 1 2 3 4 1 2 3 4 [keysystem@l ...

  4. 心脏滴血HeartBleed漏洞研究及其POC

    一.漏洞原理: 首先声明,我虽然能看懂C和C++的每一行代码,但是他们连在一起我就不知道什么鬼东西了.所以关于代码说理的部分只能参考其他大牛的博客了. /* 据说源码中有下面两条语句,反正我也没看过源 ...

  5. Android中集成QQ登陆和QQ好友分享及QQ空间分享

    extends : http://blog.csdn.net/arjinmc/article/details/38439957 相关官方文档及下载地址: 如果只用分享和登陆,用lite包就可以,体积小 ...

  6. Oracle各种表空间

    system表空间:含数据字典信息 sysaux表空间:存储各种oracle应用的元数据(如AWR的操作数据) 创建表空间后,不能改变区尺寸 区尺寸管理:自动分配(AUTOALLOCATE):小段64 ...

  7. 一键搞定JavaEE应用,JRE+Tomcat+Mysql-JaveEE绿色运行环境JTM0.9版 (转载)

    这是一个集成了jre,tomcat,mysql的绿色运行环境, 直接解压之后就可以运行.不需要用户自己安装jre,tomcat,mysql,一键到位,看起来像是桌面式的web应用.换句话说,就像是we ...

  8. Oracle数据类型之nchar

    nchar(size)  nvarchar2(size) n 代表的意思是编码格式为unicode编码,无论中文或者英文都以一个字符来存放数据. 举例: 比如“a” ,占用一个字符 比如“月”,占用一 ...

  9. VM+CentOS+hadoop2.7搭建hadoop完全分布式集群

    写在前边的话: 最近找了一个云计算开发的工作,本以为来了会直接做一些敲代码,处理数据的活,没想到师父给了我一个课题“基于质量数据的大数据分析”,那么问题来了首先要做的就是搭建这样一个平台,毫无疑问,底 ...

  10. HDU_2586_How far away ?

    How far away ? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)To ...