Skip to content

Commit 9ef5544

Browse files
authored
Uploaded failedauth.sh && V2rayDNS.json
1 parent 6239dd7 commit 9ef5544

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

test/V2rayDNScfg.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"servers": [
3+
{
4+
"tag": "dns-resolver",
5+
"address": "101.102.103.104",
6+
"detour": "direct"
7+
},
8+
{
9+
"tag": "dns_proxy",
10+
"address": "https://public.dns.iij.jp/dns-query",
11+
"address_resolver": "dns-resolver",
12+
"strategy": "ipv4_only",
13+
"detour": "proxy"
14+
},
15+
{
16+
"tag": "dns_direct",
17+
"address": "https://120.53.53.53/dns-query",
18+
"address_resolver": "dns-resolver",
19+
"strategy": "ipv4_only",
20+
"detour": "direct"
21+
},
22+
{
23+
"tag": "dns_block",
24+
"address": "rcode://success"
25+
}
26+
],
27+
"rules": [
28+
{
29+
"rule_set": [
30+
"geosite-geolocation-!cn"
31+
],
32+
"server": "dns_proxy"
33+
},
34+
{
35+
"outbound": "any",
36+
"server": "dns_direct"
37+
},
38+
{
39+
"rule_set": [
40+
"geosite-category-ads-all"
41+
],
42+
"server": "dns_block",
43+
"query_type": [
44+
"A",
45+
"AAAA"
46+
]
47+
}
48+
],
49+
"final": "dns_proxy",
50+
"strategy": "ipv4_only"
51+
}

test/failedauth.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/bin/bash
2+
log file="/var/log/auth.log" #日志文件路径
3+
#输出表头和分隔线
4+
echo "IP地址 失败次数"
5+
echo
6+
7+
# 使用 awk 统计录失Failed的 IP 和次数,并排序输出
8+
9+
awk '
10+
/Failed password/ {
11+
# 提取 IP 地址
12+
for (i=1; i<= NF; i++) {
13+
if($i ~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/){
14+
ip = $i
15+
break
16+
17+
#统计IP出现次数
18+
if(ip) {
19+
ip count[ip]++
20+
}
21+
}
22+
23+
END {
24+
# 输出统计结果
25+
for(ip in ip count) {
26+
printf "$-15s\t&d\n", ip, ip_count[ip]
27+
}
28+
}' $log file|sort-k2 -nr #按Failed次数从高到低排序

0 commit comments

Comments
 (0)