国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

用python結合jieba和wordcloud實現詞云效果

2020-01-04 16:40:26
字體:
來源:轉載
供稿:網友

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=".*?" 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 效果演示:

jieba,wordcloud,python,python3

jieba,wordcloud,python,python3

jieba,wordcloud,python,python3

0x04 結語

由詞云圖可以看出,SQL注入依舊風光無限,其次是命令執行,繼而是信息泄漏,整體看還是比較直觀的。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 普陀区| 神木县| 望城县| 台州市| 沂南县| 阿克陶县| 江门市| 岐山县| 上虞市| 河北省| 兴国县| 铁岭县| 铜梁县| 乐清市| 舟曲县| 宾川县| 新郑市| 漳平市| 太湖县| 唐海县| 泉州市| 关岭| 昌吉市| 铁岭县| 屯昌县| 稻城县| 奉新县| 巴楚县| 渭南市| 龙江县| 三门峡市| 惠水县| 含山县| 道孚县| 荣昌县| 灵宝市| 利川市| 乐亭县| 泽普县| 合川市| 濮阳县|