用python结合jieba和wordcloud实现词云效果
Python  /  管理员 发布于 7年前   168
0x00 前言
突然想做一个漏洞词云,看看哪些漏洞比较高频,如果某些厂商有漏洞公开(比如ly),也好针对性挖掘。就选x云吧(镜像站 http://wy.hxsec.com/bugs.php )。用jieba和wordcloud两个强大的第三方库,就可以轻松打造出x云漏洞词云。
github地址: https://github.com/theLSA/wooyun_wordcloud
本站下载地址:wooyun_wordcloud
0x01 爬取标题
直接上代码:
#coding:utf-8#Author:LSA#Description:wordcloud for wooyun#Date:20170904import urllibimport urllib2import reimport threadingimport Queueq0 = Queue.Queue()threads = 20threadList = []def gettitle(): while not q0.empty(): i = q0.get() url = 'http://wy.hxsec.com/bugs.php?page=' + str(i) html = urllib.urlopen(url).read() reg = re.compile(r'<li style="width:60%;height:25px;background-color:#FFFFFF;float:left" ><a href="https:/article/.*?" rel="external nofollow" >(.*?)</a>') titleList = re.findall(reg,html) fwy = open("wooyunBugTitle.txt","a") for title in titleList: fwy.write(title+'\n') fwy.flush() fwy.close() print 'Page ' + str(i) + ' over!'def main(): for page in range(1,2962): q0.put(page) for thread in range(threads): t = threading.Thread(target=gettitle) t.start() threadList.append(t) for th in threadList: th.join() print '***********************All pages over!**********************'if __name__ == '__main__': main()
0x02 打造词云
还是直接上代码:
# coding: utf-8import jiebafrom wordcloud import WordCloudimport matplotlib.pyplot as pltdata = open("wooyunBugTitle.txt","r").read()cutData = jieba.cut(data, cut_all=True)word = " ".join(cutData)cloud = WordCloud( #设置字体,不指定可能会出现中文乱码 font_path="msyh.ttf", #font_path=path.join(e,'xxx.ttc'), #设置背景色 background_color='white', #词云形状 #mask=color_mask, #允许最大词汇 max_words=2000, #最大号字体 max_font_size=40 )wc = cloud.generate(word)wc.to_file("wooyunwordcloud.jpg") plt.imshow(wc)plt.axis("off")plt.show()
0x03 效果演示:
0x04 结语
由词云图可以看出,SQL注入依旧风光无限,其次是命令执行,继而是信息泄漏,整体看还是比较直观的。
122 在
学历:一种延缓就业设计,生活需求下的权衡之选中评论 工作几年后,报名考研了,到现在还没认真学习备考,迷茫中。作为一名北漂互联网打工人..123 在
Clash for Windows作者删库跑路了,github已404中评论 按理说只要你在国内,所有的流量进出都在监控范围内,不管你怎么隐藏也没用,想搞你分..原梓番博客 在
在Laravel框架中使用模型Model分表最简单的方法中评论 好久好久都没看友情链接申请了,今天刚看,已经添加。..博主 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 @1111老铁这个不行了,可以看看近期评论的其他文章..1111 在
佛跳墙vpn软件不会用?上不了网?佛跳墙vpn常见问题以及解决办法中评论 网站不能打开,博主百忙中能否发个APP下载链接,佛跳墙或极光..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号