update web sys

This commit is contained in:
MasonLiu 2024-12-10 16:24:41 +08:00
parent de298b6809
commit f912c39598
30 changed files with 516 additions and 90 deletions

16
Core.py
View File

@ -11,8 +11,9 @@ import sys
import time
import yaml
import requests
from web.app import run_server
from datetime import datetime, timedelta
from SendBot 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.freebuf import freebuf_main
from media.xianzhi import xianzhi_main
@ -183,11 +184,11 @@ def main_loop(choice):
elif choice == 0:
# 设置每天的特定时间点执行job函数
logger.info(f"{n+1}次执行准备开始。")
schedule.every().day.at("09:00").do(send_job, 12)
schedule.every().day.at("11:31").do(send_job, 3)
schedule.every().day.at("15:00").do(send_job, 3)
schedule.every().day.at("18:00").do(send_job, 3)
schedule.every().day.at("21:00").do(send_job, 3)
schedule.every().day.at("09:05").do(send_job, 12)
schedule.every().day.at("12:05").do(send_job, 3)
schedule.every().day.at("15:05").do(send_job, 3)
schedule.every().day.at("18:05").do(send_job, 3)
schedule.every().day.at("21:05").do(send_job, 3)
while True:
schedule.run_pending()
@ -230,7 +231,8 @@ def test_rss_source():
return rss_info
if __name__ == "__main__":
# print("程序正在运行当中。")
print("程序正在运行当中。")
# run_server()
time.sleep(5) # 添加短暂的延迟
rss_info = test_rss_source()
start_info = ""

File diff suppressed because one or more lines are too long

View File

@ -1,4 +1,44 @@
[
{
"title": "PHP反序列化ctf题解",
"link": "https://mp.weixin.qq.com/s?__biz=MzU4MjYxNTYwNA==&mid=2247487567&idx=1&sn=095dfb77e7448a1250c271d1a36729a5",
"description": null,
"author": "白安全组",
"category": "白安全组",
"pubDate": "2024-12-10T11:02:01"
},
{
"title": "网关按其功能可分为:协议网关、应用网关、安全网关",
"link": "https://mp.weixin.qq.com/s?__biz=Mzg3NTUzOTg3NA==&mid=2247514779&idx=1&sn=a6392297004d12e4d96593d8be6a133c",
"description": null,
"author": "全栈网络空间安全",
"category": "全栈网络空间安全",
"pubDate": "2024-12-10T10:51:58"
},
{
"title": "[漏洞挖掘与防护] 05.CVE-2018-12613phpMyAdmin 4.8.1后台文件包含缺陷复现及防御措施",
"link": "https://mp.weixin.qq.com/s?__biz=Mzg5MTM5ODU2Mg==&mid=2247501076&idx=1&sn=ea61326375112eb6b7486937c1ca2278",
"description": "本文主要复现phpMyAdmin文件包含漏洞希望您喜欢",
"author": "娜璋AI安全之家",
"category": "娜璋AI安全之家",
"pubDate": "2024-12-10T10:51:47"
},
{
"title": "SuperMega一款支持注入和加载的Shellcode工具",
"link": "https://mp.weixin.qq.com/s?__biz=MzkwMTQyODI4Ng==&mid=2247495151&idx=3&sn=6bc524a313373744150fadf60892c035",
"description": "该工具可以将其注入到可执行文件中执行进一步的安全测试。",
"author": "网络安全与人工智能研究中心",
"category": "网络安全与人工智能研究中心",
"pubDate": "2024-12-10T10:34:51"
},
{
"title": "【免杀】过360核晶、火绒 运行mimikatz、上线CS的万能加载器XlAnyLoader v1.1正式发布!",
"link": "https://mp.weixin.qq.com/s?__biz=Mzg4Mzg4OTIyMA==&mid=2247485855&idx=1&sn=f0c58a95fb3ce9a64ea2efa3556af326",
"description": "过360核晶、火绒 、微软、卡巴斯基(静态)\\\\x0d\\\\x0axlanyloader万能加载器",
"author": "威零安全实验室",
"category": "威零安全实验室",
"pubDate": "2024-12-10T10:31:19"
},
{
"title": "Burpsuite存储桶配置不当漏洞检测插件",
"link": "https://mp.weixin.qq.com/s?__biz=MzkxNjMwNDUxNg==&mid=2247486968&idx=1&sn=7ee147a6efd7c1a074d8acd00e67fe4a",
@ -1558,45 +1598,5 @@
"author": "星落安全团队",
"category": "星落安全团队",
"pubDate": "2024-12-05T00:00:59"
},
{
"title": "红蓝队病毒木马监控辅助工具12月3日更新",
"link": "https://mp.weixin.qq.com/s?__biz=MzU3NzY3MzYzMw==&mid=2247498820&idx=1&sn=2725bb5cbcb5e76e638a7e1c8836a0c7",
"description": null,
"author": "网络安全者",
"category": "网络安全者",
"pubDate": "2024-12-05T00:00:13"
},
{
"title": "最新Nessus2024.12.04版本主机漏洞扫描/探测工具下载|近期漏洞合集更新",
"link": "https://mp.weixin.qq.com/s?__biz=Mzg3ODE2MjkxMQ==&mid=2247489275&idx=1&sn=363d8f9e531b932bd18c27d845f83a21",
"description": "Nessus号称是世界上最流行的漏洞扫描程序全世界有超过75000个组织在使用它。该工具提供完整的电脑漏洞扫描服务并随时更新其漏洞数据库。Nessus不同于传统的漏洞扫描软件Nessus可同时在本机或远端上遥控进行系统的漏洞分析扫描",
"author": "渗透安全HackTwo",
"category": "渗透安全HackTwo",
"pubDate": "2024-12-05T00:00:12"
},
{
"title": "新型 Android 恶意软件 DroidBot 瞄准欧洲银行用户",
"link": "https://mp.weixin.qq.com/s?__biz=MzkxNDM4OTM3OQ==&mid=2247504934&idx=3&sn=09e44a53225b47183d331f0328fab9e4",
"description": null,
"author": "网络研究观",
"category": "网络研究观",
"pubDate": "2024-12-04T23:48:33"
},
{
"title": "Zabbix api_jsonrpc.php接口存在SQL注入漏洞CVE-2024-42327 附POC",
"link": "https://mp.weixin.qq.com/s?__biz=MzIxMjEzMDkyMA==&mid=2247487930&idx=1&sn=589b3837a2dc8ff72e861b99f6947f5d",
"description": null,
"author": "南风漏洞复现文库",
"category": "南风漏洞复现文库",
"pubDate": "2024-12-04T23:08:58"
},
{
"title": "工具集HeavenlyBypassAV免杀工具",
"link": "https://mp.weixin.qq.com/s?__biz=Mzk0MjY1ODE5Mg==&mid=2247484771&idx=1&sn=edb658df8647f36d20266189ef2f35e3",
"description": null,
"author": "风铃Sec",
"category": "风铃Sec",
"pubDate": "2024-12-04T22:15:59"
}
]

View File

@ -1,4 +1,12 @@
[
{
"title": "防火墙服务配置漏洞波及多家全球财富100强公司",
"link": "https://www.freebuf.com/news/417317.html",
"description": "摩根大通、Visa、英特尔、伯克希尔·哈撒韦和联合健康等都被发现受到了影响。",
"body": "<p>据Cyber Security News消息网络安全研究团队 Zafran 最近在 Web 应用程序防火墙 WAF 服务配置中发现了一个被称为“BreakingWAF”的安全漏洞该漏洞容易让许多财富 100强、1000强的公司受到网络攻击。</p><p class=\"tinymce-p\"><img src=\"https://image.3001.net/images/20241210",
"category": "资讯",
"pubDate": "Tue, 10 Dec 2024 11:27:49 +0800"
},
{
"title": "SaaS巨头被勒索攻击泄露680GB数据",
"link": "https://www.freebuf.com/news/417312.html",
@ -150,13 +158,5 @@
"body": "<p>据BleepingComputer消息一种名为“DroidBot”的新型安卓系统银行恶意软件试图窃取77 家加密货币交易所和银行应用程序的凭证,涉及英国、意大利、法国、西班牙、葡萄牙等多个国家。</p><p>据发现恶意软件的 Cleafy 研究人员称DroidBot 自 2024 年 6 月以来一直活跃,并作为恶意软件即服务 MaaS 平台运行每月的使用价格为3000美元。</p>",
"category": "资讯",
"pubDate": "Fri, 06 Dec 2024 13:47:34 +0800"
},
{
"title": "漏洞挖掘与复现",
"link": "https://www.freebuf.com/articles/web/414845.html",
"description": "漏洞复现与挖掘",
"body": "<p>大家好我是一个在IT行业十余年的小菜鸟今天与大家聊一聊漏洞的挖掘与复现。</p><h2 id=\"h2-1\">一 漏洞复现。</h2><h3 id=\"h3-1\">1.NetScaler ADC </h3><p>例如我对CVE-2023-3519漏洞进行了分析该漏洞是Citrix ADC 和 Citrix Gateway 中存在未经身份验证的远程代码执行漏洞。</p><p>由于不同版本会导",
"category": "Web安全",
"pubDate": "Fri, 06 Dec 2024 12:03:12 +0800"
}
]

View File

@ -1,4 +1,24 @@
[
{
"title": "内存马生成工具JMG的哥斯拉插件jmgg",
"link": "https://xz.aliyun.com/t/16632",
"published": "2024-12-08T16:49:18+08:00",
"id": "https://xz.aliyun.com/t/16632",
"summary": {
"@type": "html",
"#text": "内存马生成工具JMG的哥斯拉插件jmgg"
}
},
{
"title": "pyramid 框架无回显挖掘",
"link": "https://xz.aliyun.com/t/16631",
"published": "2024-12-08T16:04:25+08:00",
"id": "https://xz.aliyun.com/t/16631",
"summary": {
"@type": "html",
"#text": "pyramid 框架无回显挖掘"
}
},
{
"title": "代码审计 - MCMS v5.4.1 0day挖掘",
"link": "https://xz.aliyun.com/t/16630",
@ -978,25 +998,5 @@
"@type": "html",
"#text": "SpringMVC的URI解析和权限绕过"
}
},
{
"title": "基于深度学习TextCNN&XGBoost stacking融合对恶意软件的检测算法设计与实现",
"link": "https://xz.aliyun.com/t/16461",
"published": "2024-11-29T21:02:11+08:00",
"id": "https://xz.aliyun.com/t/16461",
"summary": {
"@type": "html",
"#text": "基于深度学习TextCNN&XGBoost stacking融合对恶意软件的检测算法设计与实现"
}
},
{
"title": "银狐黑产最新加载器利用破解版VPN为诱饵进行传播",
"link": "https://xz.aliyun.com/t/16459",
"published": "2024-11-29T19:51:21+08:00",
"id": "https://xz.aliyun.com/t/16459",
"summary": {
"@type": "html",
"#text": "银狐黑产最新加载器利用破解版VPN为诱饵进行传播"
}
}
]

33
MailSendBot.py Normal file
View File

@ -0,0 +1,33 @@
#!/usr/bin/python
# -*- coding: UTF-8 -*-
import yaml
import smtplib
from email.mime.text import MIMEText
from email.header import Header
# 加载参数
with open('./config.yaml', 'r', encoding="utf-8") as file:
config = yaml.safe_load(file)
mail_host = f"{config['mail_host']}"
mail_user = f"{config['mail_user']}"
mail_pass = f"{config['mail_pass']}"
sender = f"{config['sender']}"
receivers = f"{config['receivers']}"
message = MIMEText('Python 邮件发送测试...', 'plain', 'utf-8')
message['From'] = Header("推送测试", 'utf-8')
message['To'] = Header("测试", 'utf-8')
subject = 'Python SMTP 邮件测试'
message['Subject'] = Header(subject, 'utf-8')
try:
smtpObj = smtplib.SMTP()
smtpObj.connect(mail_host, 25) # 25 为 SMTP 端口号
smtpObj.login(mail_user,mail_pass)
smtpObj.sendmail(sender, receivers, message.as_string())
print("邮件发送成功")
except smtplib.SMTPException:
print("Error: 无法发送邮件")

View File

@ -1,5 +1,11 @@
key: aa04a02f-d7bf-4279-bd48-44c4f28c8f74
secret: 4tq65T4jm1MO2IlxvHxBWe
# 邮件配置
mail_host: smtp.masonliu.com #设置服务器
mail_user: test@masonliu.com #用户名
mail_pass: Test123456 #口令
sender: test@masonliu.com
receivers: ['2857911564@qq.com']
# 结算时间范围
e_hour: 4 # 程序运行时间间隔
circle: 0 # 是否启用循环设置为0后将设置为特定时间点运行
circle: 1 # 是否启用循环设置为0后将设置为特定时间点运行

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1,129 @@
#### 文章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
----------------------------------------

View File

@ -0,0 +1,43 @@
#### 文章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-12613phpMyAdmin 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 加密算法...
----------------------------------------

View File

@ -0,0 +1,20 @@
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 - 接收到退出信号,程序即将退出...

1
test.py Normal file
View File

@ -0,0 +1 @@
from web.app import run_server

Binary file not shown.

59
web/app.py Normal file
View File

@ -0,0 +1,59 @@
from flask import Flask, jsonify, render_template
import os
app = Flask(__name__)
# 配置文件路径
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
PARENT_DIR = os.path.dirname(BASE_DIR) # 上一个文件夹
SEC_NEWS_PATH = os.path.join(PARENT_DIR, 'history', 'sec_news.md')
TECH_PASSAGE_PATH = os.path.join(PARENT_DIR, 'history', 'tech_passage.md')
# print(f"Sec News Path: {SEC_NEWS_PATH}")
# print(f"Tech Passage Path: {TECH_PASSAGE_PATH}")
@app.route('/')
def index():
return render_template('index.html')
# 替换输出内容
def replace_content(content):
content = content.replace('####', '###')
# content = content.replace('\n\n', '###')
return content
@app.route('/get-sec-news')
def get_sec_news():
print(f"尝试打开安全新闻历史推送文件: {SEC_NEWS_PATH}")
try:
with open(SEC_NEWS_PATH, 'r', encoding='utf-8') as file:
content = file.read()
content = replace_content(content)
return jsonify({'content': content}), 200
except FileNotFoundError:
print(f"文件缺失: {SEC_NEWS_PATH}")
return jsonify({'error': '安全新闻历史推送文件缺失!'}), 404
except Exception as e:
print(f"读取时出错: {SEC_NEWS_PATH}, 原因: {str(e)}")
return jsonify({'error': str(e)}), 500
@app.route('/get-tech-passage')
def get_tech_passage():
print(f"尝试打开技术文章历史推送文件: {TECH_PASSAGE_PATH}")
try:
with open(TECH_PASSAGE_PATH, 'r', encoding='utf-8') as file:
content = file.read()
content = replace_content(content)
return jsonify({'content': content}), 200
except FileNotFoundError:
print(f"文件缺失: {TECH_PASSAGE_PATH}")
return jsonify({'error': '技术文章历史推送文件缺失!'}), 404
except Exception as e:
print(f"读取时出错: {TECH_PASSAGE_PATH}, 原因: {str(e)}")
return jsonify({'error': str(e)}), 500
def run_server():
app.run(host='0.0.0.0', port=5000)
if __name__ == '__main__':
app.run(debug=True) # 在生产环境中应设置为 False

BIN
web/templates/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

133
web/templates/index.html Normal file
View File

@ -0,0 +1,133 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>资讯推送Web端</title>
<link rel="shortcut icon" href="./static/img/favicon.ico">
<!-- 引入 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>
<style>
body {
font-family: Arial, sans-serif;
margin: 20px;
}
h1 {
color: #333;
}
#markdown-content {
white-space: pre-wrap;
}
/* 返回顶部按钮样式 */
#back-to-top {
display: none;
position: fixed;
bottom: 20px;
right: 30px;
z-index: 99;
font-size: 18px;
border: none;
outline: none;
background-color: #555;
color: white;
cursor: pointer;
padding: 15px;
border-radius: 4px;
}
#back-to-top:hover {
background-color: #777;
}
</style>
</head>
<body>
<div class="layui-container">
<h1 class="layui-title" id="page-title">历史推送读取</h1>
<button id="toggle-fetch-btn" class="layui-btn">切换读取源</button>
<div id="markdown-content" class="layui-card-body"></div>
</div>
<!-- 返回顶部按钮 -->
<button id="back-to-top" title="Go to top">Top</button>
<!-- 引入 Layui 的 JS -->
<script src="https://cdn.jsdelivr.net/npm/layui-src/dist/layui.js"></script>
<script>
layui.use(['layer'], function(){
var layer = layui.layer;
var currentUrl = '/get-sec-news';
var titleMap = {
'/get-sec-news': '安全新闻',
'/get-tech-passage': '技术文章'
};
function updateTitle(url) {
document.getElementById('page-title').innerText = titleMap[url] || '历史推送读取';
}
document.getElementById('toggle-fetch-btn').addEventListener('click', function() {
if (currentUrl === '/get-sec-news') {
currentUrl = '/get-tech-passage';
} else {
currentUrl = '/get-sec-news';
}
updateTitle(currentUrl);
fetch(currentUrl)
.then(response => response.json())
.then(data => {
if (data.content) {
const htmlContent = marked.parse(data.content);
document.getElementById('markdown-content').innerHTML = htmlContent;
} else {
document.getElementById('markdown-content').innerHTML = '<p>加载历史推送文件时出错!</p>';
}
})
.catch(error => {
console.error('获取源文件失败:', error);
document.getElementById('markdown-content').innerHTML = '<p>无法加载历史推送文件!</p>';
layer.msg('Failed to load markdown.', {icon: 5});
});
});
// Initial fetch on page load
updateTitle(currentUrl);
fetch(currentUrl)
.then(response => response.json())
.then(data => {
if (data.content) {
const htmlContent = marked.parse(data.content);
document.getElementById('markdown-content').innerHTML = htmlContent;
} else {
document.getElementById('markdown-content').innerHTML = '<p>加载历史推送文件时出错!</p>';
}
})
.catch(error => {
console.error('获取源文件失败:', error);
document.getElementById('markdown-content').innerHTML = '<p>无法加载历史推送文件!</p>';
layer.msg('Failed to load markdown.', {icon: 5});
});
// 显示或隐藏返回顶部按钮
window.onscroll = function() {
scrollFunction();
};
function scrollFunction() {
if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
document.getElementById("back-to-top").style.display = "block";
} else {
document.getElementById("back-to-top").style.display = "none";
}
}
// 返回顶部按钮点击事件
document.getElementById("back-to-top").addEventListener("click", function() {
document.body.scrollTop = 0;
document.documentElement.scrollTop = 0;
});
});
</script>
</body>
</html>