forked from Youchie/X-Panel-SSH-User-Management
-
Notifications
You must be signed in to change notification settings - Fork 0
/
block_iran.sh
25 lines (23 loc) · 1002 Bytes
/
block_iran.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/sh
#Alireza & Roozemain
sudo apt-get install curl unzip perl
sudo apt-get install xtables-addons-common -y
sudo apt-get install libtext-csv-xs-perl libmoosex-types-netaddr-ip-perl -y
wait
sudo mkdir /usr/share/xt_geoip
sudo mkdir /usr/libexec/xtables-addons/
sudo mkdir /usr/libexec/xtables-addons/xt_geoip_build
chmod 777 /usr/libexec/xtables-addons/xt_geoip_build
wait
MON=$(date +"%m")
YR=$(date +"%Y")
wget https://download.db-ip.com/free/dbip-country-lite-${YR}-${MON}.csv.gz
cp dbip-country-lite-${YR}-${MON}.csv.gz /usr/share/xt_geoip/
rm dbip-country-lite-${YR}-${MON}.csv.gz
gunzip /usr/share/xt_geoip/dbip-country-lite-${YR}-${MON}.csv.gz
/usr/libexec/xtables-addons/xt_geoip_build -D /usr/share/xt_geoip/ -i /usr/share/xt_geoip/dbip-country-lite-${YR}-${MON}.csv
/usr/libexec/xtables-addons/xt_geoip_build -D /usr/share/xt_geoip/ -i /usr/share/xt_geoip/dbip-country-lite-${YR}-${MON}.csv
modprobe xt_geoip
lsmod | grep ^xt_geoip
wait
echo -e "\n Download Success GEOIP Library \n"