Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
aliione committed Aug 2, 2023
2 parents d44e876 + 662dbe5 commit 54ad5c2
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 13 deletions.
19 changes: 10 additions & 9 deletions block_iran.sh
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"
14 changes: 11 additions & 3 deletions cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ function show_menu() {
echo "5. Remove XPanel"
echo "6. Remove All Admin XPanel"
echo "7. Change Banner Text"
echo "8. Exit"
echo "8. Blocked Port 80 and 443 IRAN"
echo "9. UnBlock Port 80 and 443 IRAN"
echo "10. Exit"
}

# Function to select an option
Expand Down Expand Up @@ -98,7 +100,7 @@ connect = 0.0.0.0:$sshport
reboot
;;
4)
bash <(curl -Ls https://raw.githubusercontent.com/Alirezad07/X-Panel-SSH-User-Management/main/install.sh --ipv4)
bash <(curl -Ls https://github.com/xpanel-cp/XPanel-SSH-User-Management/raw/master/install.sh --ipv4)
;;
5)
echo "You accept the risk of removing the panel (y/n)"
Expand All @@ -124,7 +126,13 @@ cat << EOF > /root/banner.txt
$banner
EOF
;;
8)
8)
bash <(curl -Ls https://github.com/xpanel-cp/XPanel-SSH-User-Management/raw/master/block_iran.sh --ipv4)
;;
9)
sudo iptables -F
;;
10)
echo "Exiting the menu."
exit 0
;;
Expand Down
7 changes: 7 additions & 0 deletions geo-update.sh
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
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,7 @@ wait
systemctl restart stunnel4 &
wait
curl -o /root/xpanel.sh https://raw.githubusercontent.com/xpanel-cp/XPanel-SSH-User-Management/master/cli.sh

chown www-data:www-data /var/www/html/example/index.php
clear

echo -e "************ XPanel ************ \n"
Expand Down
29 changes: 29 additions & 0 deletions t2.shh
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

0 comments on commit 54ad5c2

Please sign in to comment.