首页 > 编程语言 > 详细

简单的python爬虫 爬的乌云漏洞类型

时间:2014-08-05 22:27:31      阅读:521      评论:0      收藏:0      [点我收藏+]
import urllib.request
import re

starturl="http://wooyun.org/searchbug.php?q=%E9%87%91%E8%9E%8D"

def get_html_response(url):
    html_response = urllib.request.urlopen(url).read().decode(utf-8)
    return html_response

def geturl(starturl):
    a=get_html_response(starturl)
    childurl=(re.findall(r/bugs/wooyun-\w*-\w*\b,a))
    return childurl

def get_nextpage(starturl):
    d=get_html_response(starturl)
    nextpage=(re.findall(rsearchbug.php\?q=金融&pNO=\w,d))
    return nextpage

result=[]
result2=[]

for i in get_nextpage(starturl):
    result+=geturl(http://wooyun.org/+re.sub(金融,%E9%87%91%E8%9E%8D,i))
    #扫描各种漏洞的url地址放入result中
result=set(result)#去除result中重复的地址
#print(len(result))
#测试结果为87,正确

#信息存储+文件处理
output=open("D:\\a.txt",w+)

for i in result:
    k=get_html_response(http://wooyun.org/+re.sub(金融,%E9%87%91%E8%9E%8D,i))#下载页面到k,可以把
    info=re.findall(r<h3>\w*:\s*\w*\s*</h3>,k)#空白字符用/s,寻找所有适用于<h3>标签的文字
    for j in info:
        j=re.sub(r:\s,:,j)
        j=re.sub(r<h3>,‘‘,j)
        j=re.sub(r</h3>,,,j)
        j=j.split()
        output.writelines(j)
        output.writelines("\n")
output.close()

mentor要求的,简略分析乌云关于金融方面的漏洞并归类

人生第一个能跑的有意义的程序,好开心

简单的python爬虫 爬的乌云漏洞类型,布布扣,bubuko.com

简单的python爬虫 爬的乌云漏洞类型

原文:http://www.cnblogs.com/cmjason/p/3893215.html

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