-
Notifications
You must be signed in to change notification settings - Fork 233
/
wizwiz.sh
371 lines (265 loc) · 13.4 KB
/
wizwiz.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
#!/bin/bash
# Written By: wizwiz
if [ "$(id -u)" -ne 0 ]; then
echo -e "\033[33mPlease run as root\033[0m"
exit
fi
wait
echo -e "\e[32m
██ ██ ██ ███████ ██ ██ ██ ███████ ██ ██ ██ ██ ██
██ ██ ██ ███ ██ ██ ██ ███ ██ ██ ██ ██ ██
██ █ ██ ██ ███ ██ █ ██ ██ ███ ███ ██ ██ ██
██ ███ ██ ██ ███ ██ ███ ██ ██ ███ ██ ██ ██ ██ ██
███ ███ ██ ███████ ███ ███ ██ ███████ ██ ██ ██████ ██
\033[0m"
echo -e " \e[31mTelegram Channel: \e[34m@wizwizch\033[0m | \e[31mTelegram Group: \e[34m@wizwizdev\033[0m\n"
#sleep
echo -e "\e[32mInstalling WizWiz script ... \033[0m\n"
sleep 5
sudo apt update && apt upgrade -y
echo -e "\e[92mThe server was successfully updated ...\033[0m\n"
PKG=(
lamp-server^
libapache2-mod-php
mysql-server
apache2
php-mbstring
php-zip
php-gd
php-json
php-curl
)
for i in "${PKG[@]}"
do
dpkg -s $i &> /dev/null
if [ $? -eq 0 ]; then
echo "$i is already installed"
else
apt install $i -y
if [ $? -ne 0 ]; then
echo "Error installing $i"
exit 1
fi
fi
done
echo -e "\n\e[92mPackages Installed Continuing ...\033[0m\n"
randomdbpasstxt69=$(openssl rand -base64 10 | tr -dc 'a-zA-Z0-9' | cut -c1-20)
echo 'phpmyadmin phpmyadmin/dbconfig-install boolean true' | debconf-set-selections
echo 'phpmyadmin phpmyadmin/app-password-confirm password $randomdbpasstxt69' | debconf-set-selections
echo 'phpmyadmin phpmyadmin/mysql/admin-pass password $randomdbpasstxt69' | debconf-set-selections
echo 'phpmyadmin phpmyadmin/mysql/app-pass password $randomdbpasstxt69' | debconf-set-selections
echo 'phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2' | debconf-set-selections
sudo apt-get install phpmyadmin -y
sudo ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf-available/phpmyadmin.conf
sudo a2enconf phpmyadmin.conf
sudo systemctl restart apache2
wait
sudo apt-get install -y php-soap
sudo apt-get install libapache2-mod-php
sudo systemctl enable mysql.service
sudo systemctl start mysql.service
sudo systemctl enable apache2
sudo systemctl start apache2
echo -e "\n\e[92m Setting Up UFW...\033[0m\n"
ufw allow 'Apache'
sudo systemctl restart apache2
echo -e "\n\e[92mInstalling ...\033[0m\n"
sleep 1
sudo apt-get install -y git
sudo apt-get install -y wget
sudo apt-get install -y unzip
sudo apt install curl -y
sudo apt-get install -y php-ssh2
sudo apt-get install -y libssh2-1-dev libssh2-1
sudo systemctl restart apache2.service
wait
git clone https://github.com/wizwizdev/wizwizxui-timebot.git /var/www/html/wizwizxui-timebot
sudo chown -R www-data:www-data /var/www/html/wizwizxui-timebot/
sudo chmod -R 755 /var/www/html/wizwizxui-timebot/
echo -e "\n\033[33mWizWiz config and script have been installed successfully\033[0m"
wait
RANDOM_CODE=$(LC_CTYPE=C tr -dc 'a-zA-Z0-9' < /dev/urandom | head -c 40)
mkdir "/var/www/html/${RANDOM_CODE}"
echo "Directory created: ${RANDOM_CODE}"
echo "Folder created successfully!"
cd /var/www/html/
wget -O wizwizpanel.zip https://github.com/wizwizdev/wizwizxui-timebot/releases/download/10.2.5/wizwizpanel.zip
file_to_transfer="/var/www/html/wizwizpanel.zip"
destination_dir=$(find /var/www/html -type d -name "*${RANDOM_CODE}*" -print -quit)
if [ -z "$destination_dir" ]; then
echo "Error: Could not find directory containing 'wiz' in '/var/www/html'"
exit 1
fi
mv "$file_to_transfer" "$destination_dir/" && yes | unzip "$destination_dir/wizwizpanel.zip" -d "$destination_dir/" && rm "$destination_dir/wizwizpanel.zip" && sudo chmod -R 755 "$destination_dir/" && sudo chown -R www-data:www-data "$destination_dir/"
wait
if [ ! -d "/root/confwizwiz" ]; then
sudo mkdir /root/confwizwiz
sleep 1
touch /root/confwizwiz/dbrootwizwiz.txt
sudo chmod -R 777 /root/confwizwiz/dbrootwizwiz.txt
sleep 1
randomdbpasstxt=$(openssl rand -base64 10 | tr -dc 'a-zA-Z0-9' | cut -c1-30)
ASAS="$"
echo "${ASAS}user = 'root';" >> /root/confwizwiz/dbrootwizwiz.txt
echo "${ASAS}pass = '${randomdbpasstxt}';" >> /root/confwizwiz/dbrootwizwiz.txt
#echo "${ASAS}paths = '${RANDOM_CODE}';" >> /root/confwizwiz/dbrootwizwiz.txt
sleep 1
passs=$(cat /root/confwizwiz/dbrootwizwiz.txt | grep '$pass' | cut -d"'" -f2)
userrr=$(cat /root/confwizwiz/dbrootwizwiz.txt | grep '$user' | cut -d"'" -f2)
sudo mysql -u $userrr -p$passs -e "alter user '$userrr'@'localhost' identified with mysql_native_password by '$passs';FLUSH PRIVILEGES;"
echo "SELECT 1" | mysql -u$userrr -p$passs 2>/dev/null
echo "Folder created successfully!"
else
echo "Folder already exists."
fi
clear
echo " "
echo -e "\e[32m
██ ██ ██ ███████ ██ ██ ██ ███████ ███████ ███████ ██
██ ██ ██ ███ ██ ██ ██ ███ ██ ██ ██
██ █ ██ ██ ███ ██ █ ██ ██ ███ ███████ ███████ ██
██ ███ ██ ██ ███ ██ ███ ██ ██ ███ ██ ██ ██
███ ███ ██ ███████ ███ ███ ██ ███████ ███████ ███████ ███████
\033[0m\n"
read -p "Enter the domain: " domainname
if [ "$domainname" = "" ]; then
echo -e "\n\033[91mPlease wait ...\033[0m\n"
sleep 3
echo -e "\e[36mNothing was registered for the domain.\033[0m\n"
echo -e "\n\033[0m Good Luck Baby\n"
else
# variables
DOMAIN_NAME="$domainname"
# WILDCARD_DOMAIN="*.$wildcarddomain"
# update cron
PATHS=$(cat /root/confwizwiz/dbrootwizwiz.txt | grep '$path' | cut -d"'" -f2)
(crontab -l ; echo "* * * * * curl https://${DOMAIN_NAME}/wizwizxui-timebot/settings/messagewizwiz.php >/dev/null 2>&1") | sort - | uniq - | crontab -
(crontab -l ; echo "* * * * * curl https://${DOMAIN_NAME}/wizwizxui-timebot/settings/rewardReport.php >/dev/null 2>&1") | sort - | uniq - | crontab -
(crontab -l ; echo "* * * * * curl https://${DOMAIN_NAME}/wizwizxui-timebot/settings/warnusers.php >/dev/null 2>&1") | sort - | uniq - | crontab -
(crontab -l ; echo "* * * * * curl https://${DOMAIN_NAME}/wizwizxui-timebot/settings/gift2all.php >/dev/null 2>&1") | sort - | uniq - | crontab -
(crontab -l ; echo "*/3 * * * * curl https://${DOMAIN_NAME}/wizwizxui-timebot/settings/tronChecker.php >/dev/null 2>&1") | sort - | uniq - | crontab -
(crontab -l ; echo "* * * * * curl https://${DOMAIN_NAME}/${PATHS}/backupnutif.php >/dev/null 2>&1") | sort - | uniq - | crontab -
echo -e "\n\e[92m Setting Up Cron...\033[0m\n"
# Allow HTTP and HTTPS traffic
echo -e "\n\033[1;7;31mAllowing HTTP and HTTPS traffic...\033[0m\n"
sudo ufw allow 80
sudo ufw allow 443
# Let's Encrypt
echo -e "\n\033[1;7;32mInstalling Let's Encrypt...\033[0m\n"
sudo apt install letsencrypt -y
# automatic certificate renewal
echo -e "\n\033[1;7;33mEnabling automatic certificate renewal...\033[0m\n"
sudo systemctl enable certbot.timer
# SSL certificate using standalone mode
echo -e "\n\033[1;7;34mObtaining SSL certificate using standalone mode...\033[0m\n"
sudo certbot certonly --standalone --agree-tos --preferred-challenges http -d $DOMAIN_NAME
# Certbot Apache plugin
echo -e "\n\033[1;7;35mInstalling Certbot Apache plugin...\033[0m\n"
sudo apt install python3-certbot-apache -y
# SSL certificate using Apache plugin
echo -e "\n\033[1;7;36mObtaining SSL certificate using Apache plugin...\033[0m\n"
sudo certbot --apache --agree-tos --preferred-challenges http -d $DOMAIN_NAME
# echo -e "\n\033[1;7;33mObtaining SSL certificate using manual DNS mode (wildcard)...\033[0m\n"
# sudo certbot certonly --manual --agree-tos --preferred-challenges dns -d $DOMAIN_NAME -d $WILDCARD_DOMAIN
echo -e "\e[32m======================================"
echo -e "SSL certificate obtained successfully!"
echo -e "======================================\033[0m"
wait
echo " "
ROOT_PASSWORD=$(cat /root/confwizwiz/dbrootwizwiz.txt | grep '$pass' | cut -d"'" -f2)
ROOT_USER="root"
echo "SELECT 1" | mysql -u$ROOT_USER -p$ROOT_PASSWORD 2>/dev/null
if [ $? -eq 0 ]; then
wait
randomdbpass=$(openssl rand -base64 10 | tr -dc 'a-zA-Z0-9' | cut -c1-22)
randomdbdb=$(openssl rand -base64 10 | tr -dc 'a-zA-Z0-9' | cut -c1-22)
if [[ $(mysql -u root -p$ROOT_PASSWORD -e "SHOW DATABASES LIKE 'wizwiz'") ]]; then
clear
echo -e "\n\e[91mYou have already created the database\033[0m\n"
else
dbname=wizwiz
clear
echo -e "\n\e[32mPlease enter the database username!\033[0m"
printf "[+] Default user name is \e[91m${randomdbdb}\e[0m ( let it blank to use this user name ): "
read dbuser
if [ "$dbuser" = "" ]; then
dbuser=$randomdbdb
fi
echo -e "\n\e[32mPlease enter the database password!\033[0m"
printf "[+] Default user name is \e[91m${randomdbpass}\e[0m ( let it blank to use this user name ): "
read dbpass
if [ "$dbpass" = "" ]; then
dbpass=$randomdbpass
fi
mysql -u root -p$ROOT_PASSWORD -e "CREATE DATABASE $dbname;" -e "CREATE USER '$dbuser'@'%' IDENTIFIED WITH mysql_native_password BY '$dbpass';GRANT ALL PRIVILEGES ON * . * TO '$dbuser'@'%';FLUSH PRIVILEGES;" -e "CREATE USER '$dbuser'@'localhost' IDENTIFIED WITH mysql_native_password BY '$dbpass';GRANT ALL PRIVILEGES ON * . * TO '$dbuser'@'localhost';FLUSH PRIVILEGES;"
echo -e "\n\e[95mDatabase Created.\033[0m"
wait
printf "\n\e[33m[+] \e[36mBot Token: \033[0m"
read YOUR_BOT_TOKEN
printf "\e[33m[+] \e[36mChat id: \033[0m"
read YOUR_CHAT_ID
printf "\e[33m[+] \e[36mDomain: \033[0m"
read YOUR_DOMAIN
echo " "
if [ "$YOUR_BOT_TOKEN" = "" ] || [ "$YOUR_DOMAIN" = "" ] || [ "$YOUR_CHAT_ID" = "" ]; then
exit
fi
ASAS="$"
wait
sleep 1
file_path="/var/www/html/wizwizxui-timebot/baseInfo.php"
if [ -f "$file_path" ]; then
rm "$file_path"
echo -e "File deleted successfully."
else
echo -e "File not found."
fi
sleep 2
# print file
echo -e "<?php" >> /var/www/html/wizwizxui-timebot/baseInfo.php
echo -e "error_reporting(0);" >> /var/www/html/wizwizxui-timebot/baseInfo.php
echo -e "${ASAS}botToken = '${YOUR_BOT_TOKEN}';" >> /var/www/html/wizwizxui-timebot/baseInfo.php
echo -e "${ASAS}dbUserName = '${dbuser}';" >> /var/www/html/wizwizxui-timebot/baseInfo.php
echo -e "${ASAS}dbPassword = '${dbpass}';" >> /var/www/html/wizwizxui-timebot/baseInfo.php
echo -e "${ASAS}dbName = '${dbname}';" >> /var/www/html/wizwizxui-timebot/baseInfo.php
echo -e "${ASAS}botUrl = 'https://${YOUR_DOMAIN}/wizwizxui-timebot/';" >> /var/www/html/wizwizxui-timebot/baseInfo.php
echo -e "${ASAS}admin = ${YOUR_CHAT_ID};" >> /var/www/html/wizwizxui-timebot/baseInfo.php
echo -e "?>" >> /var/www/html/wizwizxui-timebot/baseInfo.php
sleep 1
curl -F "url=https://${YOUR_DOMAIN}/wizwizxui-timebot/bot.php" "https://api.telegram.org/bot${YOUR_BOT_TOKEN}/setWebhook"
MESSAGE="✅ The wizwiz bot has been successfully installed! @wizwizch"
curl -s -X POST "https://api.telegram.org/bot${YOUR_BOT_TOKEN}/sendMessage" -d chat_id="${YOUR_CHAT_ID}" -d text="$MESSAGE"
sleep 1
url="https://${YOUR_DOMAIN}/wizwizxui-timebot/createDB.php"
curl $url
sleep 1
sudo rm -r /var/www/html/wizwizxui-timebot/webpanel
sudo rm -r /var/www/html/wizwizxui-timebot/install
sudo rm /var/www/html/wizwizxui-timebot/createDB.php
rm /var/www/html/wizwizxui-timebot/updateShareConfig.php
rm /var/www/html/wizwizxui-timebot/README.md
rm /var/www/html/wizwizxui-timebot/README-fa.md
rm /var/www/html/wizwizxui-timebot/LICENSE
rm /var/www/html/wizwizxui-timebot/update.sh
rm /var/www/html/wizwizxui-timebot/wizwiz.sh
rm /var/www/html/wizwizxui-timebot/tempCookie.txt
rm /var/www/html/wizwizxui-timebot/settings/messagewizwiz.json
clear
echo " "
echo -e "\e[100mDatabase information:\033[0m"
echo -e "\e[33maddres: \e[36mhttps://${YOUR_DOMAIN}/phpmyadmin\033[0m"
echo -e "\e[33mDatabase name: \e[36m${dbname}\033[0m"
echo -e "\e[33mDatabase username: \e[36m${dbuser}\033[0m"
echo -e "\e[33mDatabase password: \e[36m${dbpass}\033[0m"
echo " "
echo -e "\e[100mwizwiz panel:\033[0m"
echo -e "\e[33maddres: \e[36mhttps://${YOUR_DOMAIN}/${RANDOM_CODE}/login.php\033[0m"
echo " "
echo -e "Good Luck Baby! \e[94mThis project is for free. If you like it, be sure to donate me :) , so let's go \033[0m\n"
fi
elif [ "$ROOT_PASSWORD" = "" ] || [ "$ROOT_USER" = "" ]; then
echo -e "\n\e[36mThe password is empty.\033[0m\n"
else
echo -e "\n\e[36mThe password is not correct.\033[0m\n"
fi
fi