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漫谈",
"link": "https://xz.aliyun.com/t/16523",
@ -938,65 +998,5 @@
"@type": "html",
"#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>
![飞书展示](./imgs/start.jpg) <br>
![后端展示](./imgs/run.jpg) <br>
### 下一步计划
- 添加更多RSS订阅源
- 将所有打印信息转为logging info并存档
- 存档所有推送文章方便以后查看

Binary file not shown.

View File

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

View File

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

View File

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