fix
This commit is contained in:
parent
142f200882
commit
201e8d72b9
29
firewall.sh
29
firewall.sh
@ -58,12 +58,6 @@ MENU_BOTTOM="===================================================================
|
||||
DATE="$(date +%d/%b/%Y:%H:%M -d '1 minute ago')"
|
||||
nft list table filter >$NFT_CACHE
|
||||
|
||||
#Countries to Block
|
||||
COUNTRY=(
|
||||
https://www.ipdeny.com/ipblocks/data/countries/il.zone
|
||||
https://www.ipdeny.com/ipblocks/data/countries/cn.zone
|
||||
)
|
||||
|
||||
ipBlockParser() {
|
||||
if [[ "$1" == *":"* ]]; then
|
||||
$NFT insert rule ip6 filter input position 0 ip6 saddr $1 drop
|
||||
@ -93,15 +87,11 @@ ipDeleteParser() {
|
||||
}
|
||||
|
||||
blockCountry() {
|
||||
for i in "${COUNTRY[@]}"; do
|
||||
echo
|
||||
DATA=($( redis-cli SMEMBERS country_ip))
|
||||
for i in "${DATA[@]}"; do
|
||||
echo "Blocking $i"
|
||||
DB=($(curl $i))
|
||||
for j in "${DB[@]}"; do
|
||||
ipBlockParser $j
|
||||
done
|
||||
ipBlockParser $i
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
wireguard-networking() {
|
||||
@ -474,6 +464,17 @@ importDB() {
|
||||
DATA=($(cat crawlers.txt))
|
||||
for i in "${DATA[@]}"; do redis-cli SADD crawlers $i; done
|
||||
redis-cli SADD my_ip $(curl ifconfig.me)
|
||||
redis-cli SADD country https://www.ipdeny.com/ipblocks/data/countries/il.zone \
|
||||
https://www.ipdeny.com/ipblocks/data/countries/cn.zone
|
||||
COUNTRY=($( redis-cli SMEMBERS country) )
|
||||
for i in "${COUNTRY[@]}"; do
|
||||
echo
|
||||
echo "Blocking $i"
|
||||
DB=($(curl $i))
|
||||
for j in "${DB[@]}"; do
|
||||
redis-cli SADD country_ip $j
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
exportDB() {
|
||||
@ -497,8 +498,6 @@ elif [ "$1" = "bot-search" ]; then
|
||||
bot-search
|
||||
elif [ "$1" = "attacker-protection" ]; then
|
||||
attacker-protection
|
||||
elif [ "$1" = "country" ]; then
|
||||
blockCountry
|
||||
elif [ "$1" = "status" ]; then
|
||||
automaticStatus
|
||||
elif [ "$1" = "forgive" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user