mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-10-31 21:15:13 +08:00
update 2026-05-13 01:55:45
This commit is contained in:
1 parent
1b6001bfed
commit
6f4a0231c5
1857 files changed
+749084
-99
No files matched your search
Executable
+24
@@ -0,0 +1,24 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright 2019 Shun Li <riverscn@gmail.com>
|
||||
# Licensed to the public under the GNU General Public License v3.
|
||||
|
||||
add_to_set() {
|
||||
local ip=$1
|
||||
local cfg=$2
|
||||
local subnet=$ip/24
|
||||
ping -W1 -c1 $ip &>/dev/null && return
|
||||
if ! ipset -q test iptvhelper_$cfg $subnet; then
|
||||
ipset add iptvhelper_$cfg $subnet
|
||||
echo added $subnet to set iptvhelper_$cfg
|
||||
fi
|
||||
}
|
||||
|
||||
echo $1
|
||||
|
||||
logread -e "iptvhelper\.$1" -f |
|
||||
while read line; do
|
||||
ip=$(echo "$line" | sed -r 's|.*DST=([0-9.]+).*|\1|')
|
||||
echo requested $ip
|
||||
add_to_set $ip $1 &
|
||||
done
|
||||
Reference in new issue
Block a user