This commit is contained in:
MasonLiu 2024-12-06 16:53:58 +08:00
parent 46ee520732
commit 4d9cd77157
9 changed files with 225 additions and 158 deletions

View File

@ -1,4 +1,64 @@
[ [
{
"title": "某省移动网络安全技能竞赛决赛 个人赛第一名wp",
"link": "https://xz.aliyun.com/t/16532",
"published": "2024-12-03T21:45:11+08:00",
"id": "https://xz.aliyun.com/t/16532",
"summary": {
"@type": "html",
"#text": "某省移动网络安全技能竞赛决赛 个人赛第一名wp"
}
},
{
"title": "Apache NiFi 高版本命令执行利用",
"link": "https://xz.aliyun.com/t/16531",
"published": "2024-12-03T20:44:14+08:00",
"id": "https://xz.aliyun.com/t/16531",
"summary": {
"@type": "html",
"#text": "Apache NiFi 高版本命令执行利用"
}
},
{
"title": "WuCup 第一届“吾杯”网络安全技能大赛 WriteUp",
"link": "https://xz.aliyun.com/t/16529",
"published": "2024-12-03T17:34:27+08:00",
"id": "https://xz.aliyun.com/t/16529",
"summary": {
"@type": "html",
"#text": "WuCup 第一届“吾杯”网络安全技能大赛 WriteUp"
}
},
{
"title": "记一次Go SSTI打SSRF到任意文件读",
"link": "https://xz.aliyun.com/t/16527",
"published": "2024-12-03T16:52:38+08:00",
"id": "https://xz.aliyun.com/t/16527",
"summary": {
"@type": "html",
"#text": "记一次Go SSTI打SSRF到任意文件读"
}
},
{
"title": "极客大挑战 web week3&week4",
"link": "https://xz.aliyun.com/t/16526",
"published": "2024-12-03T16:48:02+08:00",
"id": "https://xz.aliyun.com/t/16526",
"summary": {
"@type": "html",
"#text": "极客大挑战 web week3&week4"
}
},
{
"title": "jeepay v2.4.0反射型xss+存储型xss分析",
"link": "https://xz.aliyun.com/t/16524",
"published": "2024-12-03T15:40:58+08:00",
"id": "https://xz.aliyun.com/t/16524",
"summary": {
"@type": "html",
"#text": "jeepay v2.4.0反射型xss+存储型xss分析"
}
},
{ {
"title": "JDBC Attack漫谈", "title": "JDBC Attack漫谈",
"link": "https://xz.aliyun.com/t/16523", "link": "https://xz.aliyun.com/t/16523",
@ -938,65 +998,5 @@
"@type": "html", "@type": "html",
"#text": "2024网鼎杯半决赛(青龙组Crypto唯一解)——RSA加密分析" "#text": "2024网鼎杯半决赛(青龙组Crypto唯一解)——RSA加密分析"
} }
},
{
"title": "利用某组件dll劫持实现自启动",
"link": "https://xz.aliyun.com/t/16359",
"published": "2024-11-23T20:40:00+08:00",
"id": "https://xz.aliyun.com/t/16359",
"summary": {
"@type": "html",
"#text": "利用某组件dll劫持实现自启动"
}
},
{
"title": "FakeTOA的复现|利用搜索引擎复现一个新的漏洞",
"link": "https://xz.aliyun.com/t/16357",
"published": "2024-11-23T17:18:12+08:00",
"id": "https://xz.aliyun.com/t/16357",
"summary": {
"@type": "html",
"#text": "FakeTOA的复现|利用搜索引擎复现一个新的漏洞"
}
},
{
"title": "强网拟态2024决赛-Crypto-notive",
"link": "https://xz.aliyun.com/t/16356",
"published": "2024-11-23T16:23:43+08:00",
"id": "https://xz.aliyun.com/t/16356",
"summary": {
"@type": "html",
"#text": "强网拟态2024决赛-Crypto-notive"
}
},
{
"title": "PE文件解析",
"link": "https://xz.aliyun.com/t/16355",
"published": "2024-11-23T14:08:51+08:00",
"id": "https://xz.aliyun.com/t/16355",
"summary": {
"@type": "html",
"#text": "PE文件解析"
}
},
{
"title": "细说 wordpress插件 Profile-Builder - CVE-2024-6695分析",
"link": "https://xz.aliyun.com/t/16354",
"published": "2024-11-23T01:10:19+08:00",
"id": "https://xz.aliyun.com/t/16354",
"summary": {
"@type": "html",
"#text": "细说 wordpress插件 Profile-Builder - CVE-2024-6695分析"
}
},
{
"title": "免杀基础-进程遍历的方式",
"link": "https://xz.aliyun.com/t/16353",
"published": "2024-11-22T23:05:04+08:00",
"id": "https://xz.aliyun.com/t/16353",
"summary": {
"@type": "html",
"#text": "免杀基础-进程遍历的方式"
}
} }
] ]

View File

@ -30,3 +30,8 @@ centos: `yum install screen` <br>
### 运行结果 <br> ### 运行结果 <br>
![飞书展示](./imgs/start.jpg) <br> ![飞书展示](./imgs/start.jpg) <br>
![后端展示](./imgs/run.jpg) <br> ![后端展示](./imgs/run.jpg) <br>
### 下一步计划
- 添加更多RSS订阅源
- 将所有打印信息转为logging info并存档
- 存档所有推送文章方便以后查看

Binary file not shown.

View File

@ -3,6 +3,7 @@ import os
import requests import requests
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
import json import json
from requests.exceptions import RequestException
# 测试用爬虫请求头 # 测试用爬虫请求头
headers = { headers = {
@ -19,9 +20,13 @@ headers = {
} }
def fetch_rss(url, headers): def fetch_rss(url, headers):
response = requests.get(url, headers=headers) try:
response.raise_for_status() # 检查请求是否成功 response = requests.get(url, headers=headers)
return response.content response.raise_for_status() # 检查请求是否成功
return response.content
except RequestException as e:
print(f"请求失败: {e}") # 可选:打印错误信息
return None # 返回None表示请求失败
def parse_rss(rss_content): def parse_rss(rss_content):
items = [] items = []
@ -41,92 +46,119 @@ def save_to_json(data, filename):
def seebug_main(): def seebug_main():
url = "https://paper.seebug.org/rss/" url = "https://paper.seebug.org/rss/"
rss_content = fetch_rss(url, headers) rss_content = fetch_rss(url, headers)
items = parse_rss(rss_content) if rss_content is not None:
items = parse_rss(rss_content)
# 确保目录存在 # 确保目录存在
os.makedirs(os.path.dirname('./JSON/seebug.json'), exist_ok=True) os.makedirs(os.path.dirname('./JSON/seebug.json'), exist_ok=True)
# 将解析后的数据保存到 JSON 文件 # 将解析后的数据保存到 JSON 文件
save_to_json(items, './JSON/seebug.json') save_to_json(items, './JSON/seebug.json')
print("数据已保存到./JSON/seebug.json") print("数据已保存到 ./JSON/seebug.json")
else:
print("无法获取Seebug社区RSS内容跳过保存操作。")
# 4hou 爬虫 # 4hou 爬虫
def M_4hou_main(): def M_4hou_main():
url = "https://www.4hou.com/feed" url = "https://www.4hou.com/feed"
rss_content = fetch_rss(url, headers) rss_content = fetch_rss(url, headers)
items = parse_rss(rss_content)
# 确保目录存在 if rss_content is not None:
os.makedirs(os.path.dirname('./JSON/4hou.json'), exist_ok=True) items = parse_rss(rss_content)
# 将解析后的数据保存到 JSON 文件 # 确保目录存在
save_to_json(items, './JSON/4hou.json') os.makedirs(os.path.dirname('./JSON/4hou.json'), exist_ok=True)
print("数据已保存到./JSON/4hou.json")
# 将解析后的数据保存到 JSON 文件
save_to_json(items, './JSON/4hou.json')
print("数据已保存到 ./JSON/4hou.json")
else:
print("无法获取嘶吼RSS内容跳过保存操作。")
# 安全客 爬虫 # 安全客 爬虫
def anquanke_main(): def anquanke_main():
url = "https://api.anquanke.com/data/v1/rss" url = "https://api.anquanke.com/data/v1/rss"
rss_content = fetch_rss(url, headers) rss_content = fetch_rss(url, headers)
items = parse_rss(rss_content)
# 确保目录存在 if rss_content is not None:
os.makedirs(os.path.dirname('./JSON/anquanke.json'), exist_ok=True) items = parse_rss(rss_content)
# 将解析后的数据保存到 JSON 文件 # 确保目录存在
save_to_json(items, './JSON/anquanke.json') os.makedirs(os.path.dirname('./JSON/anquanke.json'), exist_ok=True)
print("数据已保存到./JSON/anquanke.json")
# 将解析后的数据保存到 JSON 文件
save_to_json(items, './JSON/anquanke.json')
print("数据已保存到 ./JSON/anquanke.json")
else:
print("无法获取安全客RSS内容跳过保存操作。")
# sec_wiki 爬虫 # sec_wiki 爬虫
def sec_wiki_main(): def sec_wiki_main():
url = "https://www.sec_wiki.com/news/rss" url = "https://www.sec_wiki.com/news/rss"
rss_content = fetch_rss(url, headers) rss_content = fetch_rss(url, headers)
items = parse_rss(rss_content)
# 确保目录存在 if rss_content is not None:
os.makedirs(os.path.dirname('./JSON/sec_wiki.json'), exist_ok=True) items = parse_rss(rss_content)
# 将解析后的数据保存到 JSON 文件 # 确保目录存在
save_to_json(items, './JSON/sec_wiki.json') os.makedirs(os.path.dirname('./JSON/sec_wiki.json'), exist_ok=True)
print("数据已保存到./JSON/sec_wiki.json")
# 将解析后的数据保存到 JSON 文件
save_to_json(items, './JSON/sec_wiki.json')
print("数据已保存到 ./JSON/sec_wiki.json")
else:
print("无法获取安全维基RSS内容跳过保存操作。")
# 华为 爬虫 # 华为 爬虫
def huawei_main(): def huawei_main():
url = "https://www.huawei.com/cn/rss-feeds/psirt/rss" url = "https://www.huawei.com/cn/rss-feeds/psirt/rss"
rss_content = fetch_rss(url, headers) rss_content = fetch_rss(url, headers)
items = parse_rss(rss_content)
# 确保目录存在 if rss_content is not None:
os.makedirs(os.path.dirname('./JSON/huawei.json'), exist_ok=True) items = parse_rss(rss_content)
# 将解析后的数据保存到 JSON 文件 # 确保目录存在
save_to_json(items, './JSON/huawei.json') os.makedirs(os.path.dirname('./JSON/huawei.json'), exist_ok=True)
print("数据已保存到./JSON/huawei.json")
# 将解析后的数据保存到 JSON 文件
save_to_json(items, './JSON/huawei.json')
print("数据已保存到 ./JSON/huawei.json")
else:
print("无法获取华为RSS内容跳过保存操作。")
# 洞见微信聚合爬虫 # 洞见微信聚合爬虫
def doonsec_main(): def doonsec_main():
url = "https://wechat.doonsec.com/bayes_rss.xml" url = "https://wechat.doonsec.com/bayes_rss.xml"
rss_content = fetch_rss(url, headers) rss_content = fetch_rss(url, headers)
items = parse_rss(rss_content)
# 确保目录存在 if rss_content is not None:
os.makedirs(os.path.dirname('./JSON/doonsec.json'), exist_ok=True) items = parse_rss(rss_content)
# 将解析后的数据保存到 JSON 文件 # 确保目录存在
save_to_json(items, './JSON/doonsec.json') os.makedirs(os.path.dirname('./JSON/doonsec.json'), exist_ok=True)
print("数据已保存到./JSON/doonsec.json")
# 奇安信 爬虫 # 将解析后的数据保存到 JSON 文件
save_to_json(items, './JSON/doonsec.json')
print("数据已保存到 ./JSON/doonsec.json")
else:
print("无法获取洞见微信聚合RSS内容跳过保存操作。")
# 奇安信攻防社区 爬虫
def qianxin_main(): def qianxin_main():
url = "https://forum.butian.net/Rss" url = "https://forum.butian.net/Rss"
rss_content = fetch_rss(url, headers) rss_content = fetch_rss(url, headers)
items = parse_rss(rss_content)
# 确保目录存在 if rss_content is not None:
os.makedirs(os.path.dirname('./JSON/qianxin.json'), exist_ok=True) items = parse_rss(rss_content)
# 将解析后的数据保存到 JSON 文件 # 确保目录存在
save_to_json(items, './JSON/qianxin.json') os.makedirs(os.path.dirname('./JSON/qianxin.json'), exist_ok=True)
print("数据已保存到./JSON/qianxin.json")
# 将解析后的数据保存到 JSON 文件
save_to_json(items, './JSON/qianxin.json')
print("数据已保存到 ./JSON/qianxin.json")
else:
print("无法获取奇安信攻防社区RSS内容跳过保存操作。")
def run(): def run():
seebug_main() seebug_main()

View File

@ -3,6 +3,7 @@ import os
import requests import requests
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
import json import json
from requests.exceptions import RequestException
# 测试用爬虫请求头 # 测试用爬虫请求头
headers = { headers = {
@ -19,9 +20,13 @@ headers = {
} }
def fetch_rss(url, headers): def fetch_rss(url, headers):
response = requests.get(url, headers=headers) try:
response.raise_for_status() # 检查请求是否成功 response = requests.get(url, headers=headers)
return response.content response.raise_for_status() # 检查请求是否成功
return response.content
except RequestException as e:
print(f"请求失败: {e}") # 可选:打印错误信息
return None # 返回None表示请求失败
def parse_rss(rss_content): def parse_rss(rss_content):
items = [] items = []
@ -44,14 +49,17 @@ def save_to_json(data, filename):
def freebuf_main(): def freebuf_main():
url = "https://www.freebuf.com/feed" url = "https://www.freebuf.com/feed"
rss_content = fetch_rss(url, headers) rss_content = fetch_rss(url, headers)
items = parse_rss(rss_content) if rss_content is not None:
items = parse_rss(rss_content)
# 确保目录存在 # 确保目录存在
os.makedirs(os.path.dirname('./JSON/freebuf.json'), exist_ok=True) os.makedirs(os.path.dirname('./JSON/freebuf.json'), exist_ok=True)
# 将解析后的数据保存到 JSON 文件 # 将解析后的数据保存到 JSON 文件
save_to_json(items, './JSON/freebuf.json') save_to_json(items, './JSON/freebuf.json')
print("数据已保存到 ./JSON/freebuf.json") print("数据已保存到 ./JSON/freebuf.json")
else:
print("无法获取Freebuf社区RSS内容跳过保存操作。")
if __name__ == '__main__': if __name__ == '__main__':
freebuf_main() freebuf_main()

View File

@ -1,9 +1,12 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import os import os
import requests import requests
import xml.etree.ElementTree as ET
import xmltodict import xmltodict
import json import json
import logging
# 设置日志记录
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
# 测试用爬虫请求头 # 测试用爬虫请求头
headers = { headers = {
@ -16,40 +19,55 @@ headers = {
} }
def fetch_rss(url, headers): def fetch_rss(url, headers):
response = requests.get(url, headers=headers) try:
response.raise_for_status() # 检查请求是否成功 response = requests.get(url, headers=headers)
# print(response.content.decode('utf-8')) # 打印响应内容,确保获取的数据是正确的 XML 格式 response.raise_for_status() # 检查请求是否成功
return response.content return response.content
except requests.exceptions.RequestException as e:
logging.error(f"请求 {url} 时发生错误: {e}")
return None
# 先知社区 爬虫 # 先知社区 爬虫
def xianzhi_main(): def xianzhi_main():
url = "https://xz.aliyun.com/feed" url = "https://xz.aliyun.com/feed"
rss_content = fetch_rss(url, headers) rss_content = fetch_rss(url, headers)
# 将 XML 数据转换为 Python 字典
data = xmltodict.parse(rss_content)
# 提取所有的 <entry> 元素 if rss_content is None:
entries = data['feed']['entry'] logging.warning("无法获取先知社区RSS内容跳过保存操作。")
return
# 创建一个空列表来存储每个 <entry> 的 JSON 数据 try:
entries_json = [] # 将 XML 数据转换为 Python 字典
data = xmltodict.parse(rss_content)
# 遍历每个 <entry> 元素,提取信息,并添加到列表中 # 提取所有的 <entry> 元素
for entry in entries: entries = data['feed'].get('entry', [])
entry_dict = {
'title': entry.get('title', ''),
'link': entry.get('link', {}).get('@href', ''), # 提取链接
'published': entry.get('published', ''),
'id': entry.get('id', ''),
'summary': entry.get('summary', '')
}
entries_json.append(entry_dict)
# 将 <entry> 元素的列表转换为 JSON 格式 # 创建一个空列表来存储每个 <entry> 的 JSON 数据
json_data = json.dumps(entries_json, ensure_ascii=False, indent=4) entries_json = []
# 保存 JSON 数据到文件 # 遍历每个 <entry> 元素,提取信息,并添加到列表中
with open('./JSON/xianzhi.json', 'w', encoding='utf-8') as json_file: for entry in entries:
json_file.write(json_data) entry_dict = {
'title': entry.get('title', ''),
'link': entry.get('link', {}).get('@href', ''), # 提取链接
'published': entry.get('published', ''),
'id': entry.get('id', ''),
'summary': entry.get('summary', '')
}
entries_json.append(entry_dict)
print("数据已保存到./JSON/xianzhi.json") # 将 <entry> 元素的列表转换为 JSON 格式
json_data = json.dumps(entries_json, ensure_ascii=False, indent=4)
# 保存 JSON 数据到文件
with open('./JSON/xianzhi.json', 'w', encoding='utf-8') as json_file:
json_file.write(json_data)
logging.info("数据已保存到 ./JSON/xianzhi.json")
except Exception as e:
logging.error(f"解析或保存先知社区RSS内容时发生错误: {e}")
# 示例调用
if __name__ == "__main__":
xianzhi_main()

16
test.py
View File

@ -6,9 +6,13 @@
from SendBot import SendToFeishu, gen_sign from SendBot import SendToFeishu, gen_sign
from GotoSend_seebug import Src_seebug from GotoSend_seebug import Src_seebug
reslt_seebug = Src_seebug(1000) # reslt_seebug = Src_seebug(1000)
webhook_url, timestamp, sign = gen_sign() # webhook_url, timestamp, sign = gen_sign()
print("-" * 40) # print("-" * 40)
print("Seebug社区资讯递送中") # print("Seebug社区资讯递送中")
SendToFeishu(reslt_seebug, "Seebug社区资讯递送", webhook_url, timestamp, sign) # SendToFeishu(reslt_seebug, "Seebug社区资讯递送", webhook_url, timestamp, sign)
print("-" * 40 + "\n") # print("-" * 40 + "\n")
from media.xianzhi import xianzhi_main
xianzhi_main()