常规更新

This commit is contained in:
MasonLiu 2026-05-03 19:02:51 +08:00
parent 2f6ae2b404
commit 8091219b84
9 changed files with 316 additions and 101 deletions

View File

@ -0,0 +1,3 @@
'''
文档生成功能暂无开发计划
'''

View File

@ -1,5 +1,8 @@
#!/usr/bin/python
# -*- coding: UTF-8 -*-
'''
邮件发送功能开发流程已中断无实际利用场景
'''
import yaml
import smtplib

View File

@ -27,7 +27,7 @@ e_hour: 4 # 程序运行时间间隔
time_mode: 1
# 0定时运行模式仅在指定时间运行参照Core.py中设置
# 1启用循环一定间隔时间后运行
mode: [1, 2, 3] # 运行模式,可多选
mode: [0, 1, 2, 3] # 运行模式,可多选
# 0启用RSS抓取模式
# 1启用搜狗-微信公众号文章监测
# 2启用github项目监测

View File

@ -4,12 +4,18 @@ translate: False # 是否开启翻译
# 监控列表
tool_list: # 监控已创建的仓库是否更新
- BeichenDream/Godzilla
- wy876/POC
keyword_list: # 监控关键词
- sql注入
- cnvd
- 未授权
- POC
- RCE
- 反序列化
- webshell
- CVE-2026
- 内网渗透
- 漏洞检测
- 钓鱼
user_list: # 监控用户

94
install.sh Normal file
View File

@ -0,0 +1,94 @@
#!/bin/bash
# 获取当前目录
BASE_DIR=$(cd "$(dirname "$0")"; pwd)
USER_NAME=$(whoami)
echo "项目路径: $BASE_DIR"
# ========= 自动检测 Python =========
detect_python() {
if command -v python >/dev/null 2>&1; then
PY=python
elif command -v python3 >/dev/null 2>&1; then
PY=python3
else
echo "❌ 未检测到 Python请先安装 Python 3.6+"
exit 1
fi
# 获取版本号
VERSION=$($PY -c 'import sys; print(".".join(map(str, sys.version_info[:3])))')
echo "检测到 Python: $PY ($VERSION)"
# 校验版本 >= 3.6
MAJOR=$(echo $VERSION | cut -d. -f1)
MINOR=$(echo $VERSION | cut -d. -f2)
if [ "$MAJOR" -lt 3 ] || { [ "$MAJOR" -eq 3 ] && [ "$MINOR" -lt 6 ]; }; then
echo "❌ Python 版本过低(需要 >= 3.6"
exit 1
fi
PYTHON_CMD=$PY
}
detect_python
# ========= 创建 PyBot 服务 =========
sudo bash -c "cat > /etc/systemd/system/PyBot.service" <<EOF
[Unit]
Description=PyBot Core Service
After=network.target
[Service]
Type=simple
User=$USER_NAME
WorkingDirectory=$BASE_DIR
ExecStart=$PYTHON_CMD $BASE_DIR/Core.py
Restart=always
RestartSec=3
StartLimitInterval=0
Environment=PYTHONUNBUFFERED=1
[Install]
WantedBy=multi-user.target
EOF
# ========= 创建 PyBot_Web 服务 =========
sudo bash -c "cat > /etc/systemd/system/PyBot_Web.service" <<EOF
[Unit]
Description=PyBot Web Service
After=network.target
[Service]
Type=simple
User=$USER_NAME
WorkingDirectory=$BASE_DIR
ExecStart=$PYTHON_CMD $BASE_DIR/web/app.py
Restart=always
RestartSec=3
StartLimitInterval=0
Environment=PYTHONUNBUFFERED=1
[Install]
WantedBy=multi-user.target
EOF
# ========= 重新加载 =========
sudo systemctl daemon-reexec
sudo systemctl daemon-reload
# ========= 启用 + 启动 =========
sudo systemctl enable PyBot
sudo systemctl enable PyBot_Web
sudo systemctl restart PyBot
sudo systemctl restart PyBot_Web
echo "===================================="
echo "✅ 服务已创建并启动"
echo "PyBot → core.py"
echo "PyBot_Web → web/app.py"
echo "===================================="

View File

@ -6,5 +6,4 @@ requests
python-dateutil
loguru
beautifulsoup4
feedparser

13
test.py
View File

@ -1,13 +0,0 @@
import feedparser
feed_url = "https://security.tencent.com/index.php/feed/blog/0"
feed = feedparser.parse(feed_url)
for entry in feed.entries:
print(entry.title)
print(entry.link)
print(entry.id)
print(entry.summary)
print(entry.id)
# 打印所有属性,找出正确的日期字段名
# print(entry.keys())

View File

@ -38,12 +38,12 @@ def replace_content(content):
content = content.replace(r"e:\Self-Tool-Code\PyBot", '.') # 修改: 使用原始字符串避免转义问题
return content
def get_records(content, num_records=20, delimiter='-'*40):
def get_records(content, num_records=50, delimiter='-'*40):
records = content.split(delimiter)
selected_records = records[:num_records]
return delimiter.join(selected_records)
def read_last_lines(file_path, num_lines=100):
def read_last_lines(file_path, num_lines=200):
with open(file_path, 'r', encoding='utf-8') as file:
return deque(file, maxlen=num_lines)
@ -111,4 +111,4 @@ def get_wx_news():
return jsonify({'content': content}), status_code
if __name__ == '__main__':
app.run(debug=True, port=666) # 在生产环境中应设置为 False
app.run(debug=False, port=9801) # 在生产环境中应设置为 False

View File

@ -10,65 +10,163 @@
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
<style>
body {
font-family: Arial, sans-serif;
margin: 10px; /* 减少边距 */
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
margin: 0;
padding: 20px;
background-color: #f8f9fa;
line-height: 1.6;
}
.layui-container {
max-width: 1200px;
margin: 0 auto;
background: white;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
padding: 20px;
}
h1 {
color: #333;
font-size: 1.5em; /* 适当减小标题字体 */
font-size: 1.8em;
text-align: center;
margin-bottom: 20px;
border-bottom: 2px solid #009688;
padding-bottom: 10px;
}
#markdown-content {
white-space: pre-wrap;
font-size: 0.9em; /* 减小内容字体 */
font-size: 1em;
padding: 15px;
background-color: #fafafa;
border-radius: 4px;
min-height: 400px;
}
/* 返回顶部按钮样式 */
#back-to-top {
display: none;
position: fixed;
bottom: 10px; /* 调整位置 */
right: 10px; /* 调整位置 */
z-index: 99;
font-size: 16px; /* 减小字体 */
border: none;
outline: none;
background-color: #555;
color: white;
cursor: pointer;
padding: 10px; /* 减小内边距 */
/* 按钮容器样式优化 */
#button-container {
display: flex;
justify-content: center;
flex-wrap: wrap;
gap: 10px;
margin: 15px 0;
}
#button-container .layui-btn {
margin: 5px;
transition: all 0.3s ease;
min-width: 120px;
}
/* 不同类型的按钮使用不同颜色 */
#sec-news-btn { background-color: #FF5722; }
#tech-passage-btn { background-color: #2196F3; }
#baidu-news-btn { background-color: #2F4F4F; }
#github-news-btn { background-color: #333; }
#wx-news-btn { background-color: #07C160; }
/* 按钮悬停效果 */
#button-container .layui-btn:hover {
transform: translateY(-2px);
box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}
/* 折叠面板样式优化 */
.layui-colla-item {
margin-bottom: 15px;
border-radius: 4px;
overflow: hidden;
}
.layui-colla-title {
background-color: #f2f2f2;
font-weight: 600;
}
/* 提示文字样式 */
.info-text {
text-align: center;
color: #666;
font-size: 0.9em;
margin: 10px 0 20px;
padding: 10px;
background-color: #f0f8ff;
border-radius: 4px;
}
/* 返回顶部按钮样式 - 已优化 */
#back-to-top {
display: none; /* 初始隐藏,滚动后显示 */
position: fixed;
bottom: 20px;
right: 20px;
z-index: 1000;
font-size: 14px;
border: none;
outline: none;
background-color: #009688; /* 使用layui主题色 */
color: white;
cursor: pointer;
padding: 12px 15px;
border-radius: 50%;
box-shadow: 0 2px 10px rgba(0,0,0,0.3);
transition: background-color 0.3s;
}
#back-to-top:hover {
background-color: #777;
background-color: #007a6e;
transform: scale(1.1); /* 悬停放大效果 */
}
#markdown-content a {
color: blue;
text-decoration: none; /* 可选:去掉下划线 */
color: #009688;
text-decoration: none;
}
#markdown-content a:hover {
text-decoration: underline; /* 可选:鼠标悬停时显示下划线 */
text-decoration: underline;
}
/* 错误消息样式 */
.error-message {
text-align: center;
padding: 40px;
color: #ff6b6b;
font-size: 1.1em;
}
/* 加载动画样式 */
.loading {
text-align: center;
padding: 50px;
}
/* 移动端样式调整 */
@media only screen and (max-width: 600px) {
body {
margin: 5px;
padding: 10px;
}
.layui-container {
padding: 15px;
}
h1 {
font-size: 1.2em;
font-size: 1.5em;
}
#markdown-content {
font-size: 0.8em;
font-size: 0.9em;
padding: 10px;
}
#back-to-top {
font-size: 14px;
padding: 8px;
}
#markdown-content a {
color: blue;
text-decoration: none; /* 可选:去掉下划线 */
}
#markdown-content a:hover {
text-decoration: underline; /* 可选:鼠标悬停时显示下划线 */
padding: 10px;
bottom: 15px;
right: 15px;
}
/* 按钮样式调整 */
@ -76,42 +174,57 @@
flex-direction: column; /* 换行显示按钮 */
align-items: center; /* 按钮居中对齐 */
}
#button-container .layui-btn {
margin: 5px 0; /* 增加按钮间距 */
width: 90%; /* 调整按钮宽度 */
margin: 8px 0; /* 增加按钮间距 */
width: 95%; /* 调整按钮宽度 */
max-width: 300px; /* 设置最大宽度 */
}
}
/* 平滑滚动 */
html {
scroll-behavior: smooth;
}
</style>
</head>
<body>
<div class="layui-container">
<center><h1 class="layui-title" id="page-title">历史推送读取</h1><br>
<h1 class="layui-title" id="page-title">📰 资讯推送中心</h1>
<!-- 信息提示 -->
<div class="info-text">
<strong>💡 提示:</strong>为保证网页运作性能默认仅读取前20条记录
</div>
<!-- 折叠面板 -->
<div class="layui-collapse" lay-filter="test">
<div class="layui-collapse" lay-accordion>
<div class="layui-colla-item">
<h2 class="layui-colla-title">选择监控源新闻类型</h2>
<div class="layui-colla-content">
<div id="button-container" class="layui-btn-group">
<button id="sec-news-btn" class="layui-btn">安全新闻</button>
<button id="tech-passage-btn" class="layui-btn">技术文章</button>
<button id="baidu-news-btn" class="layui-btn">百度新闻</button>
<button id="github-news-btn" class="layui-btn">GitHub新闻</button>
<button id="wx-news-btn" class="layui-btn">微信新闻</button>
<h2 class="layui-colla-title">📋 选择资讯类型</h2>
<div class="layui-colla-content layui-show">
<div id="button-container">
<button id="sec-news-btn" class="layui-btn layui-btn-sm">🔒 安全新闻</button>
<button id="tech-passage-btn" class="layui-btn layui-btn-sm">💻 技术文章</button>
<button id="baidu-news-btn" class="layui-btn layui-btn-sm">📊 百度新闻</button>
<button id="github-news-btn" class="layui-btn layui-btn-sm">🐙 GitHub动态</button>
<button id="wx-news-btn" class="layui-btn layui-btn-sm">💬 微信文章</button>
</div>
</div>
</div>
</div>
<h4>为保证网页运作性能默认仅读取前20条记录若您有需求可自行更改app.py</h4></center>
<div id="markdown-content" class="layui-card-body"></div>
</div>
<!-- 返回顶部按钮 -->
<button id="back-to-top" title="Go to top">Top</button>
<button id="back-to-top" title="返回顶部">
<i class="layui-icon layui-icon-top"></i>
</button>
<!-- 引入 Layui 的 JS -->
<script src="https://cdn.jsdelivr.net/npm/layui-src/dist/layui.js"></script>
<script>
// 优化后的JavaScript代码
layui.use(['layer', 'element'], function(){
var layer = layui.layer;
var element = layui.element;
@ -125,80 +238,90 @@
};
var titleMap = {
'/get-sec-news': '安全新闻',
'/get-tech-passage': '技术文章',
'/get-baidu-news': '百度新闻',
'/get-github-news': 'GitHub监控',
'/get-wx-news': '微信文章监控'
'/get-sec-news': '🔒 安全新闻',
'/get-tech-passage': '💻 技术文章',
'/get-baidu-news': '📊 百度新闻',
'/get-github-news': '🐙 GitHub动态',
'/get-wx-news': '💬 微信文章'
};
function updateTitle(url) {
document.getElementById('page-title').innerText = titleMap[url] || '历史推送读取';
document.getElementById('page-title').innerText = titleMap[url] || '📰 资讯推送中心';
}
function fetchContent(url, buttonId) {
// Disable all buttons
// 更新所有按钮状态
Object.keys(buttonMap).forEach(key => {
document.getElementById(key).disabled = false;
const btn = document.getElementById(key);
btn.disabled = (key === buttonId);
btn.style.opacity = (key === buttonId) ? '0.7' : '1';
});
// Enable the clicked button
document.getElementById(buttonId).disabled = true;
updateTitle(url);
// 显示加载动画
document.getElementById('markdown-content').innerHTML =
'<div class="loading"><i class="layui-icon layui-icon-loading layui-anim layui-anim-rotate layui-anim-loop"></i> 加载中...</div>';
fetch(url)
.then(response => response.json())
.then(data => {
if (data.content) {
const htmlContent = marked.parse(data.content);
document.getElementById('markdown-content').innerHTML = htmlContent;
// 添加这一行代码
addTargetBlankToLinks();
} else {
document.getElementById('markdown-content').innerHTML = '<p>加载历史推送文件时出错!(推送历史记录为空)</p>';
document.getElementById('markdown-content').innerHTML = '<div class="error-message"><p>加载历史推送文件时出错!(推送历史记录为空)</p></div>';
}
})
.catch(error => {
console.error('获取源文件失败:', error);
document.getElementById('markdown-content').innerHTML = '<p>无法加载历史推送文件!</p>';
layer.msg('加载资源失败', {icon: 5});
document.getElementById('markdown-content').innerHTML = '<div class="error-message"><p>无法加载历史推送文件!</p></div>';
layer.msg('加载资源失败', {icon: 2});
});
}
// Add event listeners to buttons
// 为按钮添加点击事件
Object.keys(buttonMap).forEach(key => {
document.getElementById(key).addEventListener('click', function() {
fetchContent(buttonMap[key], key);
// Check if the device is mobile
// 移动设备上自动收起面板
if (isMobileDevice()) {
// Collapse the panel
element.collapse('hide', 'test', 0);
$('.layui-colla-content').removeClass('layui-show');
}
});
});
// Initial fetch on page load
var initialButtonId = 'sec-news-btn'; // Default button
// 页面加载时默认获取安全新闻
var initialButtonId = 'sec-news-btn';
fetchContent(buttonMap[initialButtonId], initialButtonId);
});
// 优化的滚动检测函数
function scrollFunction() {
const scrollTop = document.body.scrollTop || document.documentElement.scrollTop;
const backToTopBtn = document.getElementById("back-to-top");
if (scrollTop > 300) {
backToTopBtn.style.display = "block";
} else {
backToTopBtn.style.display = "none";
}
}
// 显示或隐藏返回顶部按钮
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;
// 使用更平滑的滚动方式
window.scrollTo({
top: 0,
behavior: 'smooth'
});
});
// 检测是否为移动设备