mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-01 05:03:56 +08:00
update 2026-06-16 01:07:40
This commit is contained in:
1 parent
18e09e96e5
commit
d42c9b2ab0
3 files changed
+7
-12
No files matched your search
@@ -1036,7 +1036,7 @@ const methods = {
|
|||||||
const type = req.args?.type;
|
const type = req.args?.type;
|
||||||
let result = {};
|
let result = {};
|
||||||
|
|
||||||
const fd = popen('/usr/bin/sing-box generate ' + type + ` ${req.args?.params || ''}`);
|
const fd = popen(`/usr/bin/sing-box generate ${type} ${shellquote(req.args?.params || '')}`);
|
||||||
if (fd) {
|
if (fd) {
|
||||||
let ech_cfg_set = false;
|
let ech_cfg_set = false;
|
||||||
let ech_key_set = false;
|
let ech_key_set = false;
|
||||||
|
|||||||
@@ -1518,11 +1518,6 @@ function gen_config(var)
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
table.insert(rules, {
|
|
||||||
outboundTag = "direct",
|
|
||||||
ip = { "geoip:private" }
|
|
||||||
})
|
|
||||||
|
|
||||||
if default_outboundTag then
|
if default_outboundTag then
|
||||||
local rule = {
|
local rule = {
|
||||||
ruleTag = "default",
|
ruleTag = "default",
|
||||||
|
|||||||
@@ -2293,8 +2293,8 @@ monitor_logins() {
|
|||||||
trap cleanup_child SIGINT SIGTERM
|
trap cleanup_child SIGINT SIGTERM
|
||||||
|
|
||||||
(
|
(
|
||||||
# 监听系统日志,-f 表示跟随实时日志,-p 表示日志级别为 notice
|
# 监听系统日志,-f 表示跟随实时日志
|
||||||
run_with_tag logread -f -p notice | while IFS= read -r line; do
|
run_with_tag logread -f | while IFS= read -r line; do
|
||||||
[ -n "$web_logged" ] && {
|
[ -n "$web_logged" ] && {
|
||||||
web_login_ip=$(echo "$line" | grep -i "accepted login" | awk '{print $NF}')
|
web_login_ip=$(echo "$line" | grep -i "accepted login" | awk '{print $NF}')
|
||||||
[ -n "$web_login_ip" ] && process_login "$web_login_ip" $(echo "$line" | awk '{print $4}') web_login_counts
|
[ -n "$web_login_ip" ] && process_login "$web_login_ip" $(echo "$line" | awk '{print $4}') web_login_counts
|
||||||
@@ -2317,7 +2317,7 @@ monitor_logins() {
|
|||||||
# 如果未能提取到 IP,从日志标识符提取失败用户的 ID,并再次提取 IP
|
# 如果未能提取到 IP,从日志标识符提取失败用户的 ID,并再次提取 IP
|
||||||
if [ -z "$ssh_failed_ip" ]; then
|
if [ -z "$ssh_failed_ip" ]; then
|
||||||
ssh_failed_num=$(echo "$line" | sed -n 's/.*authpriv\.warn dropbear\[\([0-9]\+\)\]: Login attempt for nonexistent user/\1/p')
|
ssh_failed_num=$(echo "$line" | sed -n 's/.*authpriv\.warn dropbear\[\([0-9]\+\)\]: Login attempt for nonexistent user/\1/p')
|
||||||
[ -n "$ssh_failed_num" ] && ssh_failed_ip=$(logread notice | grep "authpriv\.info dropbear\[${ssh_failed_num}\].*Child connection from" | awk '{print $NF}' | sed -nr 's#^(.*):[0-9]{1,5}#\1#gp' | sed -e 's/%.*//' | tail -n 1)
|
[ -n "$ssh_failed_num" ] && ssh_failed_ip=$(logread | grep "authpriv\.info dropbear\[${ssh_failed_num}\].*Child connection from" | awk '{print $NF}' | sed -nr 's#^(.*):[0-9]{1,5}#\1#gp' | sed -e 's/%.*//' | tail -n 1)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 如果成功提取到 IP 地址,调用 process_login 处理
|
# 如果成功提取到 IP 地址,调用 process_login 处理
|
||||||
@@ -2578,13 +2578,13 @@ login_send() {
|
|||||||
# 登录方式
|
# 登录方式
|
||||||
if [[ "$log_type" == "web"* ]]; then
|
if [[ "$log_type" == "web"* ]]; then
|
||||||
# Web 登录、非法登录
|
# Web 登录、非法登录
|
||||||
local login_mode=$(logread notice | grep -E ".* $login_time.*$login_ip.*" | awk '{print $13}' | tail -n 1)
|
local login_mode=$(logread | grep -E ".* $login_time.*$login_ip.*" | awk '{print $13}' | tail -n 1)
|
||||||
[ "$login_mode" = "/" ] && login_mode="$(translate "/ (Homepage login)")"
|
[ "$login_mode" = "/" ] && login_mode="$(translate "/ (Homepage login)")"
|
||||||
elif [[ "$log_type" == "ssh_login"* ]]; then
|
elif [[ "$log_type" == "ssh_login"* ]]; then
|
||||||
# SSH 登录
|
# SSH 登录
|
||||||
local login_mode=$(logread notice | grep -E ".* $login_time.*$login_ip.*" | awk '{print $8}' | tail -n 1)
|
local login_mode=$(logread | grep -E ".* $login_time.*$login_ip.*" | awk '{print $8}' | tail -n 1)
|
||||||
else
|
else
|
||||||
local login_mode=$(logread notice | grep -E ".* $login_time.*$login_ip.*" | awk '{for(i=8;i<NF;i++) if($i=="from") break; else printf $i " "}' | tail -n 1)
|
local login_mode=$(logread | grep -E ".* $login_time.*$login_ip.*" | awk '{for(i=8;i<NF;i++) if($i=="from") break; else printf $i " "}' | tail -n 1)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "$login_disturb" ] || [ "$login_disturb" -ne "1" ]; then
|
if [ -z "$login_disturb" ] || [ "$login_disturb" -ne "1" ]; then
|
||||||
|
|||||||
Reference in new issue
Block a user