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. 关于C中I/O缓冲区的解释

    用户程序调用C标准I/O库函数读写文件或设备,而这些库函数要通过系统调用把读写请求传给内核,最终由内核驱动磁盘或设备完成I/O操作.C标准库为每个打开的文件分配一个I/O缓冲区以加速读写操作,通过文件 ...

  2. 说说NAND FLASH以及相关ECC校验方法

    Flash名称的由来,Flash的擦除操作是以block块为单位的,与此相对应的是其他很多存储设备,是以bit位为最小读取/写入的单位,Flash是一次性地擦除整个块:在发送一个擦除命令后,一次性地将 ...

  3. springjdbc的批量操作

    这里主要是看的官方文档,如何翻译: NamedParameterJdbcTemplate The NamedParameterJdbcTemplate class adds support for p ...

  4. Kotlin——初级篇(一):最详细的环境搭建

    众所周知,Kotlin出来已经良久了.Kotlin有着众多优势,不管是用于Android开发中,还是Java开发,都能缩减很大的代码量,大大提高了工作效率.而小生本人也是才从忙碌的个工作中抽身出来,有 ...

  5. Android 简单案例:继承BaseAdapter实现Adapter

    import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import ...

  6. 图论之最短路径(1)——Floyd Warshall & Dijkstra算法

    开始图论学习的第二部分:最短路径. 由于知识储备还不充足,暂时不使用邻接表的方法来计算. 最短路径主要分为两部分:多源最短路径和单源最短路径问题 多源最短路径: 介绍最简单的Floyd Warshal ...

  7. 百度地图API功能

    984aca5bc78b070e59f34e230f11cf6d http://api.map.baidu.com/api?v=2.0&ak=您的密钥" <html> & ...

  8. 以吃货的角度去理解云计算中On-Premise、IaaS、PaaS和SaaS

    了解云计算的一定都听过四个“高大上”的概念:On-Premise(本地部署),IaaS(基础设施及服务).PaaS(平台即服务)和SaaS(软件即服务),这几个术语并不好理解.不过,如果你是个吃货,还 ...

  9. Shell--基础知识

    变量的定义: a=1 b=hello c="hello world !" d='hello "反启" !' e=`ls`  (注意:这是反引号) 备注:=号左右 ...

  10. JavaCSV之写CSV文件

    与JavaCSV读CSV文件相对应,JavaCSV也可以用来写数据到CSV文件中. 1.准备工作 (1)第三方包库下载地址:https://sourceforge.net/projects/javac ...