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. Python3 requests 库

    requests 安装 使用 requests 发送 GET 请求 使用 requests 发送 POST 请求 使用 requests 维持会话 使用 requests 访问 HTTPS 使用 re ...

  2. centos solr4.5 tomcat 简单安装[已测试ok]

    一.环境准备: 1.jdk安装 2.tomcat安装 这两个基本环境的安装在这里就不说了 二.下载solr-4.5.0.tgz 三.安装solr 1.解压solr tar -zxvf /opt/sol ...

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

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

  4. Mybatis头文件

    <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-/ ...

  5. LeetCode——Contains Duplicate II

    Description: Given an array of integers and an integer k, find out whether there there are two disti ...

  6. 微信小游戏 小程序与小游戏获取用户信息接口调整 wx.createUserInfoButton

    参考: 小程序•小故事(6)——微信登录能力优化 小程序•小故事(4)——获取用户信息 本篇主要是讲微信getUserInfo接口不再出现授权弹框 那么原来getUserInfo是怎么样?修改之后又是 ...

  7. 强连通分量+缩点(poj2553)

    http://poj.org/problem?id=2553 The Bottom of a Graph Time Limit: 3000MS   Memory Limit: 65536K Total ...

  8. SVN常见问题及解决方法(转载)

    svn常见符号 黄色感叹号(有冲突):--这是有冲突了,冲突就是说你对某个文件进行了修改,别人也对这个文件进行了修改,别人抢在你提交之前先提交了,这时你再提交就会被提示发生冲突,而不允许你提交,防止你 ...

  9. State of the official Elasticsearch Java clients

    Elasticsearch Java Clients | Elastic https://www.elastic.co/blog/state-of-the-official-elasticsearch ...

  10. Rain on your Parade---hdu2389(HK求最大匹配)

    题目链接 题意:有n个客人,m把雨伞,在t秒之后将会下雨,给出每个客人的坐标和每秒行走的距离,以及雨伞的位置,问t秒后最多有几个客人可以拿到雨伞? 就是求最大匹配的  Hopcroft-Karp复杂度 ...