-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextremeDOT.sh
1870 lines (1653 loc) · 50.8 KB
/
extremeDOT.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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
#EXTREME DOT GL1MENU
scriptVersion=1.33
echo "nameserver 8.8.8.8" > /etc/resolv.conf
# root checker
function isRoot() {
if [ "$EUID" -ne 0 ]; then
return 1
fi
}
# IS root access?
if ! isRoot; then
echo "Sorry, you need to run this as root"
exit 1
fi
apt --fix-broken install
# Load Colors
function colorScript() {
mkdir -p /Golden1/
touch /Golden1/defaults.sh
cat <<EOF > /Golden1/defaults.sh
RED='\033[0;31m' # Red
BLUE='\033[1;34m' # LIGHTBLUE
GREEN='\033[0;32m' # Green
NC='\033[0m' # No Color
HOST_PING=8.8.8.8
PINGTXT1=\`echo "-- PING Check: -----------------------------------------------" | cut -c 1-45\`
INTFTXT1=\`echo "-- INTERFACE Check: -----------------------------------------------" | cut -c 1-45\`
EOF
# COLOR SCRIPTING
YELLOW='\033[0;33m' # YELLOW
RED='\033[0;31m' # Red
BLUE='\033[1;34m' # LIGHTBLUE
GREEN='\033[0;32m' # Green
NC='\033[0m' # No Color
red(){
echo -e "\033[31m\033[01m$1\033[0m"
}
green(){
echo -e "\033[32m\033[01m$1\033[0m"
}
yellow(){
echo -e "\033[33m\033[01m$1\033[0m"
}
blue(){
echo -e "\033[34m\033[01m$1\033[0m"
}
bold(){
echo -e "\033[1m\033[01m$1\033[0m"
}
Green_font_prefix="\033[32m"
Red_font_prefix="\033[31m"
Green_background_prefix="\033[42;37m"
Red_background_prefix="\033[41;37m"
Font_color_suffix="\033[0m"
}
# Installing Tools
function installTools() {
echo "nameserver 8.8.8.8" > /etc/resolv.conf
# get apt updates
apt-get updates
echo "nameserver 8.8.8.8" > /etc/resolv.conf
# installing lsof
if [ $(dpkg-query -W -f='${Status}' lsof 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
yellow "Installing lsof"
apt install -y lsof
else
green "lsof has installed"
fi
echo "nameserver 8.8.8.8" > /etc/resolv.conf
# installing shadowsocks-libev
if [ $(dpkg-query -W -f='${Status}' shadowsocks-libev 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
yellow "Installing shadowsocks-libev"
apt install -y shadowsocks-libev
else
green "shadowsocks-libev has installed"
fi
echo "nameserver 8.8.8.8" > /etc/resolv.conf
# installing iptables-persistent
if [ $(dpkg-query -W -f='${Status}' iptables-persistent 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
yellow "Installing iptables-persistent"
apt install -y iptables-persistent
else
green "iptables-persistent has installed"
fi
echo "nameserver 8.8.8.8" > /etc/resolv.conf
if [ $(dpkg-query -W -f='${Status}' crontab 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
yellow "Installing cron services"
apt-get install cron
else
green "cron service has allready installed"
fi
echo "nameserver 8.8.8.8" > /etc/resolv.conf
# installing unzip
if [ $(dpkg-query -W -f='${Status}' unzip 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
yellow "Installing unzip"
apt install -y unzip
else
green "unzip has installed"
fi
echo "nameserver 8.8.8.8" > /etc/resolv.conf
# installing socat
if [ $(dpkg-query -W -f='${Status}' socat 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
yellow "Installing socat"
apt install -y socat
else
green "socat has installed"
fi
echo "nameserver 8.8.8.8" > /etc/resolv.conf
# installing curl
if [ $(dpkg-query -W -f='${Status}' curl 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
yellow "Installing curl"
apt install -y curl
else
green "curl has installed"
fi
echo "nameserver 8.8.8.8" > /etc/resolv.conf
# installing sshpass
if [ $(dpkg-query -W -f='${Status}' sshpass 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
yellow "Installing sshpass"
apt install -y sshpass
else
green "sshpass has installed"
fi
echo "nameserver 8.8.8.8" > /etc/resolv.conf
# installing dnsutils
if [ $(dpkg-query -W -f='${Status}' dnsutils 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
yellow "Installing dnsutils"
apt install -y dnsutils
else
green "dnsutils has installed"
fi
echo "nameserver 8.8.8.8" > /etc/resolv.conf
# installing mc
if [ $(dpkg-query -W -f='${Status}' mc 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
yellow "Installing mc file explorer"
apt install -y mc
else
green "mc has installed"
fi
echo "nameserver 8.8.8.8" > /etc/resolv.conf
if [ $(dpkg-query -W -f='${Status}' net-tools 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
yellow "Installing net tools package"
apt install -y net-tools
else
green "net tools has installed allready"
fi
echo "nameserver 8.8.8.8" > /etc/resolv.conf
if [ $(dpkg-query -W -f='${Status}' ifupdown 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
yellow "Installing ifupdown package"
apt-get install -y ifupdown
else
green "ifupdown has installed allready"
fi
}
# OLD SERVER GET DATA HELPER
function oLDInfo() {
green "Please Enter OLD SERVER information here"
echo
read -e -i "$OLD_IPv4" -p "OLD SERVER: Please input PUBLIC IP v4: " input
OLD_IPv4="${input:-$OLD_IPv4}"
read -e -i "$OLD_LOGINNAME" -p "OLD SERVER: Please input Login Username: " input
OLD_LOGINNAME="${input:-$OLD_LOGINNAME}"
read -e -i "$OLD_PASSWORD" -p "OLD SERVER: Please input Login Password: " input
OLD_PASSWORD="${input:-$OLD_PASSWORD}"
getOldServerData
}
# OLD SERVER GET DATA
function getOldServerData() {
if [[ -z $OLD_IPv4 || -z $OLD_LOGINNAME || -z $OLD_PASSWORD ]]; then #INFORMATION IS NOT CORRECT
red "OLD SERVER: ERROR getting DATA"; echo
oLDInfo
else
echo
yellow "OLD SERVER INFORMATION ---------"
green "IP=[$OLD_IPv4]"
green "USER=[$OLD_LOGINNAME]"
green "PASS=[$OLD_PASSWORD] "
OLD_SETUP=""
until [[ $OLD_SETUP =~ (y|n) ]]; do
read -rp "OLD SERVER: Confirm OLD Server Information? [y/n]: " -e -i y OLD_SETUP
done
if [[ $OLD_SETUP == "n" ]]; then
yellow "Setting New Values for OLD SERVER"
oLDInfo
fi; fi
}
# NEW SERVER GET DATA HELPER
function nEWInfo() {
NEW_PASSWORD="$OLD_PASSWORD"
echo "Please Enter NEW SERVER information here"
echo
read -e -i "$NEW_IPv4" -p "NEW SERVER: Please input PUBLIC IP v4: " input
NEW_IPv4="${input:-$NEW_IPv4}"
read -e -i "$NEW_LOGINNAME" -p "NEW SERVER: Please input Login Username: " input
NEW_LOGINNAME="${input:-$NEW_LOGINNAME}"
read -e -i "$NEW_PASSWORD" -p "NEW SERVER: Please input Login Password: " input
NEW_PASSWORD="${input:-$NEW_PASSWORD}"
getNewServerData
}
# NEW SERVER GET DATA
function getNewServerData() {
if [[ -z $NEW_IPv4 || -z $NEW_LOGINNAME || -z $NEW_PASSWORD ]]; then #INFORMATION IS NOT CORRECT
red "NEW SERVER: ERROR getting DATA"; echo
nEWInfo
else
echo
yellow "NEW SERVER INFORMATION ---------"
green "IP=[$NEW_IPv4]"
green "USER=[$NEW_LOGINNAME]"
green "PASS=[$NEW_PASSWORD] "
NEW_SETUP=""
until [[ $NEW_SETUP =~ (y|n) ]]; do
read -rp "NEW SERVER: Confirm NEW Server Information? [y/n]: " -e -i y NEW_SETUP
done
if [[ $NEW_SETUP == "n" ]]; then
green "Setting New Values for NEW SERVER"
nEWInfo
fi; fi
}
# DOMAIN CHECK HELPER
function getDomainInfoHelper() {
echo; red "NEW SERVER: ERROR getting DOMAIN name"; echo
read -e -i "$DOMAIN_ADDRESS" -p "NEW SERVER: Please enter damain address: " input
DOMAIN_ADDRESS="${input:-$DOMAIN_ADDRESS}"
getDomainInfo
}
# DOMAIN CHECK
function getDomainInfo() {
green "New Server Domain Check"; echo
if [[ -z $DOMAIN_ADDRESS ]]; then #DOMAIN ADDRESS IS NOT ENTERED
getDomainInfoHelper
else
if [[ $DOMAINANMES == "n" ]]; then
yellow "Specify Domain Name"
getDomainInfoHelper
fi; fi
}
# EMAIL CHECK HELPER
function getEmailInfoHelper() {
echo; red "NEW SERVER: ERROR getting E-MAIL Address"; echo
read -e -i "$EMAIL_ADDRESS" -p "NEW SERVER: Please enter E-MAIL address: " input
EMAIL_ADDRESS="${input:-$EMAIL_ADDRESS}"
getEmailInfo
}
# EMAIL CHECK
function getEmailInfo() {
green "New Server Email Address Check"; echo
if [[ -z $EMAIL_ADDRESS ]]; then #E-MAIL ADDRESS IS NOT ENTERED
getEmailInfoHelper
else
if [[ $EMAILANMES == "n" ]]; then
yellow "Specify E-MAIL ADDRESS"
getEmailInfoHelper
fi; fi
}
# CHECK DOMAIN NAME WITH IP
function checkDomainNamewithIP() {
echo
green "$DOMAIN_ADDRESS IP must be $NEW_IPv4, now check the ip of domain!"
echo
green "Checking IP for $DOMAIN_ADDRESS"
IPCHECKNEWDOMAIN=`dig +short $DOMAIN_ADDRESS` && sleep 1
DOMCHECKS=""
until [[ $DOMCHECKS =~ (y|n) ]]; do
read -rp "[$IPCHECKNEWDOMAIN] is set to [$DOMAIN_ADDRESS], is Correct? [y/n]: " -e -i y DOMCHECKS
done
if [[ $DOMCHECKS == "n" ]]; then
red "Setup proccess is paused now"
yellow "goto Cloudflare dashboard and set [$NEW_IPv4] IP for [$DOMAIN_ADDRESS]"
yellow "don't forget to Set to \"DNS ONLY\" "
echo
green "when you change the domain to new ip , press Enter to continue"
DOMCHECKS2=""
until [[ $DOMCHECKS2 =~ (y|n) ]]; do
read -rp "Have you updated Domain Settings to New Server's IP? [y/n]: " -e -i y DOMCHECKS2
done
if [[ $DOMCHECKS2 == "n" ]]; then
checkDomainNamewithIP
fi; fi
}
# CHECK CURRENT VPS IS NEW OR OLD SERVER, depends on OLD SERVER GET DATA and NEW SERVER GET DATA functions are running before.
function vpsDetectionByIP() {
# VPSMACHINE can be set as NEW,OLD or UNKNOWN
CURRENTPUBIP=`curl --silent -4 icanhazip.com`
#$NEW_IPv4 #$OLD_IPv4
if [[ $CURRENTPUBIP == $NEW_IPv4 ]]; then
echo "Its NEW Server VPS"
VPSMACHINE=NEW
else if [[ $CURRENTPUBIP == $OLD_IPv4 ]]; then
echo "Its OLD Server VPS"
VPSMACHINE=OLD
else
echo "ERROR, Can't reconize "
VPSMACHINE=UNKNOWN
fi; fi
}
# ipv6 Enabler
function ipv6Enabler() {
echo
green "IPv6 Disable or Enabler"
yellow "Enter 0 to Disable IPv6"
yellow "Enter 1 to Enable IPv6"
until [[ $IPV6ABLE =~ (0|1) ]]; do
read -rp "Enter 0 to Disable or 1 to Enable ! [0 or 1]: " -e IPV6ABLE
done
if [[ $IPV6ABLE == "1" ]]; then
green "Enabling IPV6 Support"
if [[ $(sysctl -a | grep 'disable_ipv6.*=.*1') || $(cat /etc/sysctl.{conf,d/*} | grep 'disable_ipv6.*=.*1') ]]; then
sed -i '/disable_ipv6/d' /etc/sysctl.{conf,d/*}
echo 'net.ipv6.conf.all.disable_ipv6 = 0' >/etc/sysctl.d/ipv6.conf
sysctl -w net.ipv6.conf.all.disable_ipv6=0
fi
sleep 1
elif [[ $IPV6ABLE == "0" ]]; then
green "Disabling IPV6 Support"
if [[ $(sysctl -a | grep 'disable_ipv6.*=.*0') || $(cat /etc/sysctl.{conf,d/*} | grep 'disable_ipv6.*=.*0') ]]; then
sed -i '/disable_ipv6/d' /etc/sysctl.{conf,d/*}
echo 'net.ipv6.conf.all.disable_ipv6 = 1' >/etc/sysctl.d/ipv6.conf
sysctl -w net.ipv6.conf.all.disable_ipv6=1
fi
fi
}
# Install XanMoD Kernl
function installXanModKernel() {
clear && echo
green "Installing XanMod Kernel"
echo -e "${GREEN}"
echo "What XanMod Kernel Version want to install? "
echo " 1) Stable XanMod Kernel Release"
echo " 2) Latest Kernel XanMod EDGE (recommended for the latest kernel)"
echo " 3) XanMod LTS (Kernel 5.15 LTS) "
echo -e "${GREEN}"
echo
until [[ $KERNINSTAL =~ ^[0-3]+$ ]] && [ "$KERNINSTAL" -ge 1 ] && [ "$KERNINSTAL" -le 3 ]; do
read -rp "KERNINSTAL [1-3]: " -e -i 2 KERNINSTAL
done
echo
green "Downloading the XanMod repository files..."
curl -fSsL https://dl.xanmod.org/gpg.key | gpg --dearmor | tee /usr/share/keyrings/xanmod.gpg > /dev/null && sleep 1
echo 'deb [signed-by=/usr/share/keyrings/xanmod.gpg] http://deb.xanmod.org releases main' | tee /etc/apt/sources.list.d/xanmod-kernel.list && sleep 1
grep xanmod /etc/apt/sources.list.d/xanmod-kernel.list && sleep 1
echo
green "Updating System... starting."
apt-get -y update
apt -y upgrade
echo
green "Updating System... finished."
case $KERNINSTAL in
1) # Stable XanMod Kernel Release
echo && echo "Stable XanMod Kernel Install.."
apt install linux-xanmod
;;
2) # Latest Kernel XanMod EDGE
echo && echo "Latest Kernel XanMod EDGE Install.."
apt install linux-xanmod-edge
;;
3) # XanMod LTS
echo && echo "XanMod LTS Install.."
apt install linux-xanmod-lts
echo -e "${GREEN}"
;;
esac
echo
green "Kernel has installed ..."
echo
apt install -y intel-microcode iucode-tool
}
# Installing ACME Certificate Generator
function acmeInstaller() {
green "ACME Certificate Installer"
if [[ -z $EMAIL_ADDRESS || -z $DOMAIN_ADDRESS ]]; then #INFORMATION IS NOT CORRECT
red "No DOMAIN and E-MAIL address has defined."
red "Please Define Email address and Domain name by choosing \"7) Input Domain and Email Address\" ,then run it again."
echo
green "back to main menu"
enter2main
else
echo
green "Email Address: [$EMAIL_ADDRESS]"
green "Domain Name: [$DOMAIN_ADDRESS]"
echo
until [[ $confirmAddresses =~ (y|n) ]]; do
read -rp "Domain name and Email Address are correct? [y/n]: " -e -i y confirmAddresses
done
if [[ $confirmAddresses == "n" ]]; then
green "back to main menu"
enter2main
fi
fi
echo && green "Installing ACME certificate tool"
ufw allow https
ufw allow http
ufw allow 443
ufw allow 80
curl https://get.acme.sh | sh
sleep 1
~/.acme.sh/acme.sh --set-default-ca --server letsencrypt
sleep 1
~/.acme.sh/acme.sh --register-account -m $EMAIL_ADDRESS
sleep 1
~/.acme.sh/acme.sh --issue -d $DOMAIN_ADDRESS --standalone
sleep 1
~/.acme.sh/acme.sh --installcert -d $DOMAIN_ADDRESS --key-file /root/private.key --fullchain-file /root/cert.crt
echo
green "Certfiles are installed and copied to :"
echo
blue "/root/cert.crt"
blue "/root/private.key"
echo
}
# Installing BBR Function
function bbrEnabler() {
green "Enabling BBR?"
red "If you have installed XANMOD kernel, please don't install and Skip this installation"
until [[ $BBREANBLE =~ (y|n) ]]; do
read -rp "Enable BBR? [y/n]: " -e -i n BBREANBLE
done
if [[ $BBREANBLE == "y" ]]; then
echo "Enabling BBR "
yellow "Enable BBR acceleration"
echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sleep 1
sysctl -p
else
sleep 1
echo "Skip Enable BBR Service"
fi
}
# Install Vaxilu X-UI V2ray Panel
function vaxiluv2rayInstaller() {
echo
until [[ $vaxiluInstallerAsk =~ (y|n) ]]; do
read -rp "Installing Vaxilu X-UI Panel? [y/n]: " -e -i y vaxiluInstallerAsk
done
if [[ $vaxiluInstallerAsk == "y" ]]; then
bash <(curl -Ls https://raw.githubusercontent.com/vaxilu/x-ui/master/install.sh)
fi
}
# Install Niduka X-UI V2ray Panel
function nidukav2rayInstaller() {
green "Niduka Akalanka X-UI Panel Installer"
red "its based on ENGLISH X-UI and is different from X-UI vaxilu panels."
echo
until [[ $nidukaInstallerAsk =~ (y|n) ]]; do
read -rp "Installing Niduka English X-UI Panel? [y/n]: " -e -i y nidukaInstallerAsk
done
if [[ $nidukaInstallerAsk == "y" ]]; then
bash <(curl -Ls https://raw.githubusercontent.com/NidukaAkalanka/x-ui-english/master/install.sh)
fi
}
# Install ProxyKing X-UI V2ray Panel
function proxyKingV2rayInstaller() {
green "ProxyKing X-UI Panel Installer"
yellow "its translated ENGLISH version of Vaxilu X-UI panel."
echo
until [[ $proxyKingV2rayAsk =~ (y|n) ]]; do
read -rp "Installing ProxyKing's English Translated Vaxilu based X-UI Panel? [y/n]: " -e -i y proxyKingV2rayAsk
done
if [[ $proxyKingV2rayAsk == "y" ]]; then
mkdir -p /tmp/v2Server && cd /tmp/v2Server
wget --no-check-certificate -O install https://raw.githubusercontent.com/proxykingdev/x-ui/master/install
sleep 1 && chmod +x install
/tmp/v2Server/./install
fi
}
# Install HAMED AP X-UI V2ray Panel
function hamedAPv2rayInstaller() {
green "HamedAP X-UI Panel Installer"
red "its based on ENGLISH X-UI and is different from X-UI vaxilu panels."
echo
until [[ $HAPV2rayAsk =~ (y|n) ]]; do
read -rp "Installing ProxyKing's English Translated Vaxilu based X-UI Panel? [y/n]: " -e -i y HAPV2rayAsk
done
if [[ $HAPV2rayAsk == "y" ]]; then
bash <(curl -Ls https://raw.githubusercontent.com/HamedAp/x-ui-Persian/master/install.sh)
fi
}
# Install V2RAy-AGENT ENGLISH
function extremeDotV2RAInstaller() {
green "English v2ray agent script"
yellow "its translated ENGLISH version of mack-a v2ray-agent script."
echo
until [[ $extremeDotv2rayAgentAsk =~ (y|n) ]]; do
read -rp "Installing ExtremeDot V2ray-Agent ? [y/n]: " -e -i y extremeDotv2rayAgentAsk
done
if [[ $extremeDotv2rayAgentAsk == "y" ]]; then
mkdir -p /tmp/v2Server && cd /tmp/v2Server
wget -P /root -N --no-check-certificate "https://raw.githubusercontent.com/ExtremeDot/v2ray-agent/EnglishVersion/en-install.sh" && chmod 700 /root/en-install.sh
mv /root/en-install.sh /root/install.sh
bash /root/install.sh
fi
echo
green "run \"vasma\" to start "
}
function enter2main() {
read -p "Press enter to back to menu"
mainMenuRun
}
function firewallEnabler() {
echo
if [ $(dpkg-query -W -f='${Status}' ufw 2>/dev/null | grep -c "ok installed") -eq 0 ];
then
green "Installing Firewall"
apt-get update
apt install -y ufw
green "Firewall is installed " ;
else
green "Firewall has installed allready.." ;
fi
FWREADSTAT=`ufw status | grep Status | cut -c 9-14`
if [[ $FWREADSTAT == "inacti" ]]; then
green "Firewall is Disabled, Do you want to Enable it?"
FIREWALLINS2=""
until [[ $FIREWALLINS2 =~ (y|n) ]]; do
read -rp "Enable Firewall? [y/n]: " -e -i y FIREWALLINS2
done
if [[ $FIREWALLINS2 == "y" ]]; then
echo
green "Please enter the Port number for ADMIN Panel"
echo
read -e -i "$PANELPORT" -p "please Enter X-UI Panel Port: " input
PANELPORT="${input:-$PANELPORT}"
echo
yellow " Please enter the STARTING Port number for Users over v2ray Panel"
echo
read -e -i "$FIREWALLSTART" -p "Please Enter STARTING Port for users: " input
FIREWALLSTART="${input:-$FIREWALLSTART}"
echo
yellow " Please enter the ENDING Port number for Users over v2ray Panel"
read -e -i "$FIREWALLSTOP" -p "Please Enter ENDING Port for users: " input
FIREWALLSTOP="${input:-$FIREWALLSTOP}"
echo
green "Open ports for ssh, http and https access."
ufw allow http
ufw allow https
ufw allow ssh
echo
green "Firewall Opened Port for X-UI admin panel on $PANELPORT port."
echo
ufw allow $PANELPORT
sleep 1
green "Firewall Opened Ports from $FIREWALLSTART to $FIREWALLSTOP for Users access."
ufw allow $FIREWALLSTART:$FIREWALLSTOP/tcp
sleep 1
ufw allow $FIREWALLSTART:$FIREWALLSTOP/udp
sleep
green "Enabling Firewall"
ufw enable
echo
green " you can disable or enable firewall using commands:"
blue " ufw enable"
red " ufw disable"
fi
elif [[ $FWREADSTAT == "active" ]]; then
green "Firewall is Enabled, Do you want to Disable it?"
FIREWALLINS3=""
read -rp "Disable Firewall? [y/n]: " -e -i y FIREWALLINS3
if [[ $FIREWALLINS3 == "y" ]]; then
ufw disable
green "Firewall has Disabled"
fi
fi
}
function xuiMigrator() {
if [[ $VPSMACHINE == "OLD" ]]; then
red "OLD SERVER has Detected!"; echo
red "PLEASE RUN SCRIPT OVER NEW SERVER"
red "E X I T "
echo
elif [[ $VPSMACHINE == "NEW" ]]; then
yellow "New SERVER is Detected!"; echo
echo
green "Check if data are available?"
#Check OLD SERER DATA
if [[ -z $OLD_IPv4 || -z $OLD_LOGINNAME || -z $OLD_PASSWORD ]]; then #INFORMATION IS NOT CORRECT
red "OLD SERVER DATA has not found, please set data for OLD Server "
red "Back to main menu"
sleep 5 && mainMenuRun
else
green "OLD SERVER DATA has found."
fi
#Check NEW SERER DATA
if [[ -z $NEW_IPv4 || -z $NEW_LOGINNAME || -z $NEW_PASSWORD ]]; then #INFORMATION IS NOT CORRECT
red "NEW SERVER DATA has not found, please set data for OLD Server "
red "Back to main menu"
sleep 5 && mainMenuRun
else
green "NEW SERVER DATA has found."
fi
# SELECT X-UI PANEL TYPE
echo -e "${GREEN}"
echo "Which vpn panel are you using?"
echo " 1) Vaxilu Based V2ray Panels, vaxilu and proxykingdev panels"
echo " 2) English X-UI Based Panels , HAMED-AP and NidukaAkalanka panels )"
echo " 3) V2RAY Aegnt - MACK-A panel"
echo " 4) SSH Panel by HAMED AP"
echo " 5) SSR Panel V4"
echo " 6) back to menu"
echo -e "${GREEN}"
echo " "
until [[ $migratePanels =~ ^[0-6]+$ ]] && [ "$migratePanels" -ge 1 ] && [ "$migratePanels" -le 6 ]; do
read -rp "migratePanels [1-6]: " -e -i 1 migratePanels
done
case $migratePanels in
1) # VAXILU BASED
echo
green "Vaxilu Based Panels - Start Migrations"
echo " Moving BACKUPS"
green "Downloading X-UI files from OLD Server"
sshpass -p "$OLD_PASSWORD" scp -o StrictHostKeyChecking=no $OLD_LOGINNAME@$OLD_IPv4:/usr/local/x-ui/bin/config.json /usr/local/x-ui/bin/config.json
sleep 1
sshpass -p "$OLD_PASSWORD" scp -o StrictHostKeyChecking=no $OLD_LOGINNAME@$OLD_IPv4:/etc/x-ui/x-ui.db /etc/x-ui/x-ui.db
green "X-UI files moved from old server to new server"
enter2main
;;
2) # English X-UI Based
echo
yellow "its not completed, it's in test"
enter2main
;;
2) # English X-UI Based
echo
yellow "its not completed, it's in test"
enter2main
;;
3) # V2RAY Aegnt
echo
yellow "its not completed, it's in test"
enter2main
;;
4) # SSH PANEL
echo
yellow "its not completed yet, it's on test "
enter2main
;;
5) # SSR PANEL
echo
yellow "its not completed, it's in test"
enter2main
;;
6) #EXIT to main
echo
mainMenuRun
;;
esac
fi
}
function dhcpServerInstall() {
if test -f "/Golden1/dhcp-server.sh";
then
bash /Golden1/dhcp-server.sh
else
mkdir -p /Golden1
cd /Golden1
curl -O https://raw.githubusercontent.com/ExtremeDot/ubuntu-dhcp-server/master/dhcp-server.sh
chmod +x /Golden1/dhcp-server.sh
bash /Golden1/dhcp-server.sh
fi
}
function customRouting() {
if test -f "/Golden1/ROUTE.sh";
then
rm /Golden1/ROUTE.sh
fi
mkdir -p /Golden1
cd /Golden1
curl -O https://raw.githubusercontent.com/ExtremeDot/golden_one/master/ROUTE.sh
chmod +x /Golden1/ROUTE.sh
bash /Golden1/ROUTE.sh
}
function v2flyClientInstall() {
green "Install v2ray Client-v2fly"
cd /tmp
bash <(curl -L https://raw.githubusercontent.com/v2fly/fhs-install-v2ray/master/install-release.sh)
sleep 2
systemctl enable v2ray
}
function v2flyClientConfig() {
nano /usr/local/etc/v2ray/config.json
}
function socksPortIpCheck() {
socksPortInput=1080
read -e -i "$socksPortInput" -p "Please Enter the Socks Port to check running Client's IP: " input
socksPortInput="${input:-$socksPortInput}"
curl --socks5 socks5://localhost:$socksPortInput https://myip.wtf/json
enter2main
}
function interfaceIpCheck() {
green "Listing Interfaces"
ifconfig | grep flags | awk '{print $1}' | sed 's/:$//' | grep -Ev 'lo'
green ""
interfaceName="$(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)' | head -1)"
read -e -i "$interfaceName" -p "Please Enter the Network Interface name to check its IP: " input
interfaceName="${input:-$interfaceName}"
curl --interface $interfaceName https://myip.wtf/json
}
function jinwypScript() {
if test -f "/Golden1/jinwypScript/install_kernel.sh";
then
bash /Golden1/jinwypScript/install_kernel.sh
else
mkdir -p /Golden1/jinwypScript/
cd /Golden1/jinwypScript/
curl -O https://raw.githubusercontent.com/jinwyp/one_click_script/master/install_kernel.sh
chmod +x /Golden1/jinwypScript/install_kernel.sh
sleep 2
bash /Golden1/jinwypScript/install_kernel.sh
fi
}
function softEtherv4Install() {
green "Installing SoftEther 4 Server [Gold1Script]"
mkdir -p /Golden1/softether4
cd /Golden1/softether4
curl -O https://raw.githubusercontent.com/ExtremeDot/golden_one/master/build_se_stable.sh
chmod +x /Golden1/softether4/build_se_stable.sh
/Golden1/softether4/./build_se_stable.sh
}
function speedTestcli() {
status="$(dpkg-query -W --showformat='${db:Status-Status}' speedtest-cli 2>&1)"
if [ ! $? = 0 ] || [ ! "$status" = installed ]; then
green " - - - Installing package speedtest-cli"
apt-get install -y speedtest-cli
sleep 2
green " - - - Testing Speed By SPEEDTEST Servers"
speedtest
else
green " - - - Testing Speed By SPEEDTEST Servers"
speedtest
fi
}
function showCurrentipTABLES() {
iptables-save -t nat
}
function openConnectServer() {
if test -f "/Golden1/AnyConnect/ocserv-en.sh";
then
bash /Golden1/AnyConnect/ocserv-en.sh
else
echo " Installing the Server"
mkdir -p /Golden1/AnyConnect/
cd /Golden1/AnyConnect/
wget -N --no-check-certificate https://raw.githubusercontent.com/sfc9982/AnyConnect-Server/main/ocserv-en.sh
chmod +x /Golden1/AnyConnect/ocserv-en.sh
bash /Golden1/AnyConnect/ocserv-en.sh
fi
}
function openVpnAngristanInstall() {
if test -f "/Golden1/OpenVPN/openvpn-install.sh";
then
bash /Golden1/OpenVPN/openvpn-install.sh
else
echo " Installing ANGRISTAN OPENVPN "
mkdir -p /etc/openvpn/easy-rsa/pki/issued/
mkdir -p /Golden1/OpenVPN/
cd /Golden1/OpenVPN/
wget https://raw.githubusercontent.com/angristan/openvpn-install/master/openvpn-install.sh
chmod +x /Golden1/OpenVPN/openvpn-install.sh
bash /Golden1/OpenVPN/openvpn-install.sh
fi
}
function wireGuardAngristanInstall() {
if test -f "/Golden1/WireGuard/wireguard-install.sh";
then
bash /Golden1/WireGuard/wireguard-install.sh
else
mkdir -p /Golden1/WireGuard/
cd /Golden1/WireGuard/
curl -O https://raw.githubusercontent.com/angristan/wireguard-install/master/wireguard-install.sh
chmod +x /Golden1/WireGuard/wireguard-install.sh
bash /Golden1/WireGuard/wireguard-install.sh
fi
}
function restartSoftEtherServer() {
/etc/init.d/vpnserver restart
}
function dnsmasqEdit() {
nano /etc/dnsmasq.conf
}
function dnsmasqLogCheck() {
systemctl status dnsmasq.service
}
function openVpnStatusCheck() {
systemctl status openvpn@server
}
function softEtherInfoShow() {
/bin/seshow
}
function softEtherSecureNATinstall() {
cat <<EOF > /etc/init.d/vpnserver
#!/bin/sh
# chkconfig: 2345 99 01
# description: SoftEther VPN Server
DAEMON=/usr/local/vpnserver/vpnserver
LOCK=/var/lock/subsys/vpnserver
test -x \$DAEMON || exit 0
case "\$1" in
start)
\$DAEMON start
touch \$LOCK
;;
stop)
\$DAEMON stop
rm \$LOCK
;;
restart)
\$DAEMON stop
sleep 3
\$DAEMON start
;;
*)
echo "Usage: \$0 {start|stop|restart}"
exit 1
esac
exit 0
EOF
green "vpnserver is configured as [SECURE-NAT]"
}
function checkRunningPorts() {
lsof -i -P -n | grep LIST
}
function dotRouterInstall() {
cd /tmp && curl -O https://raw.githubusercontent.com/ExtremeDot/DOT_ROUTER/master/main.sh
mv /tmp/main.sh /bin/dotrouter && chmod +x /bin/dotrouter
}
function getSystemStatus() {
echo -e "${YELLOW}Current Installed Kernel= `cat /proc/version | sed 's/.(.*//'`"
echo -e "${YELLOW}Current IPV4= `ifconfig eth0 | grep inet | grep netmask | grep -o -P '(?<=inet ).*(?= netmask)'`"
echo -e "${YELLOW}Current IPV6= [`ifconfig eth0 | grep inet6 | grep global | grep -o -P '(?<=inet6 ).*(?= prefixlen)'`]"
}
function getBbrStatus() {
green " check if bbr is running"
sysctl -n net.ipv4.tcp_congestion_control
sleep 1
lsmod | grep bbr
}
function nekorayCLIcustom() {
cd /tmp && curl -O https://raw.githubusercontent.com/ExtremeDot/vpn_setups/master/NEKORAY-CLI.sh
mv /tmp/NEKORAY-CLI.sh /bin/NEKORAY-CLI && chmod +x /bin/NEKORAY-CLI
bash /bin/NEKORAY-CLI
enter2main
}
function xrayClientInstaller() {
green "Installing latest xray core"
mkdir -p /Golden1/XrayClient
cd /Golden1/XrayClient
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install
sleep 2
systemctl enable xray
sleep 2
echo ""
echo "Updating geo files to latest"
cd /Golden1/XrayClient
bash -c "$(curl -L https://github.com/XTLS/Xray-install/raw/main/install-release.sh)" @ install-geodata
echo " all client requirements has installed"
}
function xrayClientConfig() {
nano /usr/local/etc/xray/config.json
}
function tun2SockInstaller() {
green "Installing tune2socks"
mkdir -p /Golden1/tun2socks
cd /Golden1/tun2socks
wget https://github.com/xjasonlyu/tun2socks/releases/download/v2.4.1/tun2socks-linux-amd64.zip
unzip tun2socks-linux-amd64.zip
# 7z x tun2socks-linux-amd64.zip
rm *.zip
mv tun2socks-linux-amd64 /bin/tun2socks
chmod +x /bin/tun2socks
green " finishing tun2socks ......"
}
function badvpnTun2socksInstaller() {
green "Installing BADVPN "
mkdir -p /Golden1/badvpn && cd /Golden1/badvpn && wget https://github.com/ambrop72/badvpn/archive/refs/tags/1.999.130.zip
sleep 2
unzip /Golden1/badvpn/1.999.130.zip && cd /Golden1/badvpn/badvpn-1.999.130/
sleep 2
cmake -DBUILD_NOTHING_BY_DEFAULT=1 -DBUILD_TUN2SOCKS=1
sleep 1
make
sleep 1
make install
sleep 1
green "badvpn installed successfully...."