-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathPrivate.sh
1656 lines (1434 loc) · 61.2 KB
/
Private.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
#
# Private IP Tunnel Configuration Script
# Author: github.com/Azumi67
#
# This script is designed to simplify the installation and configuration of private ip and some of its tunnels.
#
# supported architectures: x86_64, amd64
# Supported operating systems: Ubuntu 20
#
# Usage:
# - Run the script with root privileges.
# - Follow the on-screen prompts to install, configure, or uninstall the tunnel.
#
#
# Disclaimer:
# This script comes with no warranties or guarantees. Use it at your own risk.
# root check
if [[ $EUID -ne 0 ]]; then
echo -e "\e[93mThis script must be run as root. Please use sudo -i.\e[0m"
exit 1
fi
# bar
function display_progress() {
local total=$1
local current=$2
local width=40
local percentage=$((current * 100 / total))
local completed=$((width * current / total))
local remaining=$((width - completed))
printf '\r['
printf '%*s' "$completed" | tr ' ' '='
printf '>'
printf '%*s' "$remaining" | tr ' ' ' '
printf '] %d%%' "$percentage"
}
# baraye checkmark
function display_checkmark() {
echo -e "\xE2\x9C\x94 $1"
}
# error msg
function display_error() {
echo -e "\xE2\x9D\x8C Error: $1"
}
# notify
function display_notification() {
echo -e "\xE2\x9C\xA8 $1"
}
# Azumi is in your area
function display_loading() {
local frames=("⠋" "⠙" "⠹" "⠸" "⠼" "⠴" "⠦" "⠧" "⠇" "⠏")
local delay=0.1
local duration=3 # Duration in seconds
local end_time=$((SECONDS + duration))
while ((SECONDS < end_time)); do
for frame in "${frames[@]}"; do
printf "\r[frame] Loading... "
sleep "$delay"
printf "\r[frame] "
sleep "$delay"
done
done
echo -e "\r\xE2\x98\xBA Service activated successfully! ~"
}
#logo2
function display_logoo() {
echo -e "\e[92m$logoo\e[0m"
}
#art2
logoo=$(cat << "EOF"
_____ _ _
/ ____| (_) | |
| | __ _ _ _ __| | ___
| | |_ | | | | |/ _` |/ _ \
| |__| | |_| | | (_| | __/
\_____|\__,_|_|\__,_|\___|
EOF
)
#logo
function display_logo() {
echo -e "\033[1;96m$logo\033[0m"
}
# art
logo=$(cat << "EOF"
\033[1;96m
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\033[1;93m⠀⠀⢀⣀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\033[1;93m⠀⠀⡀⠤⠒⠊⠉⠀⠀⠀⠀⠈⠁⠢⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀\033[1;93m⠀⢀⠔⠉⠀⠀⠀⠀⢀⡠⠤⠐⠒⠀⠀⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\033[1;93m⠀⠀⣀⡠⠤⠤⠀⠀⠂⠐\033[1;96m⠀⠠⢤⠎⢑⡭⣽⣳⠶⣖⡶⣤⣖⣬⡽⡭⣥⣄\033[1;93m⠒⠒⠀⠐⠁⠑⢄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\033[1;93m⠀⢀⠴⠊⠁⠀⠀⠀⠀⡀⠀\033[1;96m⣠⣴⡶⣿⢏⡿⣝⡳⢧⡻⣟⡻⣞⠿⣾⡽⣳⣯⣳⣞⡻⣦⡀⠀⠀\033[1;93m⠀⠈⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\033[1;93m⢨⠀⠀⠀⢀⠤⠂⠁\033[1;96m⢠⣾⡟⣧⠿⣝⣮⣽⢺⣝⣳⡽⣎⢷⣫⡟⡵⡿⣵⢫⡷⣾⢷⣭⢻⣦⡄\033[1;93m⠤⡸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\033[1;93m⠘⡄⠀⠀⠓⠂⠀\033[1;96m⣴⣿⢷⡿⣝⣻⣏⡷⣾⣟⡼⣣⢟⣼⣣⢟⣯⢗⣻⣽⣏⡾⡽⣟⣧⠿⡼⣿⣦\033[1;93m⣃⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\033[1;93m⢀⠇⠀⠀⠀⠀\033[1;96m⣼⣿⢿⣼⡻⣼⡟⣼⣧⢿⣿⣸⡧⠿⠃⢿⣜⣻⢿⣤⣛⣿⢧⣻⢻⢿⡿⢧⣛⣿⣧⠀\033[1;93m⠛⠤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\033[1;93m⠀⢸⠁⠀⠀⠀⠀\033[1;96m⣼⣻⡿⣾⣳⡽⣾⣽⡷⣻⣞⢿⣫⠕⣫⣫⣸⢮⣝⡇⠱⣏⣾⣻⡽⣻⣮⣿⣻⡜⣞⡿⣷\033[1;93m⢀⠀⠀⠑⠢⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\033[1;93m⠘⣧⠀⠀⠀\033[1;96m⣼⣳⢯⣿⣗⣿⣏⣿⠆⣟⣿⣵⢛⣵⡿⣿⣏⣟⡾⣜⣻⠀⢻⡖⣷⢳⣏⡶⣻⡧⣟⡼⣻⡽⣇\033[1;93m⠁⠢⡀⠠⡀⠑⡄⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\033[1;93m⠀⠈⢦⠀\033[1;96m⣰⣯⣟⢯⣿⢾⣹⢾⡟⠰⣏⡾⣾⣟⡷⣿⣻⣽⣷⡶⣟⠿⡆⠀⢻⣝⣯⢷⣹⢧⣿⢧⡻⣽⣳⢽⡀\033[1;93m⠀⠈⠀⠈⠂⡼⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\033[1;93m⠀⠀⡀⢵\033[1;96m⣟⣾⡟⣾⣿⣻⢽⣺⠇⠀⣿⡱⢿⡞⣵⡳⣭⣿⡜⣿⣭⣻⣷⠲⠤⢿⣾⢯⢯⣛⢿⣳⡝⣾⣿⢭⡇⠀\033[1;93m⠀⠀⠀⡰⠁⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\033[1;93m⢀⠤⠊⠀\033[1;96m⣼⢻⣿⢞⣯⢿⡽⣸⣹⡆⠀⢷⣏⢯⣿⣧⣛⠶⣯⢿⣽⣷⣧⣛⣦⠀⠀⠙⢿⣳⣽⣿⣣⢟⡶⣿⣫⡇⠀⠀\033[1;93m⠀⠰⠁⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀\033[1;93m⣠⠖⠁⠀⠀⡄\033[1;96m⡿⣯⣷⣻⡽⣞⡟⣿⣿⣟⠉⠈⢯⣗⣻⣕⢯⣛⡞⣯⢮⣷⣭⡚⠓⠋⠀⠀⠀⠈⠉⣿⡽⣎⠷⡏⡷⣷⠀⠀⠀\033[1;93m⠀⡇⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀\033[1;93m⠐⣇⠀⠀⢀⠊\033[1;96m⣼⣇⣿⡗⣿⣽⣷⡿⣿⣱⡿⣆⠀⠀⠙⠒⠛⠓⠋⠉⠉⠀⠀⠀\033[1;91m⢠⣴⣯⣶⣶⣤⡀\033[1;96m ⠀⣿⣟⡼⣛⡇⣟⣿⡆\033[1;93m⡀⠀⢀⠇⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀\033[1;93m⠀⠘⢤⠀⠃⠌\033[1;96m⣸⣿⢾⡽⣹⣾⠹⣞⡵⣳⣽⡽⣖⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\033[1;91m⣤⣖⣻⣾⣝⢿⡄\033[1;96m ⢸⣯⢳⣏⡿⣏⣾⢧\033[1;93m⠈⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀\033[1;93m⠀⠘⠀⠈⠀\033[1;96m⡿⣿⣻⡽⣽⣿⢧⠌⠉\033[1;91m⠉⣴⣿⣿⣫⣅⡀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣛⠿⠿⢟⢙⡄⠙\033[1;96m ⠘⣯⢳⣞⡟⣯⢾⣻⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀\033[1;93m⠀⡇⠀⠀⠀\033[1;96m⡿⣿⣿⢵⣫⣿⣆⠁⠂\033[1;91m⣼⡿⢹⣿⡿⠽⠟⢢⠀⠀⠀⠀⠀⠀⠀⢹⠀⢄⢀⠀⡿⠀⠀\033[1;96m ⢰⣯⢷⣺⣏⣯⢻⡽⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀\033[1;93m⠀⡇⠀⢀⠠\033[1;96m⣿⣿⢾⣛⡶⣽⠈⢓⠀\033[1;91m⢻⠁⢸⠇⠀⠀⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠑⠠⠤⠔⠂⠀⠀\033[1;96m ⢸⣿⢮⣽⠿⣜⣻⡝⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀\033[1;93m⠀⠑⠊⠁\033[1;96m⢠⡷⡇⣿⣿⢼⣹⡀⠀⠑⢄⠀\033[1;91m⠀⠃⠌⣁⠦⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠂⠀⠀\033[1;96m⢀⣿⢾⡝⣾⡽⣺⢽⣹⣽⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣻⢽⣻⡟⣮⣝⡷⢦⣄⣄⣢⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣾⣯⢿⡺⣟⢷⡹⢾⣷⡞⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣟⡿⣎⢿⡽⣳⢮⣿⣹⣾⣯⡝⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠃⠀⠀⠀⠀⠀⠀⣀⣴⡟⣿⢧⣏⢷⡟⣮⠝⢿⣹⣯⡽⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣯⡷⣏⣾⡳⣽⢺⣷⡹⣟⢶⡹⣾⡽⣷⣤⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⡀⠔⣾⢯⣷⡇⣿⢳⣎⢿⡞⣽⢦⣼⡽⣧⢻⡽⣆⠀⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣟⢾⡷⣭⣿⢳⣭⢻⣷⡻⣜⣻⡵⣻⡼⣿⠾⠫\033[1;96m⣽⣟⣶⣶⣶⠒⠒⠂⠉⠀\033[1;96m⢸⣽⢺⡷⣷⣯⢗⣮⣟⢾⢧⣻⠼⡿⣿⢣⡟⣼⣆⠀⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡾⣝⣾⢳⢧⣟⡳⣎⣿⣿⣱⢏⣾⣽⣳⠟\033[1;92m⠁⠀⡌⠈\033[1;96m⢹⡯⠟⠛⠀⠀⠀⠀⠀⠈\033[1;96m⣷⢻⣼⣽⣿⡾⣼⣏⣾⣻⡜⣯⣷⢿⣟⣼⡳⣞⣦⠀⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⠀⢀⣾⢿⡸⣎⠿⣾⡏⣷⣉⣷⣿⢹⣎⡿\033[1;92m⠎⡎⠀⠀⠀⡇⠀⣾⠱⡀⠀⠀⠀⠀⠀⠀⠀⠈⣹⠉⡏⠀\033[1;96m⠹⣾⣏⢹⣶⢹⣶⢿⡾⣿⢶⣿⣸⠾⣇⠀⠀⠀⠀⠀
⠀⠀⠀⠀⠀⠀⠀⣠⣾⢫⣞⡽⣯⢿⣹⡟⣶⣹⢷⣻\033[1;92m⡷⠊⠀⡜⠀⠀⠀⠀⢱⠀⣿⡀⠈⠢⢀⣀⣀⠠⠄⠒⢈⡏⡰⠀⠀⠀\033[1;96m⠀⣿⡜⣮⢟⡼⣻⡵⣻⣗⠾⣟⣯⢻⣆⠀⠀⠀⠀
⠀⠀⠀⠀⠀⢀⣴⣿⢣⣟⡾⣽⣯⢳⣿⡹⣖⣿⡳\033[1;92m⠋⠀⠀⡸⠀⠀⠀⠀⠀⢸⠀⢺⢂⠀⠀⠀⠀⠀⠀⠀⢠⡺⡱⠁⠀⠀⠀⠀\033[1;96m⢹⣧⣻⢮⡳⣝⡷⢧⣻⢯⢿⣻⣳⢞⡆⠀⠀⠀
⠀⠀⠀⠀⢀⡾⣽⣣⡿⣼⣏⡿⣼⣳⡯⢷⣹⣯⠇\033[1;92m⠀⠀⢠⠁⠀⠀⠀⠀⠀⠈⡆⠈⢹⡰⠤⡀⠀⠀⠀⢠⡼⢱⠁⠀⠀⠀⠀⠀⠀\033[1;96m⠹⣿⣿⣱⣻⣼⣏⢷⣯⣿⡳⣿⣎⢿⡀⠀⠀
⠀⠀⠀⠀⣾⣽⠷⣿⣵⡿⣼⡟⣭⣷⡟⣿⢯⡏⠀\033[1;92m⠀⠀⠘⠀⠀⠒⠈⢡⠀⠀⢗⢄⠀⠃⠀⠺⢁⢈⠥⠋⣀⠇⠀⠀⠀⠀⠀⠀⡀⠀\033[1;96m⠈⠙⢿⣳⢞⣽⢯⣞⣾⣯⡝⣿⡾⡇⠀⠀\033[1;92mAuthor: github.com/Azumi67 \033[1;96m ⠀
\033[1;96m ______ \033[1;94m _______ \033[1;92m __ \033[1;93m _______ \033[1;91m __ \033[1;96m _____ ___
\033[1;96m / " \ \033[1;94m| __ "\ \033[1;92m|" \ \033[1;93m /" \ \033[1;91m /""\ \033[1;96m(\" \|" \
\033[1;96m // ____ \ \033[1;94m(. |__) :)\033[1;92m|| | \033[1;93m|: | \033[1;91m / \ \033[1;96m |.\\ \ |
\033[1;96m/ / ) :)\033[1;94m|: ____/ \033[1;92m|: | \033[1;93m|_____/ ) \033[1;91m /' /\ \ \033[1;96m|: \. \\ |
\033[1;96m(: (____/ // \033[1;94m(| / \033[1;92m|. | \033[1;93m // / \033[1;91m // __' \ \033[1;96m|. \ \ |
\033[1;96m\ / \033[1;94m/|__/ \ \033[1;92m/\ |\ \033[1;93m|: __ \ \033[1;91m/ / \\ \ \033[1;96m| \ \ |
\033[1;96m \"_____/ \033[1;94m(_______) \033[1;92m(__\_|_)\033[1;93m|__| \___)\033[1;91m(___/ \___) \033[1;96m\___|\____\)
EOF
)
function main_menu() {
while true; do
display_logo
echo -e "\e[93m╔════════════════════════════════════════════════════════════════╗\e[0m"
echo -e "\e[93m║ ▌║█║▌│║▌│║▌║▌█║ \e[92mMain Menu\e[93m ▌│║▌║▌│║║▌█║▌ ║\e[0m"
echo -e "\e[93m╠════════════════════════════════════════════════════════════════╣\e[0m"
display_service_status
display_service_statuss
echo -e "\e[93m╔════════════════════════════════════════════════════════════════╗\e[0m"
echo -e "\e[91m 🌐 \e[92mJoin Opiran Telegram \e[34m@https://t.me/OPIranClub\e[0m \e[91m🌐\e[0m"
echo -e "\e[93m╠════════════════════════════════════════════════════════════════╣\e[0m"
echo -e "1. \e[96mInstallation-[Frp-Udp2raw]\e[0m"
echo -e "2. \e[92mPrivate IP\e[0m"
echo -e "3. \e[94mTCP Tunnel\e[0m"
echo -e "4. \e[36mFRP Wireguard\e[0m"
echo -e "5. \e[92mUDP2raw Wireguard\e[0m"
echo -e "6. \e[93mRestart Service\e[0m"
echo -e "7. \e[91mUninstall\e[0m"
echo "0. Exit"
printf "\e[93m╰─────────────────────────────────────────────────────────────────╯\e[0m\n"
read -e -p $'\e[5mEnter your choice Please: \e[0m' choice
case $choice in
1)
installation_menu
;;
2)
private_ip
;;
3)
TCP_menu
;;
4)
FRPP_UDP_menu
;;
5)
UDP2raww_UDP_menu
;;
6)
restart_service
;;
7)
uninstall
;;
0)
echo "Exiting..."
exit 0
;;
*)
echo "Invalid choice."
;;
esac
echo "Press Enter to continue..."
read
clear
done
}
function rmve_cron() {
entries_to_remove=(
"0 */6 * * * /etc/res.sh"
)
if test -f /etc/res.sh; then
for entry in "${entries_to_remove[@]}"; do
existing_crontab=$(crontab -l 2>/dev/null)
if [[ $existing_crontab == *"$entry"* ]]; then
modified_crontab=${existing_crontab//$entry/}
echo "$modified_crontab" | crontab -
echo -e "\033[92mCron entry removed!\033[0m"
rm /etc/res.sh
return
fi
done
echo -e "\033[91mCron entry not found.\033[0m"
else
echo -e "\033[91m/etc/res.sh file not found.\033[0m"
fi
}
function res_li() {
if test -f /etc/res.sh; then
rm /etc/res.sh
fi
cat <<EOF > /etc/res.sh
#!/bin/bash
kill -9 \$(pgrep frps)
systemctl daemon-reload
systemctl restart azumifrps
EOF
chmod +x /etc/res.sh
existing_entry="0 */6 * * * /etc/res.sh"
existing_crontab=""
existing_crontab=$(crontab -l 2>/dev/null)
if [[ $existing_entry == *"$existing_crontab"* ]]; then
echo -e "\033[91mCrontab already exists.\033[0m"
else
new_crontab=$(echo -e "$existing_crontab\n0 */6 * * * /etc/res.sh\n")
echo "$new_crontab" | crontab -
echo -e "\033[92m6 hour reset timer added!\033[0m"
fi
echo -e "\033[92mIT IS DONE.!\033[0m"
}
function res_lk() {
if test -f /etc/res.sh; then
rm /etc/res.sh
fi
cat <<EOF > /etc/res.sh
#!/bin/bash
kill -9 \$(pgrep frpc)
systemctl daemon-reload
systemctl restart azumifrpc
EOF
chmod +x /etc/res.sh
existing_entry="0 */6 * * * /etc/res.sh"
existing_crontab=""
existing_crontab=$(crontab -l 2>/dev/null)
if [[ $existing_entry == *"$existing_crontab"* ]]; then
echo -e "\033[91mCrontab already exists.\033[0m"
else
new_crontab=$(echo -e "$existing_crontab\n0 */6 * * * /etc/res.sh\n")
echo "$new_crontab" | crontab -
echo -e "\033[92m6 hour reset timer added!\033[0m"
fi
echo -e "\033[92mIT IS DONE.!\033[0m"
}
function installation_menu() {
clear
echo $'\e[92m ^ ^\e[0m'
echo $'\e[92m(\e[91mO,O\e[92m)\e[0m'
echo $'\e[92m( ) \e[93mInstallation Menu\e[0m'
echo $'\e[92m "-"\e[93m═════════════════════\e[0m'
echo ""
printf "\e[93m╭───────────────────────────────────────╮\e[0m\n"
echo $'\e[93mSelect what to install:\e[0m'
echo $'1. \e[92mFRP\e[0m'
echo $'2. \e[93mUDP2RAW\e[0m'
echo $'3. \e[94mback to main menu\e[0m'
printf "\e[93m╰───────────────────────────────────────╯\e[0m\n"
read -e -p $'\e[38;5;205mEnter your choice Please: \e[0m' server_type
case $server_type in
1)
frp_menu
;;
2)
udp_menu
;;
3)
clear
main_menu
;;
*)
echo "Invalid choice."
;;
esac
}
function frp_menu() {
# Function to stop the loading animation and exit
function stop_loading() {
echo -e "\xE2\x9D\x8C Installation process interrupted."
exit 1
}
# (Ctrl+C)
trap stop_loading INT
ipv4_forwarding=$(sysctl -n net.ipv4.ip_forward)
if [[ $ipv4_forwarding -eq 1 ]]; then
echo "IPv4 forwarding is already enabled."
else
sysctl -w net.ipv4.ip_forward=1 &>/dev/null
echo "IPv4 forwarding has been enabled."
fi
ipv6_forwarding=$(sysctl -n net.ipv6.conf.all.forwarding)
if [[ $ipv6_forwarding -eq 1 ]]; then
echo "IPv6 forwarding is already enabled."
else
sysctl -w net.ipv6.conf.all.forwarding=1 &>/dev/null
echo "IPv6 forwarding has been enabled."
fi
# DNS baraye install
# CPU architecture
arch=$(uname -m)
# cpu architecture
case $arch in
x86_64 | amd64)
frp_download_url="https://github.com/fatedier/frp/releases/download/v0.52.3/frp_0.52.3_linux_amd64.tar.gz"
;;
aarch64 | arm64)
frp_download_url="https://github.com/fatedier/frp/releases/download/v0.52.3/frp_0.52.3_linux_arm64.tar.gz"
;;
*)
display_error "Unsupported CPU architecture: $arch"
return
;;
esac
# Download FRP notificatiooooons
display_notification $'\e[91mDownloading FRP in a sec...\e[0m'
display_notification $'\e[91mPlease wait, updating...\e[0m'
# timer
SECONDS=0
# Update in the background
apt update &>/dev/null &
apt_update_pid=$!
# Timer
while [[ -n $(ps -p $apt_update_pid -o pid=) ]]; do
clear
display_notification $'\e[93mPlease wait, updating...\e[0m'
display_notification $'\e[93mAzumi is working in the background, timer: \e[0m'"$SECONDS seconds"
sleep 1
done
# progress bar
for ((i=0; i<=10; i++)); do
sleep 0.5
display_progress 10 $i
done
display_checkmark $'\e[92mUpdate completed successfully!\e[0m'
# Download the appropriate FRP version
wget "$frp_download_url" -O frp.tar.gz &>/dev/null
tar -xf frp.tar.gz &>/dev/null
display_checkmark $'\e[92mFRP installed successfully!\e[0m'
# sysctl setting
sysctl -p &>/dev/null
# notify
display_notification $'\e[92mIP forward enabled!\e[0m'
display_loading
# interrupt
trap - INT
}
function udp_menu() {
# clean up
stop_loading() {
kill $loading_bar_pid &>/dev/null
echo ""
}
# (Ctrl+C)
trap stop_loading INT
# add DNS address
ipv4_forwarding=$(sysctl -n net.ipv4.ip_forward)
if [[ $ipv4_forwarding -eq 1 ]]; then
echo "IPv4 forwarding is already enabled."
else
sysctl -w net.ipv4.ip_forward=1 &>/dev/null
echo "IPv4 forwarding has been enabled."
fi
ipv6_forwarding=$(sysctl -n net.ipv6.conf.all.forwarding)
if [[ $ipv6_forwarding -eq 1 ]]; then
echo "IPv6 forwarding is already enabled."
else
sysctl -w net.ipv6.conf.all.forwarding=1 &>/dev/null
echo "IPv6 forwarding has been enabled."
fi
# Azumi is working in the background
(
while true; do
echo -ne "\033[92mRunning update: [ ] $(printf "%02d:%02d" $((SECONDS/60)) $((SECONDS%60))) \r\033[0m"
sleep 0.3
echo -ne "\033[92mRunning update: [█ ] $(printf "%02d:%02d" $((SECONDS/60)) $((SECONDS%60))) \r\033[0m"
sleep 0.3
echo -ne "\033[92mRunning update: [██ ] $(printf "%02d:%02d" $((SECONDS/60)) $((SECONDS%60))) \r\033[0m"
sleep 0.3
echo -ne "\033[92mRunning update: [███ ] $(printf "%02d:%02d" $((SECONDS/60)) $((SECONDS%60))) \r\033[0m"
sleep 0.3
echo -ne "\033[92mRunning update: [████ ] $(printf "%02d:%02d" $((SECONDS/60)) $((SECONDS%60))) \r\033[0m"
sleep 0.3
echo -ne "\033[92mRunning update: [█████ ] $(printf "%02d:%02d" $((SECONDS/60)) $((SECONDS%60))) \r\033[0m"
sleep 0.3
echo -ne "\033[92mRunning update: [██████ ] $(printf "%02d:%02d" $((SECONDS/60)) $((SECONDS%60))) \r\033[0m"
sleep 0.3
echo -ne "\033[92mRunning update: [███████ ] $(printf "%02d:%02d" $((SECONDS/60)) $((SECONDS%60))) \r\033[0m"
sleep 0.3
done
) &
loading_bar_pid=$!
# run update
apt update > /dev/null 2>&1
apt install wget > /dev/null 2>&1
# clean up
stop_loading
display_checkmark $'\e[92mUpdate completed.\e[0m'
sleep 1
echo -e "\033[93mInstalling UDP2raw...\033[0m"
sleep 1
echo -e "\033[93mDownloading UDP2raw package...\033[0m"
# Loading for FRP
(
while true; do
echo -ne "\033[94mLoading: [\033[1m=\033[0m ]\r"
sleep 0.5
echo -ne "\033[94mLoading: [\033[1m==\033[0m ]\r"
sleep 0.5
echo -ne "\033[94mLoading: [\033[1m===\033[0m ]\r"
sleep 0.5
echo -ne "\033[94mLoading: [\033[1m====\033[0m ]\r"
sleep 0.5
echo -ne "\033[94mLoading: [\033[1m=====\033[0m ]\r"
sleep 0.5
echo -ne "\033[94mLoading: [\033[1m======\033[0m ]\r"
sleep 0.5
echo -ne "\033[94mLoading: [\033[1m=======\033[0m ]\r"
sleep 0.5
echo -ne "\033[94mLoading: [\033[1m========\033[0m ]\r"
sleep 0.5
echo -ne "\033[94mLoading: [\033[1m=========\033[0m ]\r"
sleep 0.5
echo -ne "\033[94mLoading: [\033[1m==========\033[0m ]\r"
sleep 0.5
echo -ne "\033[94mLoading: [\033[1m===========\033[0m]\r"
sleep 0.5
done
) &
loading_bar_pid=$!
system_architecture=$(uname -m)
if [ "$system_architecture" != "x86_64" ] && [ "$system_architecture" != "amd64" ] && [ "$system_architecture" != "arm" ]; then
echo "Unsupported architecture: $system_architecture" > /dev/null
exit 1
fi
sleep 1
echo ""
echo -e "${YELLOW}Downloading and installing udp2raw for architecture: $system_architecture${NC}"
if [ "$system_architecture" == "x86_64" ] || [ "$system_architecture" == "amd64" ]; then
wget https://github.com/Azumi67/udp2raw-core/raw/main/udp2raw_amd64 &>/dev/null
elif [ "$system_architecture" == "arm" ]; then
wget https://github.com/Azumi67/udp2raw-core/raw/main/udp2raw_arm &>/dev/null
fi
sleep 1
chmod +x udp2raw_amd64 &>/dev/null
chmod +x udp2raw_arm &>/dev/null
stop_loading
display_checkmark $'\e[92mUDP2raw installation completed.\e[0m'
# setup time
duration=$SECONDS
echo -e "\033[93mInstallation completed in \033[92m$(($duration / 60)) minutes and $(($duration % 60)) seconds.\033[0m"
# interrupt
trap - INT
}
function private_ip() {
clear
echo $'\e[92m ^ ^\e[0m'
echo $'\e[92m(\e[91mO,O\e[92m)\e[0m'
echo $'\e[92m( ) \e[93mPrivate IP Menu\e[0m'
echo $'\e[92m "-"\e[93m═════════════════════\e[0m'
printf "\e[93m╭───────────────────────────────────────╮\e[0m\n"
echo $'\e[93mChoose what to do:\e[0m'
echo $'1. \e[92mKharej\e[0m'
echo $'2. \e[91mIRAN\e[0m'
echo $'3. \e[94mback to main menu\e[0m'
printf "\e[93m╰───────────────────────────────────────╯\e[0m\n"
read -e -p $'\e[38;5;205mEnter your choice Please: \e[0m' server_type
case $server_type in
1)
kharej_private_menu
;;
2)
iran_private_menu
;;
3)
clear
main_menu
;;
*)
echo "Invalid choice."
;;
esac
}
function kharej_private_menu() {
clear
echo $'\e[92m ^ ^\e[0m'
echo $'\e[92m(\e[91mO,O\e[92m)\e[0m'
echo $'\e[92m( ) \e[93mConfiguring kharej server\e[0m'
echo $'\e[92m "-"\e[93m══════════════════════════\e[0m'
display_logoo
printf "\e[93m╭────────────────────────────────────────────────────────────────────────────────────╮\e[0m\n"
echo $'\e[92m Please make sure to remove any private IPs that you have created before proceeding\e[0m'
printf "\e[93m╰────────────────────────────────────────────────────────────────────────────────────╯\e[0m\n"
display_notification $'\e[93mAdding private IP addresses for Kharej server...\e[0m'
if [ -f "/etc/private.sh" ]; then
rm /etc/private.sh
fi
# Q&A
printf "\e[93m╭─────────────────────────────────────────────────────────╮\e[0m\n"
read -e -p $'\e[93mEnter \e[92mKharej\e[93m IPV4 address: \e[0m' local_ip
read -e -p $'\e[93mEnter \e[92mIRAN\e[93m IPV4 address: \e[0m' remote_ip
# ip commands
ip tunnel add azumi mode sit remote $remote_ip local $local_ip ttl 255 > /dev/null
ip link set dev azumi up > /dev/null
# iran initial IP address
initial_ip="fd1d:fc98:b73e:b481::1/64"
ip addr add $initial_ip dev azumi > /dev/null
# additional private IPs-number
read -e -p $'How many additional \e[92mprivate IPs\e[93m do you need? \e[0m' num_ips
printf "\e[93m╰─────────────────────────────────────────────────────────╯\e[0m\n"
# additional private IPs
for ((i=1; i<=num_ips; i++))
do
ip_suffix=`printf "%x\n" $i`
ip_addr="fd1d:fc98:b73e:b48${ip_suffix}::1/64" > /dev/null
# Check kharej
ip addr show dev azumi | grep -q "$ip_addr"
if [ $? -eq 0 ]; then
echo "IP address $ip_addr already exists. Skipping..."
else
ip addr add $ip_addr dev azumi
fi
done
# private.sh
display_notification $'\e[93mAdding commands to private.sh...\e[0m'
echo "ip tunnel add azumi mode sit remote $remote_ip local $local_ip ttl 255" >> /etc/private.sh
echo "ip link set dev azumi up" >> /etc/private.sh
echo "ip addr add fd1d:fc98:b73e:b481::1/64 dev azumi" >> /etc/private.sh
ip_addr="fd1d:fc98:b73e:b48${ip_suffix}::1/64"
echo "ip addr add $ip_addr dev azumi" >> /etc/private.sh
display_checkmark $'\e[92mPrivate ip added successfully!\e[0m'
display_notification $'\e[93mAdding cron job for server!\e[0m'
(crontab -l 2>/dev/null; echo "@reboot /bin/bash /etc/private.sh") | crontab -
ping -c 2 fd1d:fc98:b73e:b481::2 | sed "s/.*/\x1b[94m&\x1b[0m/"
sleep 1
display_notification $'\e[93mConfiguring keepalive service..\e[0m'
# script
script_content='#!/bin/bash
# IPv6 address
ip_address="fd1d:fc98:b73e:b481::2"
# maximum number
max_pings=4
# Interval
interval=60
# Loop run
while true
do
# Loop for pinging specified number of times
for ((i = 1; i <= max_pings; i++))
do
ping_result=$(ping -c 1 $ip_address | grep "time=" | awk -F "time=" "{print $2}" | awk -F " " "{print $1}" | cut -d "." -f1)
if [ -n "$ping_result" ]; then
echo "Ping successful! Response time: $ping_result ms"
else
echo "Ping failed!"
fi
done
echo "Waiting for $interval seconds..."
sleep $interval
done'
echo "$script_content" | sudo tee /etc/ping_v6.sh > /dev/null
chmod +x /etc/ping_v6.sh
# service file
cat <<EOF > /etc/systemd/system/ping_v6.service
[Unit]
Description=keepalive
After=network.target
[Service]
ExecStart=/bin/bash /etc/ping_v6.sh
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable ping_v6.service
systemctl start ping_v6.service
display_checkmark $'\e[92mPing Service has been added successfully!\e[0m'
# display
echo ""
echo -e "Created \e[93mPrivate IP Addresses \e[92m(Kharej):\e[0m"
for ((i=1; i<=num_ips; i++))
do
ip_suffix=`printf "%x\n" $i`
ip_addr="fd1d:fc98:b73e:b48${ip_suffix}::1"
echo "+---------------------------+"
echo -e "| \e[92m$ip_addr \e[0m|"
done
echo "+---------------------------+"
}
# private IP for Iran
function iran_private_menu() {
clear
echo $'\e[92m ^ ^\e[0m'
echo $'\e[92m(\e[91mO,O\e[92m)\e[0m'
echo $'\e[92m( ) \e[93mConfiguring Iran server\e[0m'
echo $'\e[92m "-"\e[93m══════════════════════════\e[0m'
display_logoo
printf "\e[93m╭────────────────────────────────────────────────────────────────────────────────────╮\e[0m\n"
echo $'\e[92m Please make sure to remove any private IPs that you have created before proceeding\e[0m'
printf "\e[93m╰────────────────────────────────────────────────────────────────────────────────────╯\e[0m\n"
display_notification $'\e[93mAdding private IP addresses for Iran server...\e[0m'
if [ -f "/etc/private.sh" ]; then
rm /etc/private.sh
fi
# Q&A
printf "\e[93m╭─────────────────────────────────────────────────────────╮\e[0m\n"
read -e -p $'\e[93mEnter \e[92mKharej\e[93m IPV4 address: \e[0m' remote_ip
read -e -p $'\e[93mEnter \e[92mIRAN\e[93m IPV4 address: \e[0m' local_ip
# ip commands
ip tunnel add azumi mode sit remote $remote_ip local $local_ip ttl 255 > /dev/null
ip link set dev azumi up > /dev/null
# iran initial IP address
initial_ip="fd1d:fc98:b73e:b481::2/64"
ip addr add $initial_ip dev azumi > /dev/null
# additional private IPs-number
read -e -p $'How many additional \e[92mprivate IPs\e[93m do you need? \e[0m' num_ips
printf "\e[93m╰─────────────────────────────────────────────────────────╯\e[0m\n"
# additional private IPs
for ((i=1; i<=num_ips; i++))
do
ip_suffix=`printf "%x\n" $i`
ip_addr="fd1d:fc98:b73e:b48${ip_suffix}::2/64" > /dev/null
# Check iran
ip addr show dev azumi | grep -q "$ip_addr"
if [ $? -eq 0 ]; then
echo "IP address $ip_addr already exists. Skipping..."
else
ip addr add $ip_addr dev azumi
fi
done
# private.sh
echo -e "\e[93mAdding commands to private.sh...\e[0m"
echo "ip tunnel add azumi mode sit remote $remote_ip local $local_ip ttl 255" >> /etc/private.sh
echo "ip link set dev azumi up" >> /etc/private.sh
echo "ip addr add fd1d:fc98:b73e:b481::2/64 dev azumi" >> /etc/private.sh
ip_addr="fd1d:fc98:b73e:b48${ip_suffix}::2/64"
echo "ip addr add $ip_addr dev azumi" >> /etc/private.sh
chmod +x /etc/private.sh
display_checkmark $'\e[92mPrivate ip added successfully!\e[0m'
display_notification $'\e[93mAdding cron job for server!\e[0m'
(crontab -l 2>/dev/null; echo "@reboot /bin/bash /etc/private.sh") | crontab -
ping -c 2 fd1d:fc98:b73e:b481::1 | sed "s/.*/\x1b[94m&\x1b[0m/"
sleep 1
display_notification $'\e[93mConfiguring keepalive service..\e[0m'
# script
script_content='#!/bin/bash
# iPv6 address
ip_address="fd1d:fc98:b73e:b481::1"
max_pings=3
# interval
interval=50
# loop run
while true
do
# Loop for pinging specified number of times
for ((i = 1; i <= max_pings; i++))
do
ping_result=$(ping -c 1 $ip_address | grep "time=" | awk -F "time=" "{print $2}" | awk -F " " "{print $1}" | cut -d "." -f1)
if [ -n "$ping_result" ]; then
echo "Ping successful! Response time: $ping_result ms"
else
echo "Ping failed!"
fi
done
echo "Waiting for $interval seconds..."
sleep $interval
done'
echo "$script_content" | sudo tee /etc/ping_v6.sh > /dev/null
chmod +x /etc/ping_v6.sh
# service file
cat <<EOF > /etc/systemd/system/ping_v6.service
[Unit]
Description=keepalive
After=network.target
[Service]
ExecStart=/bin/bash /etc/ping_v6.sh
Restart=always
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable ping_v6.service
systemctl start ping_v6.service
display_checkmark $'\e[92mPing Service has been added successfully!\e[0m'
# display
echo ""
echo -e "Created \e[93mPrivate IP Addresses \e[92m(Iran):\e[0m"
for ((i=1; i<=num_ips; i++))
do
ip_suffix=`printf "%x\n" $i`
ip_addr="fd1d:fc98:b73e:b48${ip_suffix}::2"
echo "+---------------------------+"
echo -e "| \e[92m$ip_addr \e[0m|"
done
echo "+---------------------------+"
}
function TCP_menu() {
clear
clear
echo $'\e[92m ^ ^\e[0m'
echo $'\e[92m(\e[91mO,O\e[92m)\e[0m'
echo $'\e[92m( ) \e[93mTCP Tunnel Menu\e[0m'
echo $'\e[92m "-"\e[93m═══════════════════════════════\e[0m'
printf "\e[93m╭───────────────────────────────────────╮\e[0m\n"
echo "Select an option:"
echo -e "1. \e[92mKharej Tunnel\e[0m"
echo -e "2. \e[96mIRAN Tunnel\e[0m"
echo -e "3. \e[33mBack to main menu\e[0m"
printf "\e[93m╰───────────────────────────────────────╯\e[0m\n"
read -e -p "Enter your choice Please: " choice
case $choice in
1)
kharej_tunnel_menu
;;
2)
iran_tunnel_menu
;;
3)
clear
main_menu
;;
*)
echo "Invalid choice."
;;
esac
}
function kharej_tunnel_menu() {
clear
echo $'\e[92m ^ ^\e[0m'
echo $'\e[92m(\e[91mO,O\e[92m)\e[0m'
echo $'\e[92m( ) \e[93muKharej TCP Tunnel\e[0m'
echo $'\e[92m "-"\e[93m═══════════════════════════════\e[0m'
echo ""
printf "\e[93m╭───────────────────────────────────────────────────────────────────╮\e[0m\n"
read -p $'\e[93mHow many Private ip address do you have:\e[0m\e[92m[Kharej] \e[0m' num_ipv6
sleep 1
echo "Generating Config for you..."
read -e -p $'\e[93mEnter \e[92mIran\e[93m Private ip address: \e[0m' iran_ipv6
read -e -p $'\e[93mEnter Tunnel \e[92mToken\e[93m:[Same value for Server & Client] \e[0m' frp_token
read -e -p $'\e[93mEnter \e[92mTunnel\e[93m Port:[Example: 443] \e[0m' tunnel_port
# frpc.ini
rm frp_0.52.3_linux_amd64/frpc.ini
rm frp_0.52.3_linux_arm64/frpc.ini
# CPU architecture
if [[ "$(uname -m)" == "x86_64" ]]; then
cpu_arch="amd64"
elif [[ "$(uname -m)" == "aarch64" ]]; then
cpu_arch="arm64"
else
echo -e "\e[93mUnsupported CPU architecture.\e[0m"
exit 1
fi
cat > frp_0.52.3_linux_$cpu_arch/frpc.ini <<EOL
[common]
server_addr = $iran_ipv6
server_port = $tunnel_port
authentication_mode = token
token = $frp_token
EOL
for ((i=1; i<=$num_ipv6; i++)); do
read -e -p $'\e[93mEnter your \e[92mKharej\e[93m '$i$'th Private ip address:\e[0m ' kharej_ipv6
read -e -p $'\e[93mEnter \e[92mKharej\e[93m TCP port:\e[0m\e[92m[This is your current port]\e[0m ' kharej_port
read -e -p $'\e[93mEnter \e[92mIran\e[93m TCP port:\e[0m\e[92m[This will be your new port]\e[0m ' iran_port
printf "\e[93m╰────────────────────────────────────────────────────────────────────╯\e[0m\n"
cat >> frp_0.52.3_linux_$cpu_arch/frpc.ini <<EOL
[v2ray$i]
type = tcp
local_port = $kharej_port
remote_port = $iran_port
local_ip$i = $kharej_ipv6
use_encryption = true
use_compression = true
EOL
done
display_checkmark $'\e[92mKharej configuration generated. Yours Truly, Azumi.\e[0m'
# service section for Kharej
cat > /etc/systemd/system/azumifrpc.service <<EOL
[Unit]
Description=frpc service
After=network.target
[Service]
ExecStart=/root/frp_0.52.3_linux_$cpu_arch/./frpc -c /root/frp_0.52.3_linux_$cpu_arch/frpc.ini
Restart=always
RestartSec=10
User=root
[Install]
WantedBy=multi-user.target
EOL
echo "Reloading daemon..." > /dev/null 2>&1
systemctl daemon-reload > /dev/null 2>&1
echo "Enabling FRP service..." > /dev/null 2>&1
systemctl enable azumifrpc > /dev/null 2>&1
echo "Starting FRP service..."
systemctl restart azumifrpc
res_lk
display_checkmark $'\e[92mFRP Service started.\e[0m'
}
function iran_tunnel_menu() {
clear
echo $'\e[92m ^ ^\e[0m'
echo $'\e[92m(\e[91mO,O\e[92m)\e[0m'
echo $'\e[92m( ) \e[93mIran TCP Tunnel\e[0m'
echo ""
echo $'\e[92m "-"\e[93m═══════════════════════════════\e[0m'
printf "\e[93m╭───────────────────────────────────────────────────────────────────╮\e[0m\n"
read -e -p $'\e[93mHow many \e[92mIran\e[93m Private ip addresses do you have: \e[0m' num_ipv6
sleep 1
echo "Generating Iran Config for you..."
read -e -p $'\e[93mEnter \e[92mTunnel Port\e[93m:[Example: \e[92m443\e[93m] \e[0m' tunnel_port
read -e -p $'\e[93mEnter \e[92mTunnel Token\e[93m:[\e[93mSame Value for both Iran & Kharej\e[93m] \e[0m' token
echo -e "\e[93mGenerating config for you...\e[0m"
rm frp_0.52.3_linux_amd64/frps.ini
rm frp_0.52.3_linux_arm64/frps.ini
# frps.ini
# CPU architecture
if [[ "$(uname -m)" == "x86_64" ]]; then
cpu_arch="amd64"
elif [[ "$(uname -m)" == "aarch64" ]]; then
cpu_arch="arm64"
else
echo -e "\e[93mUnsupported CPU architecture.\e[0m"
exit 1
fi
cat > frp_0.52.3_linux_$cpu_arch/frps.ini <<EOL
[common]
bind_port = $tunnel_port
token = $token
EOL
for ((i=1; i<=$num_ipv6; i++)); do
read -e -p $'\e[93mEnter your \e[92mIran\e[93m '$i$'th Private ip address:\e[0m ' iran_ipv6
read -e -p $'\e[93mEnter \e[92mKharej\e[93m TCP port:\e[0m\e[92m[This is your current port]\e[0m ' kharej_v2ray_port
read -e -p $'\e[93mEnter \e[92mIran\e[93m TCP port:\e[0m\e[92m[This will be your new port]\e[0m ' iran_v2ray_port
printf "\e[93m╰────────────────────────────────────────────────────────────────────╯\e[0m\n"
cat >> frp_0.52.3_linux_$cpu_arch/frps.ini <<EOL
[v2ray$i]
type = tcp
local_ip$i = $iran_ipv6
local_port = $iran_v2ray_port
remote_port = $kharej_v2ray_port
use_encryption = true
use_compression = true
EOL
done
display_checkmark $'\e[92mIran configuration generated. Yours Truly, Azumi.\e[0m'
# service section for Kharej
cat > /etc/systemd/system/azumifrps.service <<EOL
[Unit]
Description=frps service
After=network.target
[Service]
ExecStart=/root/frp_0.52.3_linux_$cpu_arch/./frps -c /root/frp_0.52.3_linux_$cpu_arch/frps.ini
Restart=always
RestartSec=10
User=root
[Install]
WantedBy=multi-user.target
EOL
echo "Reloading daemon..." > /dev/null 2>&1
systemctl daemon-reload > /dev/null 2>&1