#coding:utf-8
#Author:LSA
#Description:wordcloud for wooyun
#Date:20170904
import urllib
import urllib2
import re
import threading
import Queue
q0 = Queue.Queue()
threads = 20
threadList = []
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()
# coding: utf-8
import jieba
from wordcloud import WordCloud
import matplotlib.pyplot as plt
data = 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()
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有