forked from dev-ir/xui-assistant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu.sh
155 lines (125 loc) · 5.59 KB
/
menu.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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[0;33m'
NC='\033[0m' # No Color
[[ $EUID -ne 0 ]] && echo -e "${RED}Fatal error: ${RED} Please run this script with root privilege ${NC} \n " && exit 1
XUI_ASSISTANT_MENU(){
clear
XUI_CORE=$(check_xui_exist)
echo '+--------------------------------------------------------------------------------------------------------------------------------------+'
echo '| Y88b d88P 888 888 8888888 d8888 .d8888b. .d8888b. 8888888 .d8888b. 88888888888 d8888 888b 888 88888888888 |'
echo '| Y88b d88P 888 888 888 d88888 d88P Y88b d88P Y88b 888 d88P Y88b 888 d88888 8888b 888 888 |'
echo '| Y88o88P 888 888 888 d88P888 Y88b. Y88b. 888 Y88b. 888 d88P888 88888b 888 888 |'
echo '| Y888P 888 888 888 d88P 888 "Y888b. "Y888b. 888 "Y888b. 888 d88P 888 888Y88b 888 888 |'
echo '| d888b 888 888 888 d88P 888 "Y88b. "Y88b. 888 "Y88b. 888 d88P 888 888 Y88b888 888 |'
echo '| d88888b 888 888 888 888888 d88P 888 "888 "888 888 "888 888 d88P 888 888 Y88888 888 |'
echo '| d88P Y88b Y88b. .d88P 888 d8888888888 Y88b d88P Y88b d88P 888 Y88b d88P 888 d8888888888 888 Y8888 888 |'
echo '| d88P Y88b "Y88888P" 8888888 d88P 888 "Y8888P" "Y8888P" 8888888 "Y8888P" 888 d88P 888 888 Y888 888 |'
echo '+--------------------------------------------------------------------------------------------------------------------------------------+'
echo -e "| Telegram Channel : ${YELLOW}@DVHOST_CLOUD ${NC} | YouTube : ${RED}youtube.com/@dvhost_cloud${NC} | Version : ${GREEN} 2.0${NC} "
echo '+--------------------------------------------------------------------------------------------------------------------------------------+'
echo -e "|${YELLOW}Please choose an option:${NC}"
echo '+--------------------------------------------------------------------------------------------------------------------------------------+'
echo -e $1
echo '+--------------------------------------------------------------------------------------------------------------------------------------+'
echo -e "\033[0m"
}
# Main menu function
loader() {
XUI_ASSISTANT_MENU "| 1 - Copy Database to Destination VPS\n| 2 - Send Gift to All Clients\n| 3 - User Management\n| 4 - Set Cronjob for Resetting Xray\n| 5 - Fix WhatsApp Time\n| 6 - Install WordPress\n| 7 - Block All Speedtest Requests\n| 8 - XUI Bot (${RED}Multi-Server Support${NC})\n| 9 - Uninstall\n| 0 - Exit"
read -p "| Enter option number: " choice
case $choice in
1) transfer_db ;;
2) gift_user ;;
3) manage_users ;;
4) xray_restart ;;
5) fix_timezone ;;
6) install_wordpress ;;
7) block_speedtest_sites ;;
8) xui_bot ;;
9) uninstall ;;
0) exit_program ;;
*) echo -e "${RED}Invalid option. Try again.${NC}" ;;
esac
}
# Functions
gift_user() {
python3 /root/xui-assistant/core/day_size.py
}
manage_users() {
python3 /root/xui-assistant/core/user_managment.py
}
require_command() {
local repo_url="https://github.com/dev-ir/xui-assistant.git"
local install_dir="/root/xui-assistant"
if [ ! -d "$install_dir" ]; then
echo "Directory $install_dir does not exist. Installing..."
# Check if git is installed
if ! command -v git &>/dev/null; then
echo "Git is not installed. Installing git..."
apt update && apt install -y git
fi
# Clone the repository
echo "Cloning repository..."
git clone "$repo_url" "$install_dir"
else
echo "Directory $install_dir already exists."
fi
}
check_xui_exist() {
local file_path="/etc/x-ui/x-ui.db"
local status
if [ -f "$file_path" ]; then
status="${GREEN}Installed"${NC}
else
status=${RED}"Not installed"${NC}
fi
echo "$status"
}
transfer_db() {
local db_file="/etc/x-ui/x-ui.db"
read -p "Destination SERVER IP (e.g., 127.0.0.1): " dest_ip
read -p "Destination SERVER USER (e.g., root) [default: root]: " dest_user
read -p "Destination SERVER PORT (e.g., 22) [default: 22]: " dest_port
dest_user=${dest_user:-root}
dest_port=${dest_port:-22}
echo "Transferring database..."
scp -P "$dest_port" "$db_file" "$dest_user@$dest_ip:/etc/testfolder"
if [ $? -eq 0 ]; then
echo -e "${GREEN}Transfer completed successfully.${NC}"
else
echo -e "${RED}Transfer failed.${NC}"
fi
}
fix_timezone() {
sudo timedatectl set-timezone UTC
echo -e "${GREEN}Timezone set to UTC.${NC}"
}
install_wordpress() {
bash <(curl -Ls https://raw.githubusercontent.com/dev-ir/WordPress-Installer/master/main.sh)
}
block_speedtest_sites() {
bash <(curl -Ls https://raw.githubusercontent.com/dev-ir/speedtest-ban/master/main.sh)
}
xray_restart() {
wget -q /root/xui-assistant/core/setup_cron.py
python3 setup_cron.py && rm setup_cron.py
}
xui_bot() {
wget -q /root/xui-assistant/core/v2ray_bot.py
python3 v2ray_bot.py && rm v2ray_bot.py
}
uninstall() {
echo -e "${GREEN}Uninstalling XUI-ASSISTANT...${NC}"
rm -rf /root/xui-assistant/
rm -rf /usr/local/bin/xui-assis
echo -e "${RED}XUI-ASSISTANT Uninstalled.${NC}"
}
exit_program() {
echo -e "${GREEN}Exiting program...${NC}"
exit 0
}
# Ensure required commands and run loader
require_command
loader