This repository has been archived by the owner on Apr 22, 2020. It is now read-only.
forked from ToyoDAdoubi/doubi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathssrmu.sh
1720 lines (1610 loc) · 65.8 KB
/
ssrmu.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
#!/usr/bin/env bash
set -euo pipefail
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
#=================================================
# System Required: CentOS 6+/Debian 6+/Ubuntu 14.04+
# Description: Install the ShadowsocksR mudbjson server
# Version: 1.0.29
# Author: Toyo
# Rewriter: MTimer
#=================================================
sh_ver="1.0.29"
libso_ver_default="1.0.17"
SH_FILE="/usr/local/bin/ssr"
SSR_PATH="/usr/local/shadowsocksr"
USERMYSQL_FILE="$SSR_PATH/usermysql.json"
USER_CONFIG_FILE="$SSR_PATH/user-config.json"
USER_API_CONFIG_FILE="$SSR_PATH/userapiconfig.py"
MUDB_FILE="$SSR_PATH/mudb.json"
JQ_FILE="$SSR_PATH/jq"
SSR_LOG_FILE="$SSR_PATH/ssserver.log"
BBR_FILE="$HOME/bbr.sh"
SERVER_SPEEDER_FILE="/serverspeeder/bin/serverSpeeder.sh"
LOTSERVER_FILE="/appex/bin/serverSpeeder.sh"
green="\033[32m"
red="\033[31m"
red_background="\033[41;37m"
plain="\033[0m"
info="${green}[信息]$plain"
error="${red}[错误]$plain"
tip="${green}[注意]$plain"
separator="——————————————————————————————"
[ $EUID -ne 0 ] && echo -e "[$error] 当前账号非ROOT(或没有ROOT权限),无法继续操作,请使用$green sudo su $plain来获取临时ROOT权限(执行后会提示输入当前账号的密码)." && exit 1
CheckRelease()
{
if grep -Eqi "(Red Hat|CentOS|Fedora|Amazon)" < /etc/issue ; then
release="rpm"
elif grep -Eqi "Debian" < /etc/issue ; then
release="deb"
elif grep -Eqi "Ubuntu" < /etc/issue ; then
release="ubu"
else
if grep -Eqi "(redhat|centos|Red\ Hat)" < /proc/version ; then
release="rpm"
elif grep -Eqi "debian" < /proc/version ; then
release="deb"
elif grep -Eqi "ubuntu" < /proc/version ; then
release="ubu"
fi
fi
if [ -s "/etc/redhat-release" ]; then
release_ver=$(grep -oE "[0-9.]+" /etc/redhat-release)
else
release_ver=$(grep -oE "[0-9.]+" /etc/issue)
fi
release_ver_main=${release_ver%%.*}
if [ "$(uname -m | grep -c 64)" -gt 0 ]; then
release_bit="64"
else
release_bit="32"
fi
update_once=0
depends=(wget unzip vim curl cron crond python)
for depend in "${depends[@]}"; do
DEPEND_PATH="$(command -v "$depend" || true)"
if [ -z "$DEPEND_PATH" ]; then
case "$release" in
"rpm")
if [ "$depend" != "cron" ]; then
if [ $update_once == 0 ];then
yum -y update >/dev/null 2>&1
update_once=1
fi
if yum -y install "$depend" >/dev/null 2>&1; then
echo -e "$info 依赖 $depend 安装成功..."
else
echo -e "$error 依赖 $depend 安装失败..." && exit 1
fi
fi
;;
"deb"|"ubu")
if [ "$depend" != "crond" ]; then
if [ $update_once == 0 ];then
apt-get -y update >/dev/null 2>&1
update_once=1
fi
if apt-get -y install "$depend" >/dev/null 2>&1; then
echo -e "$info 依赖 $depend 安装成功..."
else
echo -e "$error 依赖 $depend 安装失败..." && exit 1
fi
fi
;;
*) echo -e "\n系统不支持!" && exit 1
;;
esac
fi
done
}
ChangeDate(){
rm -rf /etc/localtime
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
}
RestartCron(){
case "$release" in
"rpm")
if [ "$release_ver_main" == "7" ]; then
systemctl restart crond.service
else
/etc/init.d/crond restart
fi
;;
"deb"|"ubu") /etc/init.d/cron restart
;;
*) echo "$error 重启cron发生错误!"
;;
esac
}
InstallSsr(){
echo -e "$info 开始下载/安装 ShadowsocksR文件..."
wget --no-check-certificate "https://github.com/woniuzfb/shadowsocksr/archive/manyuser.zip" -qO manyuser.zip
[ ! -e "./manyuser.zip" ] && echo -e "$error ShadowsocksR服务端 压缩包 下载失败 !" && exit 1
unzip "./manyuser.zip" >/dev/null 2>&1 && rm -rf "./manyuser.zip"
[ ! -e "./shadowsocksr-manyuser/" ] && echo -e "$error ShadowsocksR服务端 解压失败 !" && exit 1
mv "./shadowsocksr-manyuser" "$SSR_PATH"
[ ! -d "$SSR_PATH" ] && echo -e "$error 移动 ShadowsocksR服务端 失败 !" && exit 1
cp "$SSR_PATH/config.json" "$USER_CONFIG_FILE"
cp "$SSR_PATH/mysql.json" "$USERMYSQL_FILE"
cp "$SSR_PATH/apiconfig.py" "$USER_API_CONFIG_FILE"
[ ! -e "$USER_API_CONFIG_FILE" ] && echo -e "$error ShadowsocksR服务端 apiconfig.py 复制失败 !" && exit 1
sed -i "s/API_INTERFACE = 'sspanelv2'/API_INTERFACE = 'mudbjson'/" "$USER_API_CONFIG_FILE"
sed -i 's/ \/\/ only works under multi-user mode//g' "$USER_CONFIG_FILE"
echo -e "$info ShadowsocksR服务端 下载完成 !"
if wget --no-check-certificate https://raw.githubusercontent.com/woniuzfb/ssr/master/ssrmu.init -qO /etc/init.d/ssrmu; then
chmod +x /etc/init.d/ssrmu
case "$release" in
"rpm")
chkconfig --add ssrmu
chkconfig ssrmu on
;;
"deb"|"ubu")
update-rc.d -f ssrmu defaults
;;
*) echo -e "$error 系统不支持 !" && exit 1
;;
esac
echo -e "$info ShadowsocksR服务 管理脚本下载完成 !"
else
echo -e "$error ShadowsocksR服务 管理脚本下载失败 !" && exit 1
fi
}
UninstallSsr(){
[ ! -e "$SSR_PATH" ] && echo -e "$error 没有安装 ShadowsocksR,请检查 !" && exit 1
CheckRelease
echo "确定要 卸载ShadowsocksR?[Y/n]" && echo
read -p "(默认: n):" uninstall_ssr_yn
[ -z "$uninstall_ssr_yn" ] && uninstall_ssr_yn="n"
if [[ "$uninstall_ssr_yn" == [Yy] ]]; then
StopSsr
GetAccsInfo
for acc_port in "${accs_port[@]}"; do
DelIptables
done
if crontab -l | grep -q "ssrmu.sh"; then
ClearTransferAllCronStop
fi
if [ "$release" = "rpm" ]; then
chkconfig --del ssrmu
else
update-rc.d -f ssrmu remove
fi
rm -rf "$SSR_PATH" && rm -rf /etc/init.d/ssrmu
echo && echo " ShadowsocksR 卸载完成 !" && echo
else
echo && echo " 卸载已取消..." && echo
fi
}
InstallJq(){
if [ ! -e "$JQ_FILE" ]; then
echo -e "$info 开始下载/安装 JSNO解析器 JQ..."
#experimental# grep -Po '"tag_name": "jq-\K.*?(?=")'
jq_ver=$(curl --silent -m 10 "https://api.github.com/repos/stedolan/jq/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' || true)
if [ -n "$jq_ver" ]; then
wget --no-check-certificate "https://github.com/stedolan/jq/releases/download/$jq_ver/jq-linux$release_bit" -qO "$JQ_FILE"
else
mv "$SSR_PATH/jq-linux$release_bit" "$JQ_FILE"
fi
[ ! -e "$JQ_FILE" ] && echo -e "$error 下载JQ解析器失败,请检查 !" && exit 1
chmod +x "$JQ_FILE"
echo -e "$info JQ解析器 安装完成..."
else
echo -e "$info JQ解析器 已安装..."
fi
}
GetServerIp(){
server_ip=$(ip addr | grep -E -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' | grep -E -v "^192\.168|^172\.1[6-9]\.|^172\.2[0-9]\.|^172\.3[0-2]\.|^10\.|^127\.|^255\.|^0\." | head -n 1 || true)
[ -z "$server_ip" ] && server_ip=$(curl --silent ipv4.icanhazip.com)
[ -z "$server_ip" ] && server_ip=$(curl --silent ipinfo.io/ip)
[ -z "$server_ip" ] && server_ip=$(curl --silent api.ip.sb/ip)
if [ -z "$server_ip" ]; then
echo "无法获取本机IP,请手动输入" && exit 1
fi
}
SetServerName(){
echo "请输入 服务器IP或域名
默认为本机外网IP,如果要自动检测外网IP,请留空直接回车"
read -p "(默认: 本机IP):" server_name
if [ -z "$server_name" ]; then
GetServerIp
server_name=$server_ip
fi
sed -i "s/SERVER_PUB_ADDR = '127.0.0.1'/SERVER_PUB_ADDR = '$server_name'/" "$USER_API_CONFIG_FILE"
echo && echo -e " IP/域名: $red_background $server_name $plain" && echo
}
RandAccUser(){
name_size=8
name_array=(
q w e r t y u i o p a s d f g h j k l z x c v b n m Q W E R T Y U I O P A S D
F G H J K L Z X C V B N M
)
name_array_size=${#name_array[*]}
name_len=0
acc_user=""
while :;do
while [ $name_len -lt $name_size ]; do
name_index=$((RANDOM%name_array_size))
acc_user="$acc_user${name_array[$name_index]}"
name_len=$((name_len+1))
done
acc_info=$($JQ_FILE '.[]|select(.user=="'"$acc_user"'")' $MUDB_FILE)
if [ -z "$acc_info" ]; then
break
fi
done
}
SetAccUser(){
echo "请输入要设置的用户 用户名(请勿重复, 用于区分, 不支持中文、空格, 会报错 !)"
while read -p "(默认: 随机):" acc_user; do
acc_user=${acc_user// /}
if [ -z "$acc_user" ]; then
RandAccUser
break
else
acc_info=$($JQ_FILE '.[]|select(.user=="'"$acc_user"'")' $MUDB_FILE)
if [ -z "$acc_info" ]; then
break
else
echo -e "$error 用户名已存在!请重新输入! "
fi
fi
done
echo && echo "$separator" && echo -e " 用户名 : $green$acc_user$plain" && echo "$separator" && echo
}
GetFreePort(){
read lowerport upperport < /proc/sys/net/ipv4/ip_local_port_range
while :;do
acc_port=$(shuf -i "$lowerport"-"$upperport" -n 1)
ss -lpn | grep -q ":$acc_port " || break
done
# OR acc_port=$(python -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()');
}
SetAccPort(){
echo "请输入要设置的用户 端口(请勿重复, 用于区分)"
while read -p "(默认: 随机生成):" acc_port; do
case "$acc_port" in
("")
GetFreePort
break
;;
(*[!0-9]*)
echo -e "$error 请输入正确的数字!(1-65535) "
;;
(*)
if [ "$acc_port" -ge 1 ] && [ "$acc_port" -le 65535 ]; then
acc_info=$($JQ_FILE '.[]|select(.port=="'"$acc_port"'")' $MUDB_FILE)
if [ -z "$acc_info" ]; then
if ss -lpn | grep -q ":$acc_port "; then
echo -e "$error 端口已被其他程序占用!请重新输入! "
else
break
fi
else
echo -e "$error 端口已被其他用户占用!请重新输入! "
fi
else
echo -e "$error 请输入正确的数字!(1-65535) "
fi
;;
esac
done
echo && echo $separator && echo -e " 端口: $green $acc_port $plain" && echo $separator && echo
}
RandPasswd(){
#date +%s | sha256sum | base64 | head -c 10
pass_size=10
pass_array=(
q w e r t y u i o p a s d f g h j k l z x c v b n m Q W E R T Y U I O P A S D
F G H J K L Z X C V B N M ! @
)
pass_array_size=${#pass_array[*]}
pass_len=0
acc_passwd=""
while [ $pass_len -lt $pass_size ]; do
pass_index=$((RANDOM%pass_array_size))
acc_passwd="$acc_passwd${pass_array[$pass_index]}"
pass_len=$((pass_len+1))
done
}
SetAccPasswd(){
echo "请输入要设置的用户 密码"
read -p "(默认: 随机生成):" acc_passwd
[ -z "$acc_passwd" ] && RandPasswd
echo && echo "$separator" && echo -e " 密码 : $green$acc_passwd$plain" && echo "$separator" && echo
}
SetAccMethod(){
echo -e "请选择要设置的用户 加密方式
${green}1.$plain none
$tip 如果使用 auth_chain_* 系列协议,建议加密方式选择 none (该系列协议自带 RC4 加密),混淆随意
${green}2.$plain rc4
${green}3.$plain rc4-md5
${green}4.$plain rc4-md5-6
${green}5.$plain aes-128-ctr
${green}6.$plain aes-192-ctr
${green}7.$plain aes-256-ctr
${green}8.$plain aes-128-cfb
${green}9.$plain aes-192-cfb
${green}10.$plain aes-256-cfb
${green}11.$plain aes-128-cfb8
${green}12.$plain aes-192-cfb8
${green}13.$plain aes-256-cfb8
${green}14.$plain salsa20
${green}15.$plain chacha20
${green}16.$plain chacha20-ietf
$tip salsa20/chacha20-*系列加密方式,需要额外安装依赖 libsodium ,否则会无法启动ShadowsocksR !" && echo
read -p "(默认: 10. aes-256-cfb):" acc_method_number
acc_method_array=(
none rc4 rc4-md5 rc4-md5-6 aes-128-ctr
aes-192-ctr aes-256-ctr aes-128-cfb aes-192-cfb
aes-256-cfb aes-128-cfb8 aes-192-cfb8 aes-256-cfb8
salsa20 chacha20 chacha20-ietf
)
if [ -z "$acc_method_number" ]; then
acc_method=${acc_method_array[9]}
else
acc_method=${acc_method_array["$acc_method_number" - 1]}
fi
echo && echo "$separator" && echo -e " 加密 : $green$acc_method$plain" && echo "$separator" && echo
}
SetAccProtocol(){
echo -e "请选择要设置的用户 协议插件
${green}1.$plain origin
${green}2.$plain auth_sha1_v4
${green}3.$plain auth_aes128_md5
${green}4.$plain auth_aes128_sha1
${green}5.$plain auth_chain_a
${green}6.$plain auth_chain_b
$tip 如果使用 auth_chain_* 系列协议,建议加密方式选择 none (该系列协议自带 RC4 加密),混淆随意" && echo
read -e -p "(默认: 4. auth_aes128_sha1):" protocol_number
protocol_array=(
origin
auth_sha1_v4
auth_aes128_md5
auth_aes128_sha1
auth_chain_a
auth_chain_b
)
if [ -z "$protocol_number" ]; then
acc_protocol=${protocol_array[3]}
else
acc_protocol=${protocol_array["$protocol_number" - 1]}
fi
if [ "$acc_protocol" == "auth_sha1_v4" ]; then
read -p "是否设置 协议插件兼容原版(_compatible)?[Y/n 默认否]" protocol_yn
[ -z "$protocol_yn" ] && protocol_yn="n"
[[ $protocol_yn == [Yy] ]] && acc_protocol=$acc_protocol"_compatible"
echo
fi
echo && echo "$separator" && echo -e " 协议 : $green$acc_protocol$plain" && echo "$separator" && echo
}
SetAccProtocolParam(){
echo -e "请输入要设置的用户 欲限制的设备数 ($green auth_* 系列协议 不兼容原版才有效 $plain)"
echo -e "$tip 设备数限制:每个端口同一时间能链接的客户端数量(多端口模式,每个端口都是独立计算),建议最少 2个。"
while read -p "(默认: 无限):" acc_protocol_param; do
case "$acc_protocol_param" in
("")
break
;;
(*[!0-9]*)
echo -e "$error 请输入正确的数字(1-9999) "
;;
(*)
if [ "$acc_protocol_param" -ge 1 ] && [ "$acc_protocol_param" -le 9999 ]; then
break
else
echo -e "$error 请输入正确的数字(1-9999)"
fi
;;
esac
done
[ "$acc_protocol_param" == "" ] && acc_protocol_param_text="无限" || acc_protocol_param_text="$acc_protocol_param"
echo && echo "$separator" && echo -e " 设备数限制 : $green$acc_protocol_param_text$plain" && echo "$separator" && echo
}
SetAccObfs(){
echo -e "请选择要设置的用户 混淆插件
${green}1.$plain plain
${green}2.$plain http_simple
${green}3.$plain http_post
${green}4.$plain random_head
${green}5.$plain tls1.2_ticket_auth
$tip 如果使用 ShadowsocksR 代理游戏,建议选择 混淆兼容原版或 plain 混淆,然后客户端选择 plain,否则会增加延迟 !
另外, 如果你选择了 tls1.2_ticket_auth,那么客户端可以选择 tls1.2_ticket_fastauth,这样即能伪装又不会增加延迟 !
如果你是在日本、美国等热门地区搭建,那么选择 plain 混淆可能被墙几率更低 !" && echo
read -p "(默认: 5. tls1.2_ticket_auth):" obfs_number
obfs_array=(
plain
http_simple
http_post
random_head
tls1.2_ticket_auth
)
if [ -z "$obfs_number" ]; then
acc_obfs=${obfs_array[4]}
else
acc_obfs=${obfs_array["$obfs_number" - 1]}
fi
if [ "$acc_obfs" != "plain" ]; then
read -p "是否设置 混淆插件兼容原版(_compatible)?[Y/n 默认否]" obfs_compa_yn
[ -z "$obfs_compa_yn" ] && obfs_compa_yn="n"
[[ "$obfs_compa_yn" == [Yy] ]] && acc_obfs=$acc_obfs"_compatible"
fi
echo && echo "$separator" && echo -e " 混淆 : $green$acc_obfs$plain" && echo "$separator" && echo
}
SetAccObfsParam(){
echo -e "请输入要设置的混淆参数 ($green 伪装 $plain)"
read -p "(默认: 随机):" acc_obfs_param
[ -z "$acc_obfs_param" ] && acc_obfs_param=$(echo a"$(od -An -N2 -i /dev/random)" | sed 's/ //g')."wns.windows.com"
echo "$separator" && echo -e " 混淆参数 : $green$acc_obfs_param$plain" && echo "$separator"
}
SetAccSpeedCon(){
echo -e "请输入要设置的用户 单线程 限速上限(单位:KB/S)"
echo -e "$tip 单线程限速:每个端口 单线程的限速上限,多线程即无效。"
while read -p "(默认: 无限):" acc_speed_con; do
case "$acc_speed_con" in
("")
break
;;
(*[!0-9]*)
echo -e "$error 请输入正确的数字(1-131072) "
;;
(*)
if [ "$acc_speed_con" -ge 1 ] && [ "$acc_speed_con" -le 131072 ]; then
break
else
echo -e "$error 请输入正确的数字(1-131072)"
fi
;;
esac
done
if [ -z "$acc_speed_con" ]; then
acc_speed_con=0
acc_speed_con_text="无限"
else
acc_speed_con_byte=$(numfmt --from=iec "$acc_speed_con"K)
acc_speed_con_text=$(numfmt --to=iec --suffix=B "$acc_speed_con_byte")"/s"
fi
echo && echo "$separator" && echo -e " 单线程限速 : $green$acc_speed_con_text$plain" && echo "$separator" && echo
}
SetAccSpeedUser(){
echo -e "请输入要设置的用户 总速度 限速上限(单位:KB/S)"
echo -e "$tip 端口总限速:每个端口 总速度 限速上限,单个端口整体限速。"
while read -p "(默认: 无限):" acc_speed_user; do
case "$acc_speed_user" in
("")
break
;;
(*[!0-9]*)
echo -e "$error 请输入正确的数字(1-131072) "
;;
(*)
if [ "$acc_speed_user" -ge 1 ] && [ "$acc_speed_user" -le 131072 ]; then
break
else
echo -e "$error 请输入正确的数字(1-131072)"
fi
;;
esac
done
if [ -z "$acc_speed_user" ]; then
acc_speed_user=0
acc_speed_user_text="无限"
else
acc_speed_user_byte=$(numfmt --from=iec "$acc_speed_user"K)
acc_speed_user_text=$(numfmt --to=iec --suffix=B "$acc_speed_user_byte")"/s"
fi
echo && echo "$separator" && echo -e " 用户总限速 : $green$acc_speed_user_text$plain" && echo "$separator" && echo
}
SetAccTransfer(){
echo -e "请输入要设置的用户 可使用的总流量上限(单位: GB, 1-838868 GB)"
while read -p "(默认: 1000G):" acc_transfer; do
case "$acc_transfer" in
("")
acc_transfer="1000" && echo && break
;;
(*[!0-9]*)
echo -e "$error 请输入正确的数字(1-838868) "
;;
(*)
if [ "$acc_transfer" -ge 1 ] && [ "$acc_transfer" -le 838868 ]; then
break
else
echo -e "$error 请输入正确的数字(1-838868)"
fi
;;
esac
done
if [ "$acc_transfer" == "838868" ]; then
acc_transfer_enable_text="无限"
else
acc_transfer_enable=$(numfmt --from=iec "$acc_transfer"G)
acc_transfer_enable_text=$(numfmt --to=iec "$acc_transfer_enable")
fi
acc_u_text="0B"
acc_d_text="0B"
acc_transfer_used_text="0B"
acc_transfer_left_text=$acc_transfer_enable_text
echo && echo "$separator" && echo -e " 用户总限速 : $green$acc_transfer_enable_text$plain" && echo "$separator" && echo
}
SetAccForbid(){
echo "请输入要设置的用户 禁止访问的端口"
echo -e "$tip 禁止的端口:例如不允许访问 25端口,用户就无法通过SSR代理访问 邮件端口25了,如果禁止了 80,443 那么用户将无法正常访问 http/https 网站。
封禁单个端口格式: 25
封禁多个端口格式: 23,465
封禁 端口段格式: 233-266
封禁多种格式端口: 25,465,233-666 (不带冒号:)"
read -p "(默认为空 不禁止访问任何端口):" acc_forbidden_port
[ -z "$acc_forbidden_port" ] && acc_forbidden_port_text="无" || acc_forbidden_port_text="$acc_forbidden_port"
echo && echo "$separator" && echo -e " 禁止的端口 : $green$acc_forbidden_port_text$plain" && echo "$separator" && echo
}
AddIptables(){
if firewall-cmd -h > /dev/null 2>&1; then #centos 7
default_zone=$(firewall-cmd --get-default-zone)
firewall-cmd --permanent --zone="$default_zone" --add-port="$acc_port/tcp"
firewall-cmd --permanent --zone="$default_zone" --add-port="$acc_port/udp"
firewall-cmd --reload || true
elif iptables -h > /dev/null 2>&1; then
iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport "$acc_port" -j ACCEPT
iptables -I INPUT -m state --state NEW -m udp -p udp --dport "$acc_port" -j ACCEPT
ip6tables -I INPUT -m state --state NEW -m tcp -p tcp --dport "$acc_port" -j ACCEPT
ip6tables -I INPUT -m state --state NEW -m udp -p udp --dport "$acc_port" -j ACCEPT
if [ "$release" == "rpm" ]; then
/etc/init.d/iptables save
/etc/init.d/iptables restart
else
iptables-save > /etc/iptables.up.rules
ip6tables-save > /etc/ip6tables.up.rules
echo -e '#!/bin/bash\n/sbin/iptables-restore < /etc/iptables.up.rules\n/sbin/ip6tables-restore < /etc/ip6tables.up.rules' > /etc/network/if-pre-up.d/iptables
chmod +x /etc/network/if-pre-up.d/iptables
fi
else
echo -e "$error 设置防火墙失败!请检查!" && exit 1
fi
echo -e "$info 防火墙设置成功!" && echo
}
DelIptables(){
if firewall-cmd -h > /dev/null 2>&1; then #centos 7
default_zone=$(firewall-cmd --get-default-zone)
firewall-cmd --permanent --zone="$default_zone" --remove-port="$acc_port/tcp"
firewall-cmd --permanent --zone="$default_zone" --remove-port="$acc_port/udp"
firewall-cmd --reload || true
elif iptables -h > /dev/null 2>&1; then
iptables -D INPUT -m state --state NEW -m tcp -p tcp --dport "$acc_port" -j ACCEPT
iptables -D INPUT -m state --state NEW -m udp -p udp --dport "$acc_port" -j ACCEPT
ip6tables -D INPUT -m state --state NEW -m tcp -p tcp --dport "$acc_port" -j ACCEPT
ip6tables -D INPUT -m state --state NEW -m udp -p udp --dport "$acc_port" -j ACCEPT
if [ "$release" == "rpm" ]; then
/etc/init.d/iptables save
/etc/init.d/iptables restart
else
iptables-save > /etc/iptables.up.rules
ip6tables-save > /etc/ip6tables.up.rules
rm /etc/network/if-pre-up.d/iptables
fi
fi
}
GetAccsInfo(){
accs_count=$($JQ_FILE -r '. | length' $MUDB_FILE)
[ "$accs_count" == 0 ] && echo -e "$error 没有发现 用户,请检查 !" && exit 1
IFS=" " read -a accs_d <<< "$($JQ_FILE -r '[.[].d] | @sh' $MUDB_FILE)"
# OR accs_d=($($JQ_FILE -r '[.[].d] | @sh' $MUDB_FILE))
#IFS=" " read -a accs_enable <<< "$($JQ_FILE -r '[.[].enable] | @sh' $MUDB_FILE)"
#IFS=" " read -a accs_forbidden_port <<< "$($JQ_FILE -r '[.[].forbidden_port] | @sh' $MUDB_FILE)"
#IFS=" " read -a accs_method <<< "$($JQ_FILE -r '[.[].method] | @sh' $MUDB_FILE)"
#IFS=" " read -a accs_obfs <<< "$($JQ_FILE -r '[.[].obfs] | @sh' $MUDB_FILE)"
#IFS=" " read -a accs_obfs_param <<< "$($JQ_FILE -r '[.[].obfs_param] | @sh' $MUDB_FILE)"
#IFS=" " read -a accs_passwd <<< "$($JQ_FILE -r '[.[].passwd] | @sh' $MUDB_FILE)"
IFS=" " read -a accs_port <<< "$($JQ_FILE -r '[.[].port] | @sh' $MUDB_FILE)"
#IFS=" " read -a accs_protocol <<< "$($JQ_FILE -r '[.[].protocol] | @sh' $MUDB_FILE)"
#IFS=" " read -a accs_protocol_param <<< "$($JQ_FILE -r '[.[].protocol_param] | @sh' $MUDB_FILE)"
#IFS=" " read -a accs_speed_con <<< "$($JQ_FILE -r '[.[].speed_limit_per_con] | @sh' $MUDB_FILE)"
#IFS=" " read -a accs_speed_user <<< "$($JQ_FILE -r '[.[].speed_limit_per_user] | @sh' $MUDB_FILE)"
IFS=" " read -a accs_transfer_enable <<< "$($JQ_FILE -r '[.[].transfer_enable] | @sh' $MUDB_FILE)"
IFS=" " read -a accs_u <<< "$($JQ_FILE -r '[.[].u] | @sh' $MUDB_FILE)"
IFS=" " read -a accs_user <<< "$($JQ_FILE -r '[.[].user] | @sh' $MUDB_FILE)"
}
#BytesToHuman() {
# b=${1:-0}; d=''; s=0; S=(Bytes {K,M,G,T,P,E,Z,Y}B)
# while ((b > 1024)); do
# d="$(printf ".%02d" $((b % 1024 * 100 / 1024)))"
# b=$((b / 1024))
# let s++
# done
# echo "$b$d ${S[$s]}"
#}
ListAccs(){
GetAccsInfo
accs_list=""
accs_transfer_used=0
for((index = 0; index < "$accs_count"; index++)); do
acc_transfer_used=$((accs_d[index]+accs_u[index]))
acc_transfer_used_text=$(numfmt --to=iec --suffix=B "$acc_transfer_used")
acc_transfer_left=$((accs_transfer_enable[index]-acc_transfer_used))
[[ acc_transfer_left -lt 0 ]] && acc_transfer_left=0
acc_transfer_left_text=$(numfmt --to=iec --suffix=B "$acc_transfer_left")
accs_transfer_used=$((acc_transfer_used+accs_transfer_used))
acc_transfer_enable_text=$(numfmt --to=iec --suffix=B "${accs_transfer_enable[index]}")
accs_list=$accs_list"#$((index+1)) 用户名: $green${accs_user[index]}$plain\t 端口: $green${accs_port[index]}$plain\t 流量使用情况(已用+剩余=总): $green$acc_transfer_used_text$plain + $green$acc_transfer_left_text$plain = $green$acc_transfer_enable_text$plain\n"
done
accs_transfer_used_text=$(numfmt --to=iec --suffix=B "$accs_transfer_used")
echo && echo -e "=== 用户总数 $green $accs_count $plain"
echo -e "$accs_list"
echo -e "=== 当前所有用户已使用流量总和: $green $accs_transfer_used_text $plain\n"
}
GetAccInfo(){
acc_info_array=()
while IFS='' read -r acc_line; do
acc_info_array+=("$acc_line");
done < <($JQ_FILE -r '.[] | select(.port=='"$acc_port"') | .[] | @sh' $MUDB_FILE)
read acc_d acc_enable acc_forbidden_port acc_method acc_obfs acc_obfs_param acc_passwd acc_port acc_protocol acc_protocol_param acc_speed_con acc_speed_user acc_transfer_enable acc_u acc_user <<< "${acc_info_array[@]}"
acc_forbidden_port=${acc_forbidden_port//\'/}
acc_method=${acc_method//\'/}
acc_obfs=${acc_obfs//\'/}
acc_obfs_param=${acc_obfs_param//\'/}
acc_passwd=${acc_passwd//\'/}
acc_protocol=${acc_protocol//\'/}
acc_protocol_param=${acc_protocol_param//\'/}
acc_user=${acc_user//\'/}
acc_transfer_used=$(((acc_d+accs_u)))
acc_transfer_left=$((acc_transfer_enable-acc_transfer_used))
acc_d_text=$(numfmt --to=iec --suffix=B "$acc_d")
acc_u_text=$(numfmt --to=iec --suffix=B "$acc_u")
[ "$acc_protocol_param" == "" ] && acc_protocol_param_text="无限" || acc_protocol_param_text="$acc_protocol_param"
acc_speed_con_byte=$(numfmt --from=iec "$acc_speed_con"K)
if [ "$acc_speed_con" == "0" ]; then
acc_speed_con_text="无限"
else
acc_speed_con_text=$(numfmt --to=iec --suffix=B "$acc_speed_con_byte")"/s"
fi
acc_speed_user_byte=$(numfmt --from=iec "$acc_speed_user"K)
if [ "$acc_speed_user" == "0" ]; then
acc_speed_user_text="无限"
else
acc_speed_user_text=$(numfmt --to=iec --suffix=B "$acc_speed_user_byte")"/s"
fi
[ "$acc_forbidden_port" == "" ] && acc_forbidden_port_text="无" || acc_forbidden_port_text="$acc_forbidden_port"
acc_transfer_used_text=$(numfmt --to=iec --suffix=B "$acc_transfer_used")
[[ acc_transfer_left -lt 0 ]] && acc_transfer_left=0
acc_transfer_left_text=$(numfmt --to=iec --suffix=B "$acc_transfer_left")
acc_transfer_enable_text=$(numfmt --to=iec --suffix=B "$acc_transfer_enable")
}
ViewAccInfo(){
clear && echo "===================================================" && echo
echo -e " 用户 [$acc_user] 的配置信息:" && echo
echo -e " 地址\t : $green$server_name$plain"
echo -e " 端口\t : $green$acc_port$plain"
echo -e " 密码\t : $green$acc_passwd$plain"
echo -e " 加密\t : $green$acc_method$plain"
echo -e " 协议\t : $red$acc_protocol$plain"
echo -e " 混淆\t : $red$acc_obfs$plain"
echo -e " 混淆的参数 : $green$acc_obfs_param$plain"
echo -e " 设备数限制 : $green$acc_protocol_param_text$plain"
echo -e " 单线程限速 : $green$acc_speed_con_text$plain"
echo -e " 用户总限速 : $green$acc_speed_user_text$plain"
echo -e " 禁止的端口 : $green$acc_forbidden_port_text$plain"
echo
echo -e " 已使用流量 : 上传: $green$acc_u_text$plain + 下载: $green$acc_d_text$plain = $green$acc_transfer_used_text$plain"
echo -e " 剩余的流量 : $green$acc_transfer_left_text$plain"
echo -e " 用户总流量 : $green$acc_transfer_enable_text$plain"
echo -e "$ss_link"
echo -e "$ssr_link"
echo
}
AddAcc(){
SetAccUser
SetAccPort
SetAccPasswd
SetAccMethod
SetAccProtocol
SetAccProtocolParam
SetAccObfs
SetAccObfsParam
SetAccSpeedCon
SetAccSpeedUser
SetAccTransfer
SetAccForbid
cd "$SSR_PATH"
if python mujson_mgr.py -a -u "$acc_user" -p "$acc_port" -k "$acc_passwd" -m "$acc_method" -O "$acc_protocol" -G "$acc_protocol_param" -o "$acc_obfs" -g "$acc_obfs_param" -s "$acc_speed_con" -S "$acc_speed_user" -t "$acc_transfer" -f "$acc_forbidden_port"|grep -q "add user info"; then
echo -e "$info 用户添加成功! " && echo
else
echo -e "$error 用户添加失败 ${green}[用户名: $acc_user , 端口: $acc_port]$plain "
exit 1
fi
AddIptables
SsSsrLink
ViewAccInfo
}
AddAccAgain(){
while read -p "是否继续 添加用户配置?[Y/n 默认否]:" add_again_yn; do
[ -z "$add_again_yn" ] && add_again_yn="n"
if [[ "$add_again_yn" == [Nn] ]]; then
break
else
echo -e "$info 继续 添加用户配置..."
AddAcc
fi
done
}
SsSsrLink(){
ss_link=""
server_name=$(< "$USER_API_CONFIG_FILE" grep "SERVER_PUB_ADDR = "|awk -F "[']" '{print $2}')
if [ "$acc_protocol" == "origin" ] || [ "$acc_protocol" == "auth_sha1_v4_compatible" ]; then
if [ "$acc_obfs" == "plain" ] || echo "$acc_obfs" | grep -q "_compatible"; then
ss_url="ss://"$(echo -n "$acc_method:$acc_passwd@$server_name:$acc_port"|base64 -w0 |sed 's/=//g;s/\//_/g;s/+/-/g')
ss_link=" SS 链接 : $green$ss_url$plain"
fi
fi
acc_passwd_base64=$(echo -n "$acc_passwd"|base64 -w0 |sed 's/=//g;s/\//_/g;s/+/-/g')
acc_protocol_param_base64=$(echo -n "$acc_protocol_param"|base64 -w0 |sed 's/=//g;s/\//_/g;s/+/-/g')
acc_obfs_param_base64=$(echo -n "$acc_obfs_param"|base64 -w0 |sed 's/=//g;s/\//_/g;s/+/-/g')
ssr_url="ssr://"$(echo -n "$server_name:$acc_port:${acc_protocol//_compatible/}:$acc_method:${acc_obfs//_compatible/}:$acc_passwd_base64/?obfsparam=$acc_obfs_param_base64&protoparam=$acc_protocol_param_base64"|base64 -w0 |sed 's/=//g;s/\//_/g;s/+/-/g')
ssr_link=" SSR 链接 : $red$ssr_url$plain"
}
DownInit(){
if [ -d "$SSR_PATH" ]; then
if [ ! -e "/etc/init.d/ssrmu" ]; then
echo -e "$info 正在下载 ssrmu.init..."
wget --no-check-certificate https://raw.githubusercontent.com/woniuzfb/ssr/master/ssrmu.init -qO /etc/init.d/ssrmu
chmod +x /etc/init.d/ssrmu
fi
else
echo -e "$error ShadowsocksR不存在,请先安装!" && echo && exit 1
fi
}
StartSsr(){
DownInit
/etc/init.d/ssrmu start
}
StopSsr(){
DownInit
/etc/init.d/ssrmu stop
}
RestartSsr(){
DownInit
/etc/init.d/ssrmu restart
}
InstallSsrMenu(){
[ -d "$SSR_PATH" ] && echo -e "$error ShadowsocksR 文件夹已存在,请检查( 如安装失败或者存在旧版本,请先卸载 ) !" && exit 1
echo -e "$info 开始安装/配置 ShadowsocksR依赖..."
CheckRelease
ChangeDate
RestartCron
InstallSsr
InstallJq
SetServerName
echo -e "$info 开始设置 ShadowsocksR账号配置..."
AddAcc
AddAccAgain
echo -e "$info 所有步骤 安装完毕,开始启动 ShadowsocksR服务端..."
StartSsr
}
ViewAccMenu(){
ListAccs
echo -e "请输入要查看的账号端口 "
while read -p "(默认: 取消):" acc_port; do
case "$acc_port" in
("")
echo "已取消..." && exit 1
;;
(*[!0-9]*)
echo -e "$error 请输入正确的数字!"
;;
(*)
if [ -n "$($JQ_FILE '.[] | select(.port=='"$acc_port"')' $MUDB_FILE)" ]; then
break;
else
echo -e "$error 请输入正确的端口!"
fi
;;
esac
done
GetAccInfo
SsSsrLink
ViewAccInfo
}
InstallLibsodium(){
CheckRelease
if [ -e "/usr/local/lib/libsodium.so" ] || [ -e "/usr/lib/libsodium.so" ]; then
echo -e "$error libsodium 已安装 , 是否覆盖安装(更新)?[Y/n]"
read -e -p "(默认: n):" libso_yn
[ -z "$libso_yn" ] && libso_yn="n"
[[ "$libso_yn" == [Nn] ]] && echo "已取消..." && exit 1
else
echo -e "$info libsodium 未安装,开始安装..."
fi
echo -e "$info 开始获取 libsodium 最新版本..."
#experimental# grep -Po '"tag_name": "\K.*?(?=")'
libso_ver=$(curl --silent "https://api.github.com/repos/jedisct1/libsodium/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/' || true)
[ -z "$libso_ver" ] && libso_ver=$libso_ver_default
echo -e "$info libsodium 最新版本为 $green$libso_ver$plain !"
if [ "$release" == "rpm" ]; then
yum -y update
echo -e "$info 安装依赖..."
yum -y groupinstall "Development Tools"
echo -e "$info 下载..."
wget --no-check-certificate "https://github.com/jedisct1/libsodium/releases/download/$libso_ver/libsodium-$libso_ver.tar.gz" -qO "libsodium-$libso_ver.tar.gz"
echo -e "$info 解压..."
tar -xzf libsodium-$libso_ver.tar.gz && cd libsodium-"$libso_ver"
echo -e "$info 编译安装..."
./configure && make && make install
else
apt-get -y update
echo -e "$info 安装依赖..."
apt-get -y install build-essential
echo -e "$info 下载..."
wget --no-check-certificate "https://github.com/jedisct1/libsodium/releases/download/$libso_ver/libsodium-$libso_ver.tar.gz" -qO "libsodium-$libso_ver.tar.gz"
echo -e "$info 解压..."
tar -xzf libsodium-$libso_ver.tar.gz && cd libsodium-$libso_ver
echo -e "$info 编译安装..."
./configure && make && make install
fi
if ! ldconfig -p | grep -q "/usr/local/lib"; then
echo "/usr/local/lib" > /etc/ld.so.conf.d/usr_local_lib.conf
fi
ldconfig
cd .. && rm -rf libsodium-$libso_ver.tar.gz && rm -rf libsodium-$libso_ver
[ ! -e "/usr/local/lib/libsodium.so" ] && echo -e "$error libsodium 安装失败 !" && exit 1
echo && echo -e "$info libsodium 安装成功 !" && echo
}
ViewConnection(){
CheckRelease
echo && echo -e "请选择要显示的格式:
${green}1.$plain 显示 IP 格式
${green}2.$plain 显示 IP+IP归属地 格式" && echo
read -p "(默认: 1):" view_con_num
[ -z "$view_con_num" ] && view_con_num="1"
if [ "$view_con_num" != "1" ] && [ "$view_con_num" != "2" ]; then
echo -e "$error 请输入正确的数字(1-2)" && exit 1
else
GetAccsInfo
accs_list=""
accs_ip_count=0
for((index=0;index<accs_count;index++)); do
acc_user="${accs_user[index]}"
acc_port="${accs_port[index]}"
acc_ip=$(ss -taH state established '( sport = :'"$acc_port"' )' |awk '{print $4}'|grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}"|sort -u|grep -v 'Segmentation fault' || true)
if [ "$view_con_num" == "2" ]; then
acc_ip_new=""
echo -e "$tip 检测IP归属地(ipip.net),如果IP较多,可能时间会比较长..."
IFS=' ' read -a acc_ip_array <<< "$acc_ip"
for one_ip in "${acc_ip_array[@]}"; do
one_ip_info=$(wget -qO- -t1 -T2 http://freeapi.ipip.net/"$one_ip"|sed 's/\"//g;s/,//g;s/\[//g;s/\]//g')
acc_ip_new="$acc_ip_new$one_ip($one_ip_info) "
done
acc_ip=$acc_ip_new
fi
acc_ip_count=$(echo "$acc_ip"|wc -w)
accs_ip_count=$((accs_ip_count+acc_ip_count))
accs_list=${accs_list}"#$((index+1)) 用户名: $green$acc_user$plain\t 端口: $green$acc_port$plain\t 链接IP总数: $green$acc_ip_count$plain\t 当前链接IP: $green$acc_ip$plain\n"
done
echo -e "用户总数: $green $accs_count $plain 链接IP总数: $green $accs_ip_count $plain "
echo -e "$accs_list"
fi
}
ReadAccPort(){
ListAccs
echo -e "请输入用户 端口"
while read -p "(默认: 取消):" acc_port; do
[ -z "$acc_port" ] && echo -e "已取消..." && exit 1
if [ -n "$($JQ_FILE '.[] | select(.port=='"$acc_port"')' $MUDB_FILE)" ]; then
break
else
echo -e "$error 请输入正确的端口 !"
fi
done
}
ConfigAccDel(){
if python mujson_mgr.py -d -p "$acc_port"|grep -q "delete user "; then
DelIptables
echo -e "$info 用户删除成功 ${green}[端口: $acc_port]$plain "
else
echo -e "$error 用户删除失败 ${green}[端口: $acc_port]$plain "
fi
}
ConfigAccPasswd(){
if python mujson_mgr.py -e -p "$acc_port" -k "$acc_passwd"|grep -q "edit user "; then
echo -e "$info 用户密码修改成功 ${green}[端口: $acc_port]$plain (注意:可能需要十秒左右才会应用最新配置)"
else
echo -e "$error 用户密码修改失败 ${green}[端口: $acc_port]$plain " && exit 1
fi
}
ConfigAccMethod(){
if python mujson_mgr.py -e -p "$acc_port" -m "$acc_method"|grep -q "edit user "; then
echo -e "$info 用户加密方式修改成功 ${green}[端口: $acc_port]$plain (注意:可能需要十秒左右才会应用最新配置)"
else
echo -e "$error 用户加密方式修改失败 ${green}[端口: $acc_port]$plain " && exit 1
fi
}
ConfigAccProtocol(){
if python mujson_mgr.py -e -p "$acc_port" -O "$acc_protocol"|grep -q "edit user "; then
echo -e "$info 用户协议修改成功 ${green}[端口: $acc_port]$plain (注意:可能需要十秒左右才会应用最新配置)"
else
echo -e "$error 用户协议修改失败 ${green}[端口: $acc_port]$plain " && exit 1
fi
}
ConfigAccObfs(){
if python mujson_mgr.py -e -p "$acc_port" -o "$acc_obfs"|grep -q "edit user "; then
echo -e "$info 用户混淆修改成功 ${green}[端口: $acc_port]$plain (注意:可能需要十秒左右才会应用最新配置)"
else
echo -e "$error 用户混淆修改失败 ${green}[端口: $acc_port]$plain " && exit 1
fi
}
ConfigAccObfsParam(){
if python mujson_mgr.py -e -p "$acc_port" -g "$acc_obfs_param"|grep -q "edit user "; then