-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/master'
- Loading branch information
Showing
5 changed files
with
58 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,17 @@ | ||
#!/bin/sh | ||
#Alireza & Roozemain | ||
|
||
#Alireza | ||
sudo apt-get update -y | ||
sudo apt-get -y upgrade | ||
sudo apt-get install curl unzip perl xtables-addons-common libtext-csv-xs-perl libmoosex-types-netaddr-ip-perl iptables-persistent -y | ||
sudo mkdir /usr/share/xt_geoip | ||
|
||
sudo wget -4 -O /usr/local/bin/geo-update.sh https://raw.githubusercontent.com/xpanel-cp/XPanel-SSH-User-Management/master/geo-update.sh | ||
|
||
chmod 755 /usr/lib/xtables-addons/xt_geoip_build | ||
MON=$(date +"%m") | ||
YR=$(date +"%Y") | ||
wget https://download.db-ip.com/free/dbip-country-lite-${YR}-${MON}.csv.gz -O /usr/share/xt_geoip/dbip-country-lite.csv.gz | ||
gunzip /usr/share/xt_geoip/dbip-country-lite.csv.gz | ||
/usr/lib/xtables-addons/xt_geoip_build -D /usr/share/xt_geoip/ -S /usr/share/xt_geoip/ | ||
rm /usr/share/xt_geoip/dbip-country-lite.csv | ||
bash /usr/local/bin/geo-update.sh | ||
|
||
echo -e "\n Download Success GEOIP Library \n" | ||
sudo iptables -A OUTPUT -m geoip -p tcp --destination-port 80 --dst-cc IR -j DROP | ||
sudo iptables -A OUTPUT -m geoip -p tcp --destination-port 443 --dst-cc IR -j DROP | ||
iptables-save | ||
clear | ||
echo -e "Blocked Port 80 and 443 IRAN \n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
MON=$(date +"%m") | ||
YR=$(date +"%Y") | ||
wget https://download.db-ip.com/free/dbip-country-lite-${YR}-${MON}.csv.gz -O /usr/share/xt_geoip/dbip-country-lite.csv.gz | ||
gunzip /usr/share/xt_geoip/dbip-country-lite.csv.gz | ||
/usr/lib/xtables-addons/xt_geoip_build -D /usr/share/xt_geoip/ -S /usr/share/xt_geoip/ | ||
rm /usr/share/xt_geoip/dbip-country-lite.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
|
||
# install addons | ||
apt install xtables-addons-common libnet-cidr-lite-perl libtext-csv-xs-perl libgeoip2-perl -y | ||
|
||
modprobe xt_geoip | ||
echo "xt_geoip" | tee -a /etc/modules-load.d/modules.conf | ||
|
||
mkdir -p /tmp/geoip | ||
cd /tmp/geoip | ||
|
||
MON=$(date +"%m") | ||
YR=$(date +"%Y") | ||
wget https://download.db-ip.com/free/dbip-country-lite-${YR}-${MON}.csv.gz -O GeoLite2-Country-CSV.zip | ||
|
||
# use this command to unzip that downloaded file to a database directory | ||
/usr/lib/xtables-addons/xt_geoip_dl | ||
|
||
# move to that db dir | ||
dir="$(ls)" | ||
cd $dir | ||
|
||
# compile database and copy to system | ||
mkdir -p /usr/share/xt_geoip | ||
/usr/lib/xtables-addons/xt_geoip_build -D /usr/share/xt_geoip | ||
|
||
cd | ||
rm -rf /tmp/geoip | ||
|