更新修复了一个错误并优化了运行逻辑
This commit is contained in:
parent
f912c39598
commit
0620d56e9a
2
Core.py
2
Core.py
@ -11,7 +11,6 @@ import sys
|
|||||||
import time
|
import time
|
||||||
import yaml
|
import yaml
|
||||||
import requests
|
import requests
|
||||||
from web.app import run_server
|
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
from FeishuSendBot import SendToFeishu, gen_sign
|
from FeishuSendBot import SendToFeishu, gen_sign
|
||||||
from media.common import run, seebug_main, M_4hou_main, anquanke_main, sec_wiki_main, huawei_main, doonsec_main, qianxin_main
|
from media.common import run, seebug_main, M_4hou_main, anquanke_main, sec_wiki_main, huawei_main, doonsec_main, qianxin_main
|
||||||
@ -232,7 +231,6 @@ def test_rss_source():
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
print("程序正在运行当中。")
|
print("程序正在运行当中。")
|
||||||
# run_server()
|
|
||||||
time.sleep(5) # 添加短暂的延迟
|
time.sleep(5) # 添加短暂的延迟
|
||||||
rss_info = test_rss_source()
|
rss_info = test_rss_source()
|
||||||
start_info = ""
|
start_info = ""
|
||||||
|
@ -47,7 +47,7 @@ def SendToFeishu(body, header, webhook_url, timestamp, sign):
|
|||||||
"elements":
|
"elements":
|
||||||
[{
|
[{
|
||||||
"tag": "markdown",
|
"tag": "markdown",
|
||||||
"content": f"{body}"
|
"content": f"{body}" + "\n\n[点此访问](https://info.masonliu.com)网站以查看全部文章。"
|
||||||
}],
|
}],
|
||||||
"header": {
|
"header": {
|
||||||
"title": {
|
"title": {
|
||||||
|
@ -94,9 +94,19 @@ def clear_table():
|
|||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
def record_md(result, filename="./history/sec_news.md"):
|
def record_md(result, filename="./history/sec_news.md"):
|
||||||
with open(filename, 'a', encoding='utf-8') as file:
|
# 读取现有内容
|
||||||
file.write(result)
|
if os.path.exists(filename):
|
||||||
|
with open(filename, 'r', encoding='utf-8') as file:
|
||||||
|
existing_content = file.read()
|
||||||
|
else:
|
||||||
|
existing_content = ""
|
||||||
|
|
||||||
|
# 将新内容插入到现有内容的开头
|
||||||
|
new_content = result + existing_content
|
||||||
|
|
||||||
|
# 写回文件
|
||||||
|
with open(filename, 'w', encoding='utf-8') as file:
|
||||||
|
file.write(new_content)
|
||||||
def get_filtered_articles(entries):
|
def get_filtered_articles(entries):
|
||||||
result = ""
|
result = ""
|
||||||
record = ""
|
record = ""
|
||||||
|
@ -88,8 +88,19 @@ def clear_table():
|
|||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
def record_md(result, filename="./history/sec_news.md"):
|
def record_md(result, filename="./history/sec_news.md"):
|
||||||
with open(filename, 'a', encoding='utf-8') as file:
|
# 读取现有内容
|
||||||
file.write(result)
|
if os.path.exists(filename):
|
||||||
|
with open(filename, 'r', encoding='utf-8') as file:
|
||||||
|
existing_content = file.read()
|
||||||
|
else:
|
||||||
|
existing_content = ""
|
||||||
|
|
||||||
|
# 将新内容插入到现有内容的开头
|
||||||
|
new_content = result + existing_content
|
||||||
|
|
||||||
|
# 写回文件
|
||||||
|
with open(filename, 'w', encoding='utf-8') as file:
|
||||||
|
file.write(new_content)
|
||||||
|
|
||||||
def get_filtered_articles(entries):
|
def get_filtered_articles(entries):
|
||||||
result = ""
|
result = ""
|
||||||
|
@ -95,8 +95,19 @@ def clear_table():
|
|||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
def record_md(result, filename="./history/tech_passage.md"):
|
def record_md(result, filename="./history/tech_passage.md"):
|
||||||
with open(filename, 'a', encoding='utf-8') as file:
|
# 读取现有内容
|
||||||
file.write(result)
|
if os.path.exists(filename):
|
||||||
|
with open(filename, 'r', encoding='utf-8') as file:
|
||||||
|
existing_content = file.read()
|
||||||
|
else:
|
||||||
|
existing_content = ""
|
||||||
|
|
||||||
|
# 将新内容插入到现有内容的开头
|
||||||
|
new_content = result + existing_content
|
||||||
|
|
||||||
|
# 写回文件
|
||||||
|
with open(filename, 'w', encoding='utf-8') as file:
|
||||||
|
file.write(new_content)
|
||||||
|
|
||||||
def get_filtered_articles(entries):
|
def get_filtered_articles(entries):
|
||||||
result = ""
|
result = ""
|
||||||
|
@ -94,8 +94,19 @@ def clear_table():
|
|||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
def record_md(result, filename="./history/sec_news.md"):
|
def record_md(result, filename="./history/sec_news.md"):
|
||||||
with open(filename, 'a', encoding='utf-8') as file:
|
# 读取现有内容
|
||||||
file.write(result)
|
if os.path.exists(filename):
|
||||||
|
with open(filename, 'r', encoding='utf-8') as file:
|
||||||
|
existing_content = file.read()
|
||||||
|
else:
|
||||||
|
existing_content = ""
|
||||||
|
|
||||||
|
# 将新内容插入到现有内容的开头
|
||||||
|
new_content = result + existing_content
|
||||||
|
|
||||||
|
# 写回文件
|
||||||
|
with open(filename, 'w', encoding='utf-8') as file:
|
||||||
|
file.write(new_content)
|
||||||
|
|
||||||
def get_filtered_articles(entries):
|
def get_filtered_articles(entries):
|
||||||
result = ""
|
result = ""
|
||||||
|
@ -85,8 +85,19 @@ def clear_table():
|
|||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
def record_md(result, filename="./history/tech_passage.md"):
|
def record_md(result, filename="./history/tech_passage.md"):
|
||||||
with open(filename, 'a', encoding='utf-8') as file:
|
# 读取现有内容
|
||||||
file.write(result)
|
if os.path.exists(filename):
|
||||||
|
with open(filename, 'r', encoding='utf-8') as file:
|
||||||
|
existing_content = file.read()
|
||||||
|
else:
|
||||||
|
existing_content = ""
|
||||||
|
|
||||||
|
# 将新内容插入到现有内容的开头
|
||||||
|
new_content = result + existing_content
|
||||||
|
|
||||||
|
# 写回文件
|
||||||
|
with open(filename, 'w', encoding='utf-8') as file:
|
||||||
|
file.write(new_content)
|
||||||
|
|
||||||
def get_filtered_articles(entries):
|
def get_filtered_articles(entries):
|
||||||
result = ""
|
result = ""
|
||||||
|
@ -92,8 +92,19 @@ def clear_table():
|
|||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
def record_md(result, filename="./history/sec_news.md"):
|
def record_md(result, filename="./history/sec_news.md"):
|
||||||
with open(filename, 'a', encoding='utf-8') as file:
|
# 读取现有内容
|
||||||
file.write(result)
|
if os.path.exists(filename):
|
||||||
|
with open(filename, 'r', encoding='utf-8') as file:
|
||||||
|
existing_content = file.read()
|
||||||
|
else:
|
||||||
|
existing_content = ""
|
||||||
|
|
||||||
|
# 将新内容插入到现有内容的开头
|
||||||
|
new_content = result + existing_content
|
||||||
|
|
||||||
|
# 写回文件
|
||||||
|
with open(filename, 'w', encoding='utf-8') as file:
|
||||||
|
file.write(new_content)
|
||||||
|
|
||||||
def get_filtered_articles(entries):
|
def get_filtered_articles(entries):
|
||||||
result = ""
|
result = ""
|
||||||
|
@ -91,8 +91,19 @@ def clear_table():
|
|||||||
conn.close()
|
conn.close()
|
||||||
|
|
||||||
def record_md(result, filename="./history/tech_passage.md"):
|
def record_md(result, filename="./history/tech_passage.md"):
|
||||||
with open(filename, 'a', encoding='utf-8') as file:
|
# 读取现有内容
|
||||||
file.write(result)
|
if os.path.exists(filename):
|
||||||
|
with open(filename, 'r', encoding='utf-8') as file:
|
||||||
|
existing_content = file.read()
|
||||||
|
else:
|
||||||
|
existing_content = ""
|
||||||
|
|
||||||
|
# 将新内容插入到现有内容的开头
|
||||||
|
new_content = result + existing_content
|
||||||
|
|
||||||
|
# 写回文件
|
||||||
|
with open(filename, 'w', encoding='utf-8') as file:
|
||||||
|
file.write(new_content)
|
||||||
|
|
||||||
def get_filtered_articles(entries):
|
def get_filtered_articles(entries):
|
||||||
result = ""
|
result = ""
|
||||||
|
@ -3,11 +3,15 @@ RSS订阅链接来源:https://github.com/zhengjim/Chinese-Security-RSS <br>
|
|||||||
使用python-json进行格式化,然后使用飞书webhook机器人进行发送 <br>
|
使用python-json进行格式化,然后使用飞书webhook机器人进行发送 <br>
|
||||||
config.yaml可指定大部分可能需要的参数 <br>
|
config.yaml可指定大部分可能需要的参数 <br>
|
||||||
|
|
||||||
|
### 问题反馈 <br>
|
||||||
|
- 准点发送的文章在定点推送模式下可能会被遗漏推送 <br>
|
||||||
|
|
||||||
### 下一步计划 <br>
|
### 下一步计划 <br>
|
||||||
- 添加更多RSS订阅源 <br>
|
- 添加更多RSS订阅源 <br>
|
||||||
- 将所有打印信息转为logging info并存档(已完成)<br>
|
- 将所有打印信息转为logging info并存档(已完成)<br>
|
||||||
- 将logging info转为异步的loguru(已完成) <br>
|
- 将logging info转为异步的loguru(已完成) <br>
|
||||||
- 探查异常中断原因(暂未清楚发生原因,猜测和4hou获取rss后的代码逻辑有关) <br>
|
- 探查异常中断原因(已发现,获取rss源时的请求未做超时) <br>
|
||||||
|
- 添加超时机制,防止程序异常卡死(已完成) <br>
|
||||||
- 存档所有推送文章方便以后查看(已完成) <br>
|
- 存档所有推送文章方便以后查看(已完成) <br>
|
||||||
- 添加更多推送方式,如邮件、微信等 <br>
|
- 添加更多推送方式,如邮件、微信等 <br>
|
||||||
- 创建Web网页以展示最新推送 <br>
|
- 创建Web网页以展示最新推送 <br>
|
||||||
@ -27,6 +31,8 @@ centos: `yum install screen` <br>
|
|||||||
### 使用方法: <br>
|
### 使用方法: <br>
|
||||||
先下载支持库:`pip install -r requirements.txt` <br>
|
先下载支持库:`pip install -r requirements.txt` <br>
|
||||||
随后便可直接运行:`python Core.py` <br>
|
随后便可直接运行:`python Core.py` <br>
|
||||||
|
web运行:`python ./web/app.py` <br>
|
||||||
|
随后web网页将会在本地5000端口启动,访问即可,使用反向代理即可以域名映射到外网 <br>
|
||||||
|
|
||||||
### 配置 <br>
|
### 配置 <br>
|
||||||
首先先在飞书中创建群组,然后再创建WebHook机器人 <br>
|
首先先在飞书中创建群组,然后再创建WebHook机器人 <br>
|
||||||
|
BIN
__pycache__/FeishuSendBot.cpython-312.pyc
Normal file
BIN
__pycache__/FeishuSendBot.cpython-312.pyc
Normal file
Binary file not shown.
@ -8,4 +8,4 @@ sender: test@masonliu.com
|
|||||||
receivers: ['2857911564@qq.com']
|
receivers: ['2857911564@qq.com']
|
||||||
# 结算时间范围
|
# 结算时间范围
|
||||||
e_hour: 4 # 程序运行时间间隔
|
e_hour: 4 # 程序运行时间间隔
|
||||||
circle: 1 # 是否启用循环,设置为0后将设置为特定时间点运行
|
circle: 0 # 是否启用循环,设置为0后将设置为特定时间点运行
|
||||||
|
@ -1,129 +0,0 @@
|
|||||||
#### 文章:Google Play 上的 SpyLoan Android 恶意软件安装次数达 800 万次
|
|
||||||
**作者**:胡金鱼
|
|
||||||
**链接**:https://www.4hou.com/posts/rpBB
|
|
||||||
**上传时间**:2024-12-10 12:00:00
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:直播预告:SMC2赋能邮件系统管理-日志审计年度洞察及账号防护
|
|
||||||
**作者**:Coremail邮件安全
|
|
||||||
**链接**:https://www.4hou.com/posts/BvOW
|
|
||||||
**上传时间**:2024-12-10 11:47:33
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:中国计算机教育大会:以实战型人才为核心,360打造产教融合新业态
|
|
||||||
**作者**:企业资讯
|
|
||||||
**链接**:https://www.4hou.com/posts/J1zv
|
|
||||||
**上传时间**:2024-12-10 11:04:49
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:再攀新高!盛邦安全连续五年上榜CCIA50强
|
|
||||||
**作者**:盛邦安全
|
|
||||||
**链接**:https://www.4hou.com/posts/nlz4
|
|
||||||
**上传时间**:2024-12-10 10:54:01
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:国家计算机病毒应急处理中心监测发现12款违规移动应用
|
|
||||||
**作者**:企业资讯
|
|
||||||
**链接**:https://www.4hou.com/posts/GAz3
|
|
||||||
**上传时间**:2024-12-10 10:53:44
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:盛邦安全GITEX GLOBAL 2024首秀,构筑网络安全纵深防御体系
|
|
||||||
**作者**:盛邦安全
|
|
||||||
**链接**:https://www.4hou.com/posts/MXEB
|
|
||||||
**上传时间**:2024-12-10 10:52:55
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:盛邦安全世界互联网大会获多方肯定,新兴技术探索受媒体关注
|
|
||||||
**作者**:盛邦安全
|
|
||||||
**链接**:https://www.4hou.com/posts/Ey14
|
|
||||||
**上传时间**:2024-12-10 10:51:41
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:供应链攻击恐慌后,OpenWrt 下令更新路由器固件
|
|
||||||
**作者**: 安全客
|
|
||||||
**来源**:theregister
|
|
||||||
**链接**:https://www.anquanke.com/post/id/302577
|
|
||||||
**上传时间**:2024-12-10 11:30:29
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:Socks5Systemz 僵尸网络利用 85,000 多台被黑设备为非法代理服务提供动力
|
|
||||||
**作者**: 安全客
|
|
||||||
**来源**:TheHackersNews
|
|
||||||
**链接**:https://www.anquanke.com/post/id/302574
|
|
||||||
**上传时间**:2024-12-10 11:20:28
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:医疗设备公司表示,勒索软件攻击中断了运输流程
|
|
||||||
**作者**: 安全客
|
|
||||||
**来源**:therecord
|
|
||||||
**链接**:https://www.anquanke.com/post/id/302571
|
|
||||||
**上传时间**:2024-12-10 11:00:33
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:日本水处理公司和绿茶制造商的美国子公司遭勒索软件攻击
|
|
||||||
**作者**: 安全客
|
|
||||||
**来源**:therecord
|
|
||||||
**链接**:https://www.anquanke.com/post/id/302568
|
|
||||||
**上传时间**:2024-12-10 10:54:12
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:更新您的 OpenWrt 路由器!安全问题使供应链攻击成为可能
|
|
||||||
**作者**: 安全客
|
|
||||||
**来源**:helpnetsecurity
|
|
||||||
**链接**:https://www.anquanke.com/post/id/302565
|
|
||||||
**上传时间**:2024-12-10 10:40:09
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:冒充警察的网络钓鱼者在数百万欧元的骗局中被捕
|
|
||||||
**作者**: 安全客
|
|
||||||
**来源**:hackread
|
|
||||||
**链接**:https://www.anquanke.com/post/id/302562
|
|
||||||
**上传时间**:2024-12-10 10:29:15
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:严重的 Windows 零日警报:用户尚无补丁可用
|
|
||||||
**作者**: 安全客
|
|
||||||
**来源**:hackread
|
|
||||||
**链接**:https://www.anquanke.com/post/id/302559
|
|
||||||
**上传时间**:2024-12-10 10:22:39
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:浅谈目录权限导致的文件劫持
|
|
||||||
**作者**: 360安全应急响应中心
|
|
||||||
**来源**:None
|
|
||||||
**链接**:https://www.anquanke.com/post/id/302554
|
|
||||||
**上传时间**:2024-12-10 10:13:55
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:混淆还原的几种方式实践
|
|
||||||
**作者**: 360安全应急响应中心
|
|
||||||
**来源**:None
|
|
||||||
**链接**:https://www.anquanke.com/post/id/302515
|
|
||||||
**上传时间**:2024-12-10 10:13:31
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:防火墙服务配置漏洞波及多家全球财富100强公司
|
|
||||||
**类型**:资讯
|
|
||||||
**链接**:https://www.freebuf.com/news/417317.html
|
|
||||||
**上传时间**:2024-12-10 11:27:49
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:SaaS巨头被勒索攻击,泄露680GB数据
|
|
||||||
**类型**:资讯
|
|
||||||
**链接**:https://www.freebuf.com/news/417312.html
|
|
||||||
**上传时间**:2024-12-10 11:11:55
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章: 可接管账户权限,DeepSeek 和 Claude AI 存在命令注入漏洞
|
|
||||||
**类型**:资讯
|
|
||||||
**链接**:https://www.freebuf.com/news/417305.html
|
|
||||||
**上传时间**:2024-12-10 10:43:31
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:俄罗斯APT组织打击乌克兰国防企业
|
|
||||||
**类型**:资讯
|
|
||||||
**链接**:https://www.freebuf.com/news/417299.html
|
|
||||||
**上传时间**:2024-12-10 10:21:26
|
|
||||||
|
|
||||||
----------------------------------------
|
|
@ -1,43 +0,0 @@
|
|||||||
#### 文章:PHP反序列化ctf题解
|
|
||||||
**作者**:白安全组
|
|
||||||
**链接**:[点此访问](https://mp.weixin.qq.com/s?__biz=MzU4MjYxNTYwNA==&mid=2247487567&idx=1&sn=095dfb77e7448a1250c271d1a36729a5)
|
|
||||||
**上传时间**:2024-12-10 11:02:01
|
|
||||||
**简介**:None
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:网关按其功能可分为:协议网关、应用网关、安全网关
|
|
||||||
**作者**:全栈网络空间安全
|
|
||||||
**链接**:[点此访问](https://mp.weixin.qq.com/s?__biz=Mzg3NTUzOTg3NA==&mid=2247514779&idx=1&sn=a6392297004d12e4d96593d8be6a133c)
|
|
||||||
**上传时间**:2024-12-10 10:51:58
|
|
||||||
**简介**:None
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:[漏洞挖掘与防护] 05.CVE-2018-12613:phpMyAdmin 4.8.1后台文件包含缺陷复现及防御措施
|
|
||||||
**作者**:娜璋AI安全之家
|
|
||||||
**链接**:[点此访问](https://mp.weixin.qq.com/s?__biz=Mzg5MTM5ODU2Mg==&mid=2247501076&idx=1&sn=ea61326375112eb6b7486937c1ca2278)
|
|
||||||
**上传时间**:2024-12-10 10:51:47
|
|
||||||
**简介**:本文主要复现phpMyAdmin文件包含漏洞,希望您喜欢!
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:SuperMega:一款支持注入和加载的Shellcode工具
|
|
||||||
**作者**:网络安全与人工智能研究中心
|
|
||||||
**链接**:[点此访问](https://mp.weixin.qq.com/s?__biz=MzkwMTQyODI4Ng==&mid=2247495151&idx=3&sn=6bc524a313373744150fadf60892c035)
|
|
||||||
**上传时间**:2024-12-10 10:34:51
|
|
||||||
**简介**:该工具可以将其注入到可执行文件中执行进一步的安全测试。
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:【免杀】过360核晶、火绒 运行mimikatz、上线CS的万能加载器XlAnyLoader v1.1正式发布!
|
|
||||||
**作者**:威零安全实验室
|
|
||||||
**链接**:[点此访问](https://mp.weixin.qq.com/s?__biz=Mzg4Mzg4OTIyMA==&mid=2247485855&idx=1&sn=f0c58a95fb3ce9a64ea2efa3556af326)
|
|
||||||
**上传时间**:2024-12-10 10:31:19
|
|
||||||
**简介**:过360核晶、火绒 、微软、卡巴斯基(静态)\\x0d\\x0axlanyloader万能加载器
|
|
||||||
|
|
||||||
----------------------------------------
|
|
||||||
#### 文章:样本分析:Trinity 勒索软件
|
|
||||||
**来源**:subject
|
|
||||||
**链接**:https://forum.butian.net/share/3902
|
|
||||||
**上传时间**:2024-12-10 10:00:02
|
|
||||||
**描述**:前言
|
|
||||||
Trinity 勒索软件是一个相对较新的威胁行为者,以采用双重勒索策略而闻名。这种方法包括在加密文件之前窃取敏感数据,从而增加受害者支付赎金的压力。这种勒索软件使用 ChaCha20 加密算法...
|
|
||||||
|
|
||||||
----------------------------------------
|
|
@ -1,20 +0,0 @@
|
|||||||
2024-12-10 13:36:10 - INFO - __main__:<module>:244 - 飞书发送 程序信息 成功
|
|
||||||
2024-12-10 13:36:10 - INFO - __main__:<module>:248 - 飞书发送 RSS源状态 成功
|
|
||||||
2024-12-10 13:36:10 - INFO - __main__:main_loop:185 - 第1次执行准备开始。
|
|
||||||
2024-12-10 13:37:07 - INFO - __main__:signal_handler:159 - 接收到退出信号,程序即将退出...
|
|
||||||
2024-12-10 13:37:28 - INFO - __main__:<module>:244 - 飞书发送 程序信息 成功
|
|
||||||
2024-12-10 13:37:29 - INFO - __main__:<module>:248 - 飞书发送 RSS源状态 成功
|
|
||||||
2024-12-10 13:37:29 - INFO - __main__:main_loop:173 - 第1次执行,当前时间为:2024-12-10 13:37:29
|
|
||||||
2024-12-10 13:37:29 - INFO - __main__:send_job:51 - 正在启动各爬虫并获取资源中...
|
|
||||||
2024-12-10 13:37:30 - INFO - media.common:seebug_main:71 - 数据已保存到 ./JSON/seebug.json!
|
|
||||||
2024-12-10 13:37:30 - INFO - media.common:anquanke_main:107 - 数据已保存到 ./JSON/anquanke.json!
|
|
||||||
2024-12-10 13:37:30 - INFO - media.common:huawei_main:143 - 数据已保存到 ./JSON/huawei.json!
|
|
||||||
2024-12-10 13:37:31 - INFO - media.common:doonsec_main:161 - 数据已保存到 ./JSON/doonsec.json!
|
|
||||||
2024-12-10 13:37:32 - INFO - media.common:qianxin_main:179 - 数据已保存到 ./JSON/qianxin.json!
|
|
||||||
2024-12-10 13:37:32 - INFO - media.freebuf:freebuf_main:75 - 数据已保存到 ./JSON/freebuf.json!
|
|
||||||
2024-12-10 13:37:33 - INFO - media.xianzhi:xianzhi_main:73 - 数据已保存到 ./JSON/xianzhi.json!
|
|
||||||
2024-12-10 13:37:33 - INFO - media.common:M_4hou_main:89 - 数据已保存到 ./JSON/4hou.json!
|
|
||||||
2024-12-10 13:37:34 - INFO - __main__:send_job:76 - 嘶吼资讯递送中:
|
|
||||||
2024-12-10 13:37:34 - INFO - __main__:send_job:78 - 飞书发送 嘶吼资讯递送 成功
|
|
||||||
2024-12-10 13:37:42 - INFO - __main__:signal_handler:159 - 接收到退出信号,程序即将退出...
|
|
||||||
2024-12-10 14:59:22 - INFO - __main__:signal_handler:160 - 接收到退出信号,程序即将退出...
|
|
@ -29,11 +29,22 @@ headers = {
|
|||||||
"Accept-Language": "zh-CN,zh;q=0.9"
|
"Accept-Language": "zh-CN,zh;q=0.9"
|
||||||
}
|
}
|
||||||
|
|
||||||
def fetch_rss(url, headers):
|
# def fetch_rss(url, headers):
|
||||||
|
# try:
|
||||||
|
# response = requests.get(url, headers=headers)
|
||||||
|
# response.raise_for_status() # 检查请求是否成功
|
||||||
|
# return response.content
|
||||||
|
# except RequestException as e:
|
||||||
|
# logger.error(f"请求 {url} 时发生错误: {e}")
|
||||||
|
# return None # 返回None表示请求失败
|
||||||
|
def fetch_rss(url, headers, timeout=20):
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers)
|
response = requests.get(url, headers=headers, timeout=timeout)
|
||||||
response.raise_for_status() # 检查请求是否成功
|
response.raise_for_status() # 检查请求是否成功
|
||||||
return response.content
|
return response.content
|
||||||
|
except requests.Timeout:
|
||||||
|
logger.warning(f"请求 {url} 超时,跳过保存操作。")
|
||||||
|
return None
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
logger.error(f"请求 {url} 时发生错误: {e}")
|
logger.error(f"请求 {url} 时发生错误: {e}")
|
||||||
return None # 返回None表示请求失败
|
return None # 返回None表示请求失败
|
||||||
|
@ -29,11 +29,14 @@ headers = {
|
|||||||
"Accept-Language": "zh-CN,zh;q=0.9"
|
"Accept-Language": "zh-CN,zh;q=0.9"
|
||||||
}
|
}
|
||||||
|
|
||||||
def fetch_rss(url, headers):
|
def fetch_rss(url, headers, timeout=20):
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers)
|
response = requests.get(url, headers=headers, timeout=timeout)
|
||||||
response.raise_for_status() # 检查请求是否成功
|
response.raise_for_status() # 检查请求是否成功
|
||||||
return response.content
|
return response.content
|
||||||
|
except requests.Timeout:
|
||||||
|
logger.warning(f"请求 {url} 超时,跳过保存操作。")
|
||||||
|
return None
|
||||||
except RequestException as e:
|
except RequestException as e:
|
||||||
logger.error(f"请求 {url} 时发生错误: {e}")
|
logger.error(f"请求 {url} 时发生错误: {e}")
|
||||||
return None # 返回None表示请求失败
|
return None # 返回None表示请求失败
|
||||||
|
@ -24,14 +24,17 @@ headers = {
|
|||||||
"Accept-Language": "zh-CN,zh;q=0.9"
|
"Accept-Language": "zh-CN,zh;q=0.9"
|
||||||
}
|
}
|
||||||
|
|
||||||
def fetch_rss(url, headers):
|
def fetch_rss(url, headers, timeout=20):
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, headers=headers)
|
response = requests.get(url, headers=headers, timeout=timeout)
|
||||||
response.raise_for_status() # 检查请求是否成功
|
response.raise_for_status() # 检查请求是否成功
|
||||||
return response.content
|
return response.content
|
||||||
|
except requests.Timeout:
|
||||||
|
logger.warning(f"请求 {url} 超时,跳过保存操作。")
|
||||||
|
return None
|
||||||
except requests.exceptions.RequestException as e:
|
except requests.exceptions.RequestException as e:
|
||||||
logger.error(f"请求 {url} 时发生错误: {e}")
|
logger.error(f"请求 {url} 时发生错误: {e}")
|
||||||
return None
|
return None # 返回None表示请求失败
|
||||||
|
|
||||||
# 先知社区 爬虫
|
# 先知社区 爬虫
|
||||||
def xianzhi_main():
|
def xianzhi_main():
|
||||||
|
11
test.py
11
test.py
@ -1 +1,10 @@
|
|||||||
from web.app import run_server
|
from FeishuSendBot import SendToFeishu, gen_sign
|
||||||
|
|
||||||
|
webhook_url, timestamp, sign = gen_sign()
|
||||||
|
|
||||||
|
# 测试用消息体
|
||||||
|
test_msg = {
|
||||||
|
"请单件文档查看昨天讨论的方案相关飞书文档,注意作者为 <font color=red> **张三** <font> 版本为 \n*002* ,版本 ~~001~~ 已经删除。文件地址是 [https://www.feishu.cn](https://www.feishu.cn),打开次数:1次"
|
||||||
|
}
|
||||||
|
|
||||||
|
SendToFeishu(test_msg, "先知社区资讯递送", webhook_url, timestamp, sign)
|
@ -56,4 +56,4 @@ def run_server():
|
|||||||
app.run(host='0.0.0.0', port=5000)
|
app.run(host='0.0.0.0', port=5000)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(debug=True) # 在生产环境中应设置为 False
|
app.run(debug=False) # 在生产环境中应设置为 False
|
@ -3,46 +3,66 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<title>资讯推送Web端</title>
|
<title>资讯推送Web端</title>
|
||||||
<link rel="shortcut icon" href="./static/img/favicon.ico">
|
<link rel="shortcut icon" href="./favicon.ico">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<!-- 引入 Layui 的 CSS -->
|
<!-- 引入 Layui 的 CSS -->
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/layui-src/dist/css/layui.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/layui-src/dist/css/layui.css">
|
||||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||||
<style>
|
<style>
|
||||||
body {
|
body {
|
||||||
font-family: Arial, sans-serif;
|
font-family: Arial, sans-serif;
|
||||||
margin: 20px;
|
margin: 10px; /* 减少边距 */
|
||||||
}
|
}
|
||||||
h1 {
|
h1 {
|
||||||
color: #333;
|
color: #333;
|
||||||
|
font-size: 1.5em; /* 适当减小标题字体 */
|
||||||
}
|
}
|
||||||
#markdown-content {
|
#markdown-content {
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
|
font-size: 0.9em; /* 减小内容字体 */
|
||||||
}
|
}
|
||||||
/* 返回顶部按钮样式 */
|
/* 返回顶部按钮样式 */
|
||||||
#back-to-top {
|
#back-to-top {
|
||||||
display: none;
|
display: none;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 20px;
|
bottom: 10px; /* 调整位置 */
|
||||||
right: 30px;
|
right: 10px; /* 调整位置 */
|
||||||
z-index: 99;
|
z-index: 99;
|
||||||
font-size: 18px;
|
font-size: 16px; /* 减小字体 */
|
||||||
border: none;
|
border: none;
|
||||||
outline: none;
|
outline: none;
|
||||||
background-color: #555;
|
background-color: #555;
|
||||||
color: white;
|
color: white;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
padding: 15px;
|
padding: 10px; /* 减小内边距 */
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
}
|
}
|
||||||
#back-to-top:hover {
|
#back-to-top:hover {
|
||||||
background-color: #777;
|
background-color: #777;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 移动端样式调整 */
|
||||||
|
@media only screen and (max-width: 600px) {
|
||||||
|
body {
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
h1 {
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
#markdown-content {
|
||||||
|
font-size: 0.8em;
|
||||||
|
}
|
||||||
|
#back-to-top {
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="layui-container">
|
<div class="layui-container">
|
||||||
<h1 class="layui-title" id="page-title">历史推送读取</h1>
|
<center><h1 class="layui-title" id="page-title">历史推送读取</h1><br>
|
||||||
<button id="toggle-fetch-btn" class="layui-btn">切换读取源</button>
|
<button id="toggle-fetch-btn" class="layui-btn">切换读取源</button><br></center>
|
||||||
<div id="markdown-content" class="layui-card-body"></div>
|
<div id="markdown-content" class="layui-card-body"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user