Dec 30 00:07:14 VM-0-3-ubuntu server[3689789]: 2024-12-30 00:07:14.929 {89b6c95b89b115182c47ac1cc023299d} 404 "GET https www.xabaotu.com /search/ht6ebug6by.html HTTP/1.1" 140.884, 202.21.110.110, "https://www.xabaotu.com/search/d4061ed1e3.html", "Mozilla/5.0 (Linux; Android 10; M2004J19C) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Mobile Safari/537.36 OPR/54.2.2672.50007", 65, "Not Found", ""
Dec 30 00:07:14 VM-0-3-ubuntu server[3689789]: 2024-12-30 00:07:14.945 {5eefaf5c89b115182d47ac1c210b0c16} 404 "GET https www.xabaotu.com /search/yt279722by.html HTTP/1.1" 133.088, 114.7.9.102, "https://www.xabaotu.com/search/cbd92dcb39.html", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 YaBrowser/23.7.1.1140 Yowser/2.5 Safari/537.36", 65, "Not Found", ""
Dec 30 00:07:14 VM-0-3-ubuntu server[3689789]: 2024-12-30 00:07:14.954 {5ead465d89b115182e47ac1ccd09b98f} 404 "GET https www.xabaotu.com /search/b4eehmn080.html HTTP/1.1" 126.507, 196.202.217.10, "https://www.xabaotu.com/search/bdf5567a16.html", "Mozilla/5.0 (Linux; arm_64; Android 9; SM-G955F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.328 YaBrowser/24.1.0.328.00 SA/3 Mobile Safari/537.36", 65, "Not Found", ""
Dec 30 00:07:14 VM-0-3-ubuntu server[3689789]: 2024-12-30 00:07:14.966 {488cfa5d89b115182f47ac1cb8e93c91} 404 "GET https www.xabaotu.com /search/2q83kagz0a.html HTTP/1.1" 174.706, 177.220.237.178, "https://www.xabaotu.com/search/57c565a6cd.html", "Mozilla/5.0 (Linux; arm; Android 12; M2101K7BL) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.5993.133 YaBrowser/23.11.5.133.00 SA/3 Mobile Safari/537.36", 65, "Not Found", ""
Dec 30 00:07:14 VM-0-3-ubuntu server[3689789]: 2024-12-30 00:07:14.973 {9546675e89b115183047ac1c0e6f64bc} 404 "GET https www.xabaotu.com /search/j9pqg57htz.html HTTP/1.1" 130.695, 182.23.41.226, "https://www.xabaotu.com/search/c04bb881c9.html", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 YaBrowser/23.7.5.635 (beta) Yowser/2.5 Safari/537.36", 65, "Not Found", ""
Dec 30 00:07:14 VM-0-3-ubuntu server[3689789]: 2024-12-30 00:07:14.973 {7ab4675e89b115183147ac1c2ac397e1} 404 "GET https www.xabaotu.com /search/3vlruk127z.html HTTP/1.1" 155.420, 182.23.41.226, "https://www.xabaotu.com/search/c04bb881c9.html", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 YaBrowser/23.7.5.635 (beta) Yowser/2.5 Safari/537.36", 65, "Not Found", ""
Dec 30 00:07:14 VM-0-3-ubuntu server[3689789]: 2024-12-30 00:07:14.974 {182e725e89b115183247ac1c3d2caa5b} 404 "GET https www.xabaotu.com /search/m3im5t2tgj.html HTTP/1.1" 121.907, 182.23.41.226, "https://www.xabaotu.com/search/c04bb881c9.html", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 YaBrowser/23.7.5.635 (beta) Yowser/2.5 Safari/537.36", 65, "Not Found", ""
Dec 30 00:07:14 VM-0-3-ubuntu server[3689789]: 2024-12-30 00:07:14.975 {3d107d5e89b115183347ac1c54066c6a} 404 "GET https www.xabaotu.com /search/9wlh6k06zr.html HTTP/1.1" 95.408, 182.23.41.226, "https://www.xabaotu.com/search/c04bb881c9.html", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 YaBrowser/23.7.5.635 (beta) Yowser/2.5 Safari/537.36", 65, "Not Found", ""
Dec 30 00:07:14 VM-0-3-ubuntu server[3689789]: 2024-12-30 00:07:14.975 {8ab2855e89b115183447ac1c8775250d} 404 "GET https www.xabaotu.com /search/qpc2monebf.html HTTP/1.1" 96.130, 182.23.41.226, "https://www.xabaotu.com/search/c04bb881c9.html", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 YaBrowser/23.7.5.635 (beta) Yowser/2.5 Safari/537.36", 65, "Not Found", ""
Dec 30 00:07:14 VM-0-3-ubuntu server[3689789]: 2024-12-30 00:07:14.976 {4aac905e89b115183547ac1c063bbbe5} 404 "GET https www.xabaotu.com /search/buya6t1gop.html HTTP/1.1" 90.579, 182.23.41.226, "https://www.xabaotu.com/search/c04bb881c9.html", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 YaBrowser/23.7.5.635 (beta) Yowser/2.5 Safari/537.36", 65, "Not Found", ""
Dec 30 00:07:14 VM-0-3-ubuntu server[3689789]: 2024-12-30 00:07:14.977 {e9ec9b5e89b115183647ac1cd4ba7757} 404 "GET https www.xabaotu.com /search/s3en98pbvj.html HTTP/1.1" 89.707, 182.23.41.226, "https://www.xabaotu.com/search/c04bb881c9.html", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 YaBrowser/23.7.5.635 (beta) Yowser/2.5 Safari/537.36", 65, "Not Found", ""
Dec 30 00:07:14 VM-0-3-ubuntu server[3689789]: 2024-12-30 00:07:14.977 {e51a9c5e89b115183847ac1ce6f39668} 404 "GET https www.xabaotu.com /search/cil2i8cenk.html HTTP/1.1" 89.507, 202.57.210.65, "https://www.xabaotu.com/search/57c565a6cd.html", "Mozilla/5.0 (Windows NT 10.0; Win64; x64; Chromium GOST) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36", 65, "Not Found", ""
建议使用行为分析结合IP封禁
通过分析访问日志,识别出异常的访问模式。例如,短时间内大量的404错误请求、频繁访问特定页面等。
步骤1:收集访问日志
步骤2:分析日志
示例代码(Python):
使用Python脚本分析日志文件,识别频繁访问404页面的IP地址。
日志文件logfile.log
改成自己的
生成的ip文档suspicious_ips.txt
名字自定义
analyze_logs.py
import re
from collections import defaultdict
# 日志文件路径
log_file = 'path/to/your/logfile.log'
# 正则表达式模式
ip_pattern = re.compile(r'(\d+\.\d+\.\d+\.\d+)')
status_pattern = re.compile(r'\" (\d{3}) ')
# 记录IP请求次数和404错误次数
ip_requests = defaultdict(int)
ip_404s = defaultdict(int)
# 读取日志文件并分析
with open(log_file, 'r') as file:
for line in file:
ip_match = ip_pattern.search(line)
status_match = status_pattern.search(line)
if ip_match and status_match:
ip = ip_match.group(1)
status = status_match.group(1)
ip_requests[ip] += 1
if status == '404':
ip_404s[ip] += 1
# 设定阈值
request_threshold = 100
error_threshold = 50
# 识别可疑IP地址
suspicious_ips = [ip for ip, count in ip_requests.items() if count > request_threshold or ip_404s[ip] > error_threshold]
# 输出可疑IP地址
print("Suspicious IPs:", suspicious_ips)
# 将可疑IP地址写入文件
with open('suspicious_ips.txt', 'w') as f:
for ip in suspicious_ips:
f.write(ip + '\n')
一旦识别出异常行为,将可疑IP地址添加到Nginx配置文件中进行封禁。
这里介绍两种方式
1.手动更新
在Nginx配置文件中添加以下内容,并创建 suspicious_ips.conf
文件名字自定义,路径改成自己的:
http {
...
geo $block_ip {
default 0;
include /path/to/suspicious_ips.conf;
}
server {
...
if ($block_ip) {
return 403;
}
}
}
2.自动化更新
使用Python脚本将 suspicious_ips.txt 文件中的IP地址添加到 suspicious_ips.conf 文件中:
update_nginx_conf.py
with open('suspicious_ips.txt', 'r') as f:
ips = f.readlines()
with open('/path/to/suspicious_ips.conf', 'w') as f:
for ip in ips:
f.write(f"{ip.strip()} 1;\n")
使用 iptables 封禁可疑IP地址:rules.v4
文件名自定义
while IFS= read -r ip; do
sudo iptables -A INPUT -s "$ip" -j DROP
done < /path/to/suspicious_ips.txt
sudo iptables-save > /etc/iptables/rules.v4
sudo nginx -s reload
补充
将上述步骤整合到一个脚本中:
update_security.sh
#!/bin/bash
python3 /path/to/your/analyze_logs.py
python3 /path/to/your/update_nginx_conf.py
while IFS= read -r ip; do
sudo iptables -A INPUT -s "$ip" -j DROP
done < /path/to/suspicious_ips.txt
sudo nginx -s reload
sudo iptables-save > /etc/iptables/rules.v4
设置定时任务
crontab -e
# 添加以下行,每小时运行一次脚本
0 * * * * /path/to/update_security.sh
我有一个数组,如下: let datalist = [ ] 我想把这个数组处理成 这样的格式: let datalist2 = [ 类似于datalist2这样的数据结构,怎么才能实现呢?
刚刚接触 vue,各位大佬,请问下如果要将这个数据结构中的data数组的数据换成从数据库中请求来的数据该怎么做?我在路由器中写了赋值但好像不起作用,请教一下该怎么做才行 这是我的路由器代码
这个X6的背景图片不能和画布一起拖动吗? 复现代码:https://codesandbox.io/s/agitated-dream-cynz3h 如果报错,点一下X就可以显示了^_^
vue.config.js中配置了sourcemap后,热启动会变得非常慢,而且会闪过好几串乱码
原始content: decode('utf-8')报错: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe8 in position 1: invalid continuation byte decode('utf-8', 'ignore'): decode('gbk', 'ignore'): decode('utf-16', 'ig
各位高手帮忙看下这个页面中左上角的视频(穿黄色裙子的女的正在讲解)怎么下载到电脑中? 我没找到视频链接。 这个页面的链接如下:https://live.1688.com/zb/play.html?userId=undefined&videoId=3... 右键打开了页面的检查,没找到视频链接
比如Input 我可以这样选中赋值。但是antd的select,1是下拉框无法展开,也就没办法赋值了。