mirror of
https://github.com/hotyue/IP-Sentinel.git
synced 2026-06-26 03:41:28 +08:00
Compare commits
3 Commits
main
...
v3.2.2-leg
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
50da8352d4 | ||
|
|
a55d362be6 | ||
|
|
044c7a9937 |
@@ -115,7 +115,7 @@ class AgentHandler(http.server.BaseHTTPRequestHandler):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# 校验 3:HMAC 数据完整性与身份合法性校验
|
# 校验 3:HMAC 数据完整性与身份合法性校验
|
||||||
msg = f"{req_path}:{req_t}".encode('utf-8')
|
msg = "{}:{}".format(req_path, req_t).encode('utf-8')
|
||||||
expected_sign = hmac.new(AUTH_TOKEN.encode('utf-8'), msg, hashlib.sha256).hexdigest()
|
expected_sign = hmac.new(AUTH_TOKEN.encode('utf-8'), msg, hashlib.sha256).hexdigest()
|
||||||
|
|
||||||
# 使用 compare_digest 防御时序攻击
|
# 使用 compare_digest 防御时序攻击
|
||||||
@@ -201,7 +201,7 @@ class AgentHandler(http.server.BaseHTTPRequestHandler):
|
|||||||
log_data = html.escape("".join(lines[-15:]))
|
log_data = html.escape("".join(lines[-15:]))
|
||||||
|
|
||||||
node_name = subprocess.check_output(['hostname']).decode('utf-8').strip()[:15]
|
node_name = subprocess.check_output(['hostname']).decode('utf-8').strip()[:15]
|
||||||
text_msg = f"📄 <b>[{node_name}] 实时运行日志:</b>\n<pre><code>{log_data}</code></pre>"
|
text_msg = "📄 <b>[{}] 实时运行日志:</b>\n<pre><code>{}</code></pre>".format(node_name, log_data)
|
||||||
|
|
||||||
data = urllib.parse.urlencode({
|
data = urllib.parse.urlencode({
|
||||||
'chat_id': config.get('CHAT_ID', ''),
|
'chat_id': config.get('CHAT_ID', ''),
|
||||||
@@ -217,7 +217,7 @@ class AgentHandler(http.server.BaseHTTPRequestHandler):
|
|||||||
urllib.request.urlopen(req, timeout=10)
|
urllib.request.urlopen(req, timeout=10)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Log transmission failed: {e}")
|
print("Log transmission failed: {}".format(e))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.send_response(404)
|
self.send_response(404)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
# ==========================================================
|
# ==========================================================
|
||||||
|
|
||||||
# 你的 GitHub 仓库 Raw 数据直链前缀
|
# 你的 GitHub 仓库 Raw 数据直链前缀
|
||||||
REPO_RAW_URL="https://raw.githubusercontent.com/hotyue/IP-Sentinel/main"
|
REPO_RAW_URL="https://raw.githubusercontent.com/hotyue/IP-Sentinel/legacy"
|
||||||
# 临时改为私库地址用于测试
|
# 临时改为私库地址用于测试
|
||||||
# REPO_RAW_URL="https://git.94211762.xyz/hotyue/IP-Sentinel/raw/branch/main"
|
# REPO_RAW_URL="https://git.94211762.xyz/hotyue/IP-Sentinel/raw/branch/main"
|
||||||
INSTALL_DIR="/opt/ip_sentinel"
|
INSTALL_DIR="/opt/ip_sentinel"
|
||||||
@@ -18,6 +18,17 @@ echo "========================================================"
|
|||||||
|
|
||||||
# 1. 依赖检查与安装 (新增 python3 用于轻量级 Webhook 服务)
|
# 1. 依赖检查与安装 (新增 python3 用于轻量级 Webhook 服务)
|
||||||
echo -e "\n[1/7] 正在安装必要环境依赖 (curl, jq, cron, procps, python3)..."
|
echo -e "\n[1/7] 正在安装必要环境依赖 (curl, jq, cron, procps, python3)..."
|
||||||
|
|
||||||
|
# ================== [Legacy: Debian 9 APT 源抢修补丁] ==================
|
||||||
|
if [ -f /etc/debian_version ] && grep -q -E "^9\." /etc/debian_version; then
|
||||||
|
echo -e "\033[33m⚠️ 检测到 Debian 9 (Stretch),正在抢修已停用的 APT 档案馆源...\033[0m"
|
||||||
|
echo "deb http://archive.debian.org/debian stretch main" > /etc/apt/sources.list
|
||||||
|
echo "deb http://archive.debian.org/debian-security stretch/updates main" >> /etc/apt/sources.list
|
||||||
|
sed -i '/stretch-updates/d' /etc/apt/sources.list
|
||||||
|
echo 'Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/99no-check-valid-until
|
||||||
|
fi
|
||||||
|
# =======================================================================
|
||||||
|
|
||||||
if [ -f /etc/debian_version ]; then
|
if [ -f /etc/debian_version ]; then
|
||||||
apt-get update -y >/dev/null 2>&1
|
apt-get update -y >/dev/null 2>&1
|
||||||
apt-get install -y curl jq cron procps python3 >/dev/null 2>&1
|
apt-get install -y curl jq cron procps python3 >/dev/null 2>&1
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
# ==========================================================
|
# ==========================================================
|
||||||
|
|
||||||
# [新增] 提取仓库直链前缀变量,方便后续在官方库和私库间一键切换
|
# [新增] 提取仓库直链前缀变量,方便后续在官方库和私库间一键切换
|
||||||
REPO_RAW_URL="https://raw.githubusercontent.com/hotyue/IP-Sentinel/main"
|
REPO_RAW_URL="https://raw.githubusercontent.com/hotyue/IP-Sentinel/legacy"
|
||||||
# 临时改为私库地址用于测试
|
# 临时改为私库地址用于测试
|
||||||
# REPO_RAW_URL="https://git.94211762.xyz/hotyue/IP-Sentinel/raw/branch/main"
|
# REPO_RAW_URL="https://git.94211762.xyz/hotyue/IP-Sentinel/raw/branch/main"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user