From f48eac402cf2bd2f457cc96c84b6a69effb19880 Mon Sep 17 00:00:00 2001 From: Toyo Date: Sat, 6 Oct 2018 18:44:10 +0800 Subject: [PATCH] =?UTF-8?q?#=20=E5=BD=BB=E5=BA=95=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=E9=80=80=E6=A0=BC=E9=94=AE=E6=8F=90=E7=A4=BA=20^=3F=20?= =?UTF-8?q?=E6=88=96=20^H=20=E4=BB=A5=E5=8F=8A=E5=85=B6=E4=BB=96=E6=8C=89?= =?UTF-8?q?=E9=94=AE=E6=97=A0=E6=B3=95=E4=BD=BF=E7=94=A8=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- adbyby.sh | 4 +-- aria2.sh | 22 ++++++------- ban_iptables.sh | 16 +++++----- base64.sh | 43 +++++++++++++++++++++++++ bbr.sh | 6 ++-- brook-pf.sh | 34 ++++++++++---------- brook.sh | 24 +++++++------- caddy_install.sh | 4 +-- cloudt.sh | 18 +++++------ dowsdns.sh | 34 ++++++++++---------- goflyway.sh | 24 +++++++------- gogo.sh | 4 +-- haproxy.sh | 8 ++--- iptables-pf.sh | 20 ++++++------ libsodium.sh | 2 +- lightsocks.sh | 16 +++++----- mtproxy.sh | 26 +++++++-------- ocserv.sh | 26 +++++++-------- pipes.sh | 10 +++--- pserver.sh | 6 ++-- pythonhttp.sh | 6 ++-- socat.sh | 16 +++++----- ssh_port.sh | 4 +-- ssr.sh | 56 ++++++++++++++++----------------- ssr_check.sh | 16 +++++----- ssrmu.sh | 82 ++++++++++++++++++++++++------------------------ ssrstatus.sh | 44 +++++++++++++------------- status.sh | 48 ++++++++++++++-------------- tinymapper.sh | 18 +++++------ 29 files changed, 340 insertions(+), 297 deletions(-) create mode 100644 base64.sh diff --git a/adbyby.sh b/adbyby.sh index 08396a2..d6e52c6 100644 --- a/adbyby.sh +++ b/adbyby.sh @@ -130,7 +130,7 @@ Uninstall_adbyby(){ check_installed_status echo "确定要卸载 ADbyby ? (y/N)" echo - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then check_pid @@ -195,7 +195,7 @@ else echo -e " 当前状态: ${Red_font_prefix}未安装${Font_color_suffix}" fi echo -stty erase '^H' && read -p " 请输入数字 [1-8]:" num +read -e -p " 请输入数字 [1-8]:" num case "$num" in 1) Install_adbyby diff --git a/aria2.sh b/aria2.sh index 0515e51..ed7a905 100644 --- a/aria2.sh +++ b/aria2.sh @@ -72,7 +72,7 @@ check_new_ver(){ aria2_new_ver=$(wget --no-check-certificate -qO- https://api.github.com/repos/q3aql/aria2-static-builds/releases | grep -o '"tag_name": ".*"' |head -n 1| sed 's/"//g;s/v//g' | sed 's/tag_name: //g') if [[ -z ${aria2_new_ver} ]]; then echo -e "${Error} Aria2 最新版本获取失败,请手动获取最新版本号[ https://github.com/q3aql/aria2-static-builds/releases ]" - stty erase '^H' && read -p "请输入版本号 [ 格式如 1.34.0 ] :" aria2_new_ver + read -e -p "请输入版本号 [ 格式如 1.34.0 ] :" aria2_new_ver [[ -z "${aria2_new_ver}" ]] && echo "取消..." && exit 1 else echo -e "${Info} 检测到 Aria2 最新版本为 [ ${aria2_new_ver} ]" @@ -83,7 +83,7 @@ check_ver_comparison(){ [[ -z ${aria2_now_ver} ]] && echo -e "${Error} Brook 当前版本获取失败 !" && exit 1 if [[ "${aria2_now_ver}" != "${aria2_new_ver}" ]]; then echo -e "${Info} 发现 Aria2 已有新版本 [ ${aria2_new_ver} ](当前版本:${aria2_now_ver})" - stty erase '^H' && read -p "是否更新(会中断当前下载任务,请注意) ? [Y/n] :" yn + read -e -p "是否更新(会中断当前下载任务,请注意) ? [Y/n] :" yn [[ -z "${yn}" ]] && yn="y" if [[ $yn == [Yy] ]]; then check_pid @@ -211,7 +211,7 @@ Set_aria2(){ ${Green_font_prefix}3.${Font_color_suffix} 修改 Aria2 文件下载位置 ${Green_font_prefix}4.${Font_color_suffix} 修改 Aria2 密码+端口+文件下载位置 ${Green_font_prefix}5.${Font_color_suffix} 手动 打开配置文件修改" && echo - stty erase '^H' && read -p "(默认: 取消):" aria2_modify + read -e -p "(默认: 取消):" aria2_modify [[ -z "${aria2_modify}" ]] && echo "已取消..." && exit 1 if [[ ${aria2_modify} == "1" ]]; then Set_aria2_RPC_passwd @@ -238,7 +238,7 @@ Set_aria2_RPC_passwd(){ aria2_passwd_1=${aria2_passwd} fi echo -e "请输入要设置的 Aria2 RPC密码(旧密码为:${Green_font_prefix}${aria2_passwd_1}${Font_color_suffix})" - stty erase '^H' && read -p "(默认密码: 随机生成 密码请不要包含等号 = 和井号 #):" aria2_RPC_passwd + read -e -p "(默认密码: 随机生成 密码请不要包含等号 = 和井号 #):" aria2_RPC_passwd echo [[ -z "${aria2_RPC_passwd}" ]] && aria2_RPC_passwd=$(date +%s%N | md5sum | head -c 20) if [[ "${aria2_passwd}" != "${aria2_RPC_passwd}" ]]; then @@ -278,7 +278,7 @@ Set_aria2_RPC_port(){ aria2_port_1=${aria2_port} fi echo -e "请输入要设置的 Aria2 RPC端口(旧端口为:${Green_font_prefix}${aria2_port_1}${Font_color_suffix})" - stty erase '^H' && read -p "(默认端口: 6800):" aria2_RPC_port + read -e -p "(默认端口: 6800):" aria2_RPC_port echo [[ -z "${aria2_RPC_port}" ]] && aria2_RPC_port="6800" if [[ "${aria2_port}" != "${aria2_RPC_port}" ]]; then @@ -324,7 +324,7 @@ Set_aria2_RPC_dir(){ aria2_dir_1=${aria2_dir} fi echo -e "请输入要设置的 Aria2 文件下载位置(旧位置为:${Green_font_prefix}${aria2_dir_1}${Font_color_suffix})" - stty erase '^H' && read -p "(默认位置: /usr/local/caddy/www/aria2/Download):" aria2_RPC_dir + read -e -p "(默认位置: /usr/local/caddy/www/aria2/Download):" aria2_RPC_dir [[ -z "${aria2_RPC_dir}" ]] && aria2_RPC_dir="/usr/local/caddy/www/aria2/Download" echo if [[ -d "${aria2_RPC_dir}" ]]; then @@ -375,7 +375,7 @@ ${Green_font_prefix}2.${Font_color_suffix} 一会自动打开配置文件后, ${Green_font_prefix}3.${Font_color_suffix} 如果要退出并保存文件,那么按 ${Green_font_prefix}Ctrl+X键${Font_color_suffix} 后,输入 ${Green_font_prefix}y${Font_color_suffix} 后,再按一下 ${Green_font_prefix}回车键${Font_color_suffix} 即可。 ${Green_font_prefix}4.${Font_color_suffix} 如果要退出并不保存文件,那么按 ${Green_font_prefix}Ctrl+X键${Font_color_suffix} 后,输入 ${Green_font_prefix}n${Font_color_suffix} 即可。 ${Green_font_prefix}5.${Font_color_suffix} 如果你想在本地编辑配置文件,那么配置文件位置: ${Green_font_prefix}/root/.aria2/aria2.conf${Font_color_suffix} (注意是隐藏目录) 。" && echo - stty erase '^H' && read -p "如果已经理解 nano 使用方法,请按任意键继续,如要取消请使用 Ctrl+C 。" var + read -e -p "如果已经理解 nano 使用方法,请按任意键继续,如要取消请使用 Ctrl+C 。" var nano "${aria2_conf}" Read_config if [[ ${aria2_port_old} != ${aria2_port} ]]; then @@ -436,7 +436,7 @@ Update_bt_tracker(){ if [[ -z "${crontab_update_status}" ]]; then echo && echo -e "当前自动更新模式: ${Red_font_prefix}未开启${Font_color_suffix}" && echo echo -e "确定要开启 ${Green_font_prefix}Aria2 自动更新 BT-Tracker服务器${Font_color_suffix} 功能吗?(一般情况下会加强BT下载效果)[Y/n]" - stty erase '^H' && read -p "注意:该功能会定时重启 Aria2!(默认: y):" crontab_update_status_ny + read -e -p "注意:该功能会定时重启 Aria2!(默认: y):" crontab_update_status_ny [[ -z "${crontab_update_status_ny}" ]] && crontab_update_status_ny="y" if [[ ${crontab_update_status_ny} == [Yy] ]]; then crontab_update_start @@ -446,7 +446,7 @@ Update_bt_tracker(){ else echo && echo -e "当前自动更新模式: ${Green_font_prefix}已开启${Font_color_suffix}" && echo echo -e "确定要关闭 ${Red_font_prefix}Aria2 自动更新 BT-Tracker服务器${Font_color_suffix} 功能吗?(一般情况下会加强BT下载效果)[y/N]" - stty erase '^H' && read -p "注意:该功能会定时重启 Aria2!(默认: n):" crontab_update_status_ny + read -e -p "注意:该功能会定时重启 Aria2!(默认: n):" crontab_update_status_ny [[ -z "${crontab_update_status_ny}" ]] && crontab_update_status_ny="n" if [[ ${crontab_update_status_ny} == [Yy] ]]; then crontab_update_stop @@ -504,7 +504,7 @@ Uninstall_aria2(){ check_installed_status "un" echo "确定要卸载 Aria2 ? (y/N)" echo - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then crontab -l > "$file_1/crontab.bak" @@ -601,7 +601,7 @@ else echo -e " 当前状态: ${Red_font_prefix}未安装${Font_color_suffix}" fi echo -stty erase '^H' && read -p " 请输入数字 [0-10]:" num +read -e -p " 请输入数字 [0-10]:" num case "$num" in 0) Update_Shell diff --git a/ban_iptables.sh b/ban_iptables.sh index faab426..4330031 100644 --- a/ban_iptables.sh +++ b/ban_iptables.sh @@ -258,7 +258,7 @@ ENTER_Ban_KEY_WORDS_type(){ 1. 手动输入(只支持单个关键词) 2. 本地文件读取(支持批量读取关键词,每行一个关键词) 3. 网络地址读取(支持批量读取关键词,每行一个关键词)" && echo - stty erase '^H' && read -p "(默认: 1. 手动输入):" key_word_type + read -e -p "(默认: 1. 手动输入):" key_word_type fi [[ -z "${key_word_type}" ]] && key_word_type="1" if [[ ${key_word_type} == "1" ]]; then @@ -287,7 +287,7 @@ ENTER_Ban_PORT(){ 多端口:25,26,465,587(多个端口用英文逗号分割) 连续端口段:25:587(25-587之间的所有端口)" && echo fi - stty erase '^H' && read -p "(回车默认取消):" PORT + read -e -p "(回车默认取消):" PORT [[ -z "${PORT}" ]] && echo "已取消..." && View_ALL && exit 0 } ENTER_Ban_KEY_WORDS(){ @@ -299,12 +299,12 @@ ENTER_Ban_KEY_WORDS(){ 关键词:www.youtube.com,即禁止访问任何包含关键词 www.youtube.com 的域名(子域名屏蔽)。 更多效果自行测试(如关键词 .zip 即可禁止下载任何 .zip 后缀的文件)。" && echo fi - stty erase '^H' && read -p "(回车默认取消):" key_word + read -e -p "(回车默认取消):" key_word [[ -z "${key_word}" ]] && echo "已取消..." && View_ALL && exit 0 } ENTER_Ban_KEY_WORDS_file(){ echo -e "请输入欲封禁/解封的 关键词本地文件(请使用绝对路径)" && echo - stty erase '^H' && read -p "(默认 读取脚本同目录下的 key_word.txt ):" key_word + read -e -p "(默认 读取脚本同目录下的 key_word.txt ):" key_word [[ -z "${key_word}" ]] && key_word="key_word.txt" if [[ -e "${key_word}" ]]; then key_word=$(cat "${key_word}") @@ -315,7 +315,7 @@ ENTER_Ban_KEY_WORDS_file(){ } ENTER_Ban_KEY_WORDS_url(){ echo -e "请输入欲封禁/解封的 关键词网络文件地址(例如 http://xxx.xx/key_word.txt)" && echo - stty erase '^H' && read -p "(回车默认取消):" key_word + read -e -p "(回车默认取消):" key_word [[ -z "${key_word}" ]] && echo "已取消..." && View_ALL && exit 0 key_word=$(wget --no-check-certificate -t3 -T5 -qO- "${key_word}") [[ -z ${key_word} ]] && echo -e "${Error} 网络文件内容为空或访问超时 !" && View_ALL && exit 0 @@ -323,12 +323,12 @@ ENTER_Ban_KEY_WORDS_url(){ ENTER_UnBan_KEY_WORDS(){ View_KEY_WORDS echo -e "请输入欲解封的 关键词(根据上面的列表输入完整准确的 关键词)" && echo - stty erase '^H' && read -p "(回车默认取消):" key_word + read -e -p "(回车默认取消):" key_word [[ -z "${key_word}" ]] && echo "已取消..." && View_ALL && exit 0 } ENTER_UnBan_PORT(){ echo -e "请输入欲解封的 端口(根据上面的列表输入完整准确的 端口,包括逗号、冒号)" && echo - stty erase '^H' && read -p "(回车默认取消):" PORT + read -e -p "(回车默认取消):" PORT [[ -z "${PORT}" ]] && echo "已取消..." && View_ALL && exit 0 } Ban_PORT(){ @@ -463,7 +463,7 @@ echo && echo -e " iptables防火墙 封禁管理脚本 ${Red_font_prefix}[v${sh_ ———————————— ${Green_font_prefix}12.${Font_color_suffix} 升级脚本 " && echo -stty erase '^H' && read -p " 请输入数字 [0-12]:" num +read -e -p " 请输入数字 [0-12]:" num case "$num" in 0) View_ALL diff --git a/base64.sh b/base64.sh new file mode 100644 index 0000000..c8cabb8 --- /dev/null +++ b/base64.sh @@ -0,0 +1,43 @@ +#!/usr/bin/env bash +PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin +export PATH + +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" +Info="${Green_font_prefix}[信息]${Font_color_suffix}" && Error="${Red_font_prefix}[错误]${Font_color_suffix}" && Tip="${Green_font_prefix}[注意]${Font_color_suffix}" + +urlsafe_base64(){ + date=$(echo -n "$1"|base64|sed ':a;N;s/\n/ /g;ta'|sed 's/ //g;s/=//g;s/+/-/g;s/\//_/g') + echo -e "${date}" +} +urlsafe_base64_d(){ + date=$(echo -n "$1"|sed 's/-/+/g;s/_/\//g'|base64 -d) + echo -e "${date}" +} +set_type(){ + echo -e "你要干什么呢? + ${Green_font_prefix}1.${Font_color_suffix} URL_Safe_Base64 加密文本 + ${Green_font_prefix}2.${Font_color_suffix} URL_Safe_Base64 解密文本" + read -e -p "(默认:1):" enter_type + [[ -z "${enter_type}" ]] && enter_type="1" + if [[ ${enter_type} == "1" ]]; then + set_text "1" + elif [[ ${enter_type} == "2" ]]; then + set_text "2" + else + set_text "1" + fi +} +set_text(){ + echo "请输入要 URL_Safe_Base64 加密/解密 的文本" + read -e -p "(默认回车取消):" text + [[ -z "${text}" ]] && echo "已取消..." && exit 1 + [[ -z "${enter_type}" ]] && enter_type="1" + if [[ $1 == "1" ]]; then + echo && urlsafe_base64 "${text}" && echo + elif [[ $1 == "2" ]]; then + echo && urlsafe_base64_d "${text}" && echo + else + echo && urlsafe_base64 "${text}" && echo + fi +} +set_type \ No newline at end of file diff --git a/bbr.sh b/bbr.sh index 33e54c7..0ae53d3 100644 --- a/bbr.sh +++ b/bbr.sh @@ -42,7 +42,7 @@ Set_latest_new_version(){ echo -e "请输入 要下载安装的Linux内核版本(BBR) ${Green_font_prefix}[ 格式: x.xx.xx ,例如: 4.9.96 ]${Font_color_suffix} ${Tip} 内核版本列表请去这里获取:${Green_font_prefix}[ http://kernel.ubuntu.com/~kernel-ppa/mainline/ ]${Font_color_suffix} 建议使用${Green_font_prefix}稳定版本:4.9.XX ${Font_color_suffix},4.9 以上版本属于测试版,稳定版与测试版同步更新,BBR 加速效果无区别。" - stty erase '^H' && read -p "(直接回车,自动获取最新稳定版本):" latest_version + read -e -p "(直接回车,自动获取最新稳定版本):" latest_version [[ -z "${latest_version}" ]] && get_latest_new_version echo } @@ -111,7 +111,7 @@ del_deb_over(){ update-grub addsysctl echo -e "${Tip} 重启VPS后,请运行脚本查看 BBR 是否正常加载,运行命令: ${Green_background_prefix} bash ${file}/bbr.sh status ${Font_color_suffix}" - stty erase '^H' && read -p "需要重启VPS后,才能开启BBR,是否现在重启 ? [Y/n] :" yn + read -e -p "需要重启VPS后,才能开启BBR,是否现在重启 ? [Y/n] :" yn [[ -z "${yn}" ]] && yn="y" if [[ $yn == [Yy] ]]; then echo -e "${Info} VPS 重启中..." @@ -208,7 +208,7 @@ stopbbr(){ sysctl -p sleep 1s - stty erase '^H' && read -p "需要重启VPS后,才能彻底停止BBR,是否现在重启 ? [Y/n] :" yn + read -e -p "需要重启VPS后,才能彻底停止BBR,是否现在重启 ? [Y/n] :" yn [[ -z "${yn}" ]] && yn="y" if [[ $yn == [Yy] ]]; then echo -e "${Info} VPS 重启中..." diff --git a/brook-pf.sh b/brook-pf.sh index b6fcc29..087471f 100644 --- a/brook-pf.sh +++ b/brook-pf.sh @@ -70,7 +70,7 @@ check_pid(){ check_new_ver(){ echo -e "请输入要下载安装的 Brook 版本号 ${Green_font_prefix}[ 格式是日期,例如: v20180909 ]${Font_color_suffix} 版本列表请去这里获取:${Green_font_prefix}[ https://github.com/txthinking/brook/releases ]${Font_color_suffix}" - stty erase '^H' && read -p "直接回车即自动获取:" brook_new_ver + read -e -p "直接回车即自动获取:" brook_new_ver if [[ -z ${brook_new_ver} ]]; then brook_new_ver=$(wget -qO- https://api.github.com/repos/txthinking/brook/releases| grep "tag_name"| head -n 1| awk -F ":" '{print $2}'| sed 's/\"//g;s/,//g;s/ //g') [[ -z ${brook_new_ver} ]] && echo -e "${Error} Brook 最新版本获取失败!" && exit 1 @@ -85,7 +85,7 @@ check_ver_comparison(){ brook_now_ver="v${brook_now_ver}" if [[ "${brook_now_ver}" != "${brook_new_ver}" ]]; then echo -e "${Info} 发现 Brook 已有新版本 [ ${brook_new_ver} ],旧版本 [ ${brook_now_ver} ]" - stty erase '^H' && read -p "是否更新 ? [Y/n] :" yn + read -e -p "是否更新 ? [Y/n] :" yn [[ -z "${yn}" ]] && yn="y" if [[ $yn == [Yy] ]]; then check_pid @@ -138,7 +138,7 @@ Read_config(){ } Set_pf_Enabled(){ echo -e "立即启用该端口转发,还是禁用? [Y/n]" - stty erase '^H' && read -p "(默认: Y 启用):" pf_Enabled_un + read -e -p "(默认: Y 启用):" pf_Enabled_un [[ -z ${pf_Enabled_un} ]] && pf_Enabled_un="y" if [[ ${pf_Enabled_un} == [Yy] ]]; then bk_Enabled="1" @@ -150,7 +150,7 @@ Set_port_Modify(){ while true do echo -e "请选择并输入要修改的 Brook 端口转发本地监听端口 [1-65535]" - stty erase '^H' && read -p "(默认取消):" bk_port_Modify + read -e -p "(默认取消):" bk_port_Modify [[ -z "${bk_port_Modify}" ]] && echo "取消..." && exit 1 echo $((${bk_port_Modify}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -173,7 +173,7 @@ Set_port(){ while true do echo -e "请输入 Brook 本地监听端口 [1-65535](端口不能重复,避免冲突)" - stty erase '^H' && read -p "(默认取消):" bk_port + read -e -p "(默认取消):" bk_port [[ -z "${bk_port}" ]] && echo "已取消..." && exit 1 echo $((${bk_port}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -192,7 +192,7 @@ Set_port(){ } Set_IP_pf(){ echo "请输入被转发的 IP :" - stty erase '^H' && read -p "(默认取消):" bk_ip_pf + read -e -p "(默认取消):" bk_ip_pf [[ -z "${bk_ip_pf}" ]] && echo "已取消..." && exit 1 echo && echo "========================" echo -e " 被转发IP : ${Red_background_prefix} ${bk_ip_pf} ${Font_color_suffix}" @@ -202,7 +202,7 @@ Set_port_pf(){ while true do echo -e "请输入 Brook 被转发的端口 [1-65535]" - stty erase '^H' && read -p "(默认取消):" bk_port_pf + read -e -p "(默认取消):" bk_port_pf [[ -z "${bk_port_pf}" ]] && echo "已取消..." && exit 1 echo $((${bk_port_pf}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -228,7 +228,7 @@ Set_brook(){ ${Green_font_prefix}4.${Font_color_suffix} 启用/禁用 端口转发 ${Tip} 本地监听端口不能重复,被转发的IP或端口可重复!" && echo - stty erase '^H' && read -p "(默认: 取消):" bk_modify + read -e -p "(默认: 取消):" bk_modify [[ -z "${bk_modify}" ]] && echo "已取消..." && exit 1 if [[ ${bk_modify} == "1" ]]; then Add_pf @@ -312,7 +312,7 @@ Add_pf(){ Add_iptables Save_iptables echo -e "${Info} 端口转发 添加成功 ${Green_font_prefix}[端口: ${bk_port} 被转发IP和端口: ${bk_ip_pf}:${bk_port_pf}]${Font_color_suffix}\n" - stty erase '^H' && read -p "是否继续 添加端口转发配置?[Y/n]:" addyn + read -e -p "是否继续 添加端口转发配置?[Y/n]:" addyn [[ -z ${addyn} ]] && addyn="y" if [[ ${addyn} == [Nn] ]]; then Restart_brook @@ -350,7 +350,7 @@ Del_pf(){ fi break else - stty erase '^H' && read -p "是否继续 删除端口转发配置?[Y/n]:" delyn + read -e -p "是否继续 删除端口转发配置?[Y/n]:" delyn [[ -z ${delyn} ]] && delyn="y" if [[ ${delyn} == [Nn] ]]; then Restart_brook @@ -398,7 +398,7 @@ Modify_Enabled_pf(){ user_Enabled_pf_text=$(echo ${user_pf_text}|awk '{print $4}') if [[ ${user_Enabled_pf_text} == "0" ]]; then echo -e "该端口转发已${Red_font_prefix}禁用${Font_color_suffix},是否${Green_font_prefix}启用${Font_color_suffix}? [Y/n]" - stty erase '^H' && read -p "(默认: Y 启用):" user_Enabled_pf_text_un + read -e -p "(默认: Y 启用):" user_Enabled_pf_text_un [[ -z ${user_Enabled_pf_text_un} ]] && user_Enabled_pf_text_un="y" if [[ ${user_Enabled_pf_text_un} == [Yy] ]]; then user_Enabled_pf_text_1="1" @@ -417,7 +417,7 @@ Modify_Enabled_pf(){ fi else echo -e "该端口转发已${Green_font_prefix}启用${Font_color_suffix},是否${Red_font_prefix}禁用${Font_color_suffix}? [Y/n]" - stty erase '^H' && read -p "(默认: Y 禁用):" user_Enabled_pf_text_un + read -e -p "(默认: Y 禁用):" user_Enabled_pf_text_un [[ -z ${user_Enabled_pf_text_un} ]] && user_Enabled_pf_text_un="y" if [[ ${user_Enabled_pf_text_un} == [Yy] ]]; then user_Enabled_pf_text_1="0" @@ -478,7 +478,7 @@ Update_brook(){ ${Green_font_prefix}2.${Font_color_suffix} 国外服务器(Github) ${Tip} 因为国内对 Github 限速,这会导致国内服务器下载速度极慢,所以选择 国内服务器 选项就会从我的 逗比云 下载!" && echo - stty erase '^H' && read -p "(默认: 2 国外服务器):" bk_Download + read -e -p "(默认: 2 国外服务器):" bk_Download [[ -z "${bk_Download}" ]] && bk_Download="2" if [[ ${bk_Download} == "1" ]]; then Download_type="1" @@ -491,7 +491,7 @@ Update_brook(){ Uninstall_brook(){ check_installed_status echo -e "确定要卸载 Brook ? [y/N]\n" - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then check_pid @@ -535,7 +535,7 @@ Set_crontab_monitor_brook(){ if [[ -z "${crontab_monitor_brook_status}" ]]; then echo && echo -e "当前监控模式: ${Green_font_prefix}未开启${Font_color_suffix}" && echo echo -e "确定要开启 ${Green_font_prefix}Brook 服务端运行状态监控${Font_color_suffix} 功能吗?(当进程关闭则自动启动 Brook 服务端)[Y/n]" - stty erase '^H' && read -p "(默认: y):" crontab_monitor_brook_status_ny + read -e -p "(默认: y):" crontab_monitor_brook_status_ny [[ -z "${crontab_monitor_brook_status_ny}" ]] && crontab_monitor_brook_status_ny="y" if [[ ${crontab_monitor_brook_status_ny} == [Yy] ]]; then crontab_monitor_brook_cron_start @@ -545,7 +545,7 @@ Set_crontab_monitor_brook(){ else echo && echo -e "当前监控模式: ${Green_font_prefix}已开启${Font_color_suffix}" && echo echo -e "确定要关闭 ${Green_font_prefix}Brook 服务端运行状态监控${Font_color_suffix} 功能吗?(当进程关闭则自动启动 Brook 服务端)[y/N]" - stty erase '^H' && read -p "(默认: n):" crontab_monitor_brook_status_ny + read -e -p "(默认: n):" crontab_monitor_brook_status_ny [[ -z "${crontab_monitor_brook_status_ny}" ]] && crontab_monitor_brook_status_ny="n" if [[ ${crontab_monitor_brook_status_ny} == [Yy] ]]; then crontab_monitor_brook_cron_stop @@ -666,7 +666,7 @@ else echo -e " 当前状态: ${Red_font_prefix}未安装${Font_color_suffix}" fi echo -stty erase '^H' && read -p " 请输入数字 [0-10]:" num +read -e -p " 请输入数字 [0-10]:" num case "$num" in 0) Update_Shell diff --git a/brook.sh b/brook.sh index 413e214..6c5b36c 100644 --- a/brook.sh +++ b/brook.sh @@ -70,7 +70,7 @@ check_pid(){ check_new_ver(){ echo -e "请输入要下载安装的 Brook 版本号 ${Green_font_prefix}[ 格式是日期,例如: v20180707 ]${Font_color_suffix} 版本列表请去这里获取:${Green_font_prefix}[ https://github.com/txthinking/brook/releases ]${Font_color_suffix}" - stty erase '^H' && read -p "直接回车即自动获取:" brook_new_ver + read -e -p "直接回车即自动获取:" brook_new_ver if [[ -z ${brook_new_ver} ]]; then brook_new_ver=$(wget -qO- https://api.github.com/repos/txthinking/brook/releases| grep "tag_name"| head -n 1| awk -F ":" '{print $2}'| sed 's/\"//g;s/,//g;s/ //g') [[ -z ${brook_new_ver} ]] && echo -e "${Error} Brook 最新版本获取失败!" && exit 1 @@ -85,7 +85,7 @@ check_ver_comparison(){ brook_now_ver="v${brook_now_ver}" if [[ "${brook_now_ver}" != "${brook_new_ver}" ]]; then echo -e "${Info} 发现 Brook 已有新版本 [ ${brook_new_ver} ],旧版本 [ ${brook_now_ver} ]" - stty erase '^H' && read -p "是否更新 ? [Y/n] :" yn + read -e -p "是否更新 ? [Y/n] :" yn [[ -z "${yn}" ]] && yn="y" if [[ $yn == [Yy] ]]; then check_pid @@ -166,7 +166,7 @@ Set_port_Modify(){ while true do echo -e "请选择并输入要修改的 Brook 账号端口 [1-65535]" - stty erase '^H' && read -p "(默认取消):" bk_port_Modify + read -e -p "(默认取消):" bk_port_Modify [[ -z "${bk_port_Modify}" ]] && echo "取消..." && exit 1 echo $((${bk_port_Modify}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -189,7 +189,7 @@ Set_port(){ while true do echo -e "请输入 Brook 端口 [1-65535](端口不能重复,避免冲突)" - stty erase '^H' && read -p "(默认: 2333):" bk_port + read -e -p "(默认: 2333):" bk_port [[ -z "${bk_port}" ]] && bk_port="2333" echo $((${bk_port}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -208,7 +208,7 @@ Set_port(){ } Set_passwd(){ echo "请输入 Brook 密码(因分享链接特性,密码请勿包含 % 符号)" - stty erase '^H' && read -p "(默认: doub.io):" bk_passwd + read -e -p "(默认: doub.io):" bk_passwd [[ -z "${bk_passwd}" ]] && bk_passwd="doub.io" echo && echo "========================" echo -e " 密码 : ${Red_background_prefix} ${bk_passwd} ${Font_color_suffix}" @@ -218,7 +218,7 @@ Set_protocol(){ echo -e "请选择 Brook 协议 ${Green_font_prefix}1.${Font_color_suffix} Brook(新版协议,即 [servers]) ${Green_font_prefix}2.${Font_color_suffix} Brook Stream(旧版协议,即 [streamservers],不推荐,除非使用新版协议速度慢)" && echo - stty erase '^H' && read -p "(默认: 1. Brook(新版协议)):" bk_protocol + read -e -p "(默认: 1. Brook(新版协议)):" bk_protocol [[ -z "${bk_protocol}" ]] && bk_protocol="1" if [[ ${bk_protocol} == "1" ]]; then bk_protocol="servers" @@ -242,7 +242,7 @@ Set_brook(){ ${Green_font_prefix}5.${Font_color_suffix} 监控 运行状态 ${Tip} 用户的端口是不能重复的,密码可以重复 !" && echo - stty erase '^H' && read -p "(默认: 取消):" bk_modify + read -e -p "(默认: 取消):" bk_modify [[ -z "${bk_modify}" ]] && echo "已取消..." && exit 1 if [[ ${bk_modify} == "1" ]]; then Add_port_user @@ -393,7 +393,7 @@ Uninstall_brook(){ check_installed_status echo "确定要卸载 Brook ? (y/N)" echo - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then check_pid @@ -539,7 +539,7 @@ View_user_connection_info(){ echo && echo -e "请选择要显示的格式: ${Green_font_prefix}1.${Font_color_suffix} 显示 IP 格式 ${Green_font_prefix}2.${Font_color_suffix} 显示 IP+IP归属地 格式" && echo - stty erase '^H' && read -p "(默认: 1):" brook_connection_info + read -e -p "(默认: 1):" brook_connection_info [[ -z "${brook_connection_info}" ]] && brook_connection_info="1" if [[ "${brook_connection_info}" == "1" ]]; then View_user_connection_info_1 "" @@ -586,7 +586,7 @@ Set_crontab_monitor_brook(){ if [[ -z "${crontab_monitor_brook_status}" ]]; then echo && echo -e "当前监控模式: ${Green_font_prefix}未开启${Font_color_suffix}" && echo echo -e "确定要开启 ${Green_font_prefix}Brook 服务端运行状态监控${Font_color_suffix} 功能吗?(当进程关闭则自动启动 Brook 服务端)[Y/n]" - stty erase '^H' && read -p "(默认: y):" crontab_monitor_brook_status_ny + read -e -p "(默认: y):" crontab_monitor_brook_status_ny [[ -z "${crontab_monitor_brook_status_ny}" ]] && crontab_monitor_brook_status_ny="y" if [[ ${crontab_monitor_brook_status_ny} == [Yy] ]]; then crontab_monitor_brook_cron_start @@ -596,7 +596,7 @@ Set_crontab_monitor_brook(){ else echo && echo -e "当前监控模式: ${Green_font_prefix}已开启${Font_color_suffix}" && echo echo -e "确定要关闭 ${Green_font_prefix}Brook 服务端运行状态监控${Font_color_suffix} 功能吗?(当进程关闭则自动启动 Brook 服务端)[y/N]" - stty erase '^H' && read -p "(默认: n):" crontab_monitor_brook_status_ny + read -e -p "(默认: n):" crontab_monitor_brook_status_ny [[ -z "${crontab_monitor_brook_status_ny}" ]] && crontab_monitor_brook_status_ny="n" if [[ ${crontab_monitor_brook_status_ny} == [Yy] ]]; then crontab_monitor_brook_cron_stop @@ -717,7 +717,7 @@ else echo -e " 当前状态: ${Red_font_prefix}未安装${Font_color_suffix}" fi echo - stty erase '^H' && read -p " 请输入数字 [0-10]:" num + read -e -p " 请输入数字 [0-10]:" num case "$num" in 0) Update_Shell diff --git a/caddy_install.sh b/caddy_install.sh index ed79b87..41bfc12 100644 --- a/caddy_install.sh +++ b/caddy_install.sh @@ -89,7 +89,7 @@ install_caddy(){ check_root if [[ -e ${caddy_file} ]]; then echo && echo -e "${Error_font_prefix}[信息]${Font_suffix} 检测到 Caddy 已安装,是否继续安装(覆盖更新)?[y/N]" - stty erase '^H' && read -p "(默认: n):" yn + read -e -p "(默认: n):" yn [[ -z ${yn} ]] && yn="n" if [[ ${yn} == [Nn] ]]; then echo && echo "已取消..." && exit 1 @@ -106,7 +106,7 @@ install_caddy(){ uninstall_caddy(){ check_installed_status echo && echo "确定要卸载 Caddy ? [y/N]" - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then PID=`ps -ef |grep "caddy" |grep -v "grep" |grep -v "init.d" |grep -v "service" |grep -v "caddy_install" |awk '{print $2}'` diff --git a/cloudt.sh b/cloudt.sh index a5e11dd..b001d8c 100644 --- a/cloudt.sh +++ b/cloudt.sh @@ -56,7 +56,7 @@ check_new_ver(){ ct_new_ver=$(wget --no-check-certificate -qO- -t2 -T3 https://api.github.com/repos/jpillora/cloud-torrent/releases| grep "tag_name"| head -n 1| awk -F ":" '{print $2}'| sed 's/\"//g;s/,//g;s/ //g;s/v//g') if [[ -z ${ct_new_ver} ]]; then echo -e "${Error} Cloud Torrent 最新版本获取失败,请手动获取最新版本号[ https://github.com/jpillora/cloud-torrent/releases ]" - stty erase '^H' && read -p "请输入版本号 [ 格式 x.x.xx , 如 0.8.21 ] :" ct_new_ver + read -e -p "请输入版本号 [ 格式 x.x.xx , 如 0.8.21 ] :" ct_new_ver [[ -z "${ct_new_ver}" ]] && echo "取消..." && exit 1 else echo -e "${Info} Cloud Torrent 目前最新版本为 ${ct_new_ver}" @@ -66,7 +66,7 @@ check_ver_comparison(){ ct_now_ver=$(${ct_file} --version) if [[ ${ct_now_ver} != ${ct_new_ver} ]]; then echo -e "${Info} 发现 Cloud Torrent 已有新版本 [ ${ct_new_ver} ]" - stty erase '^H' && read -p "是否更新 ? [Y/n] :" yn + read -e -p "是否更新 ? [Y/n] :" yn [ -z "${yn}" ] && yn="y" if [[ ${yn} == [Yy] ]]; then check_pid @@ -142,7 +142,7 @@ Read_config(){ } Set_host(){ echo -e "请输入 Cloud Torrent 监听域名或IP(当你要绑定域名前,记得先做好域名解析,目前只支持http://访问,不要写http://,只写域名!)" - stty erase '^H' && read -p "(默认: 0.0.0.0 监听网卡所有IP):" ct_host + read -e -p "(默认: 0.0.0.0 监听网卡所有IP):" ct_host [[ -z "${ct_host}" ]] && ct_host="0.0.0.0" echo && echo "========================" echo -e " 主机 : ${Red_background_prefix} ${ct_host} ${Font_color_suffix}" @@ -152,7 +152,7 @@ Set_port(){ while true do echo -e "请输入 Cloud Torrent 监听端口 [1-65535](如果是绑定的域名,那么建议80端口)" - stty erase '^H' && read -p "(默认端口: 80):" ct_port + read -e -p "(默认端口: 80):" ct_port [[ -z "${ct_port}" ]] && ct_port="80" echo $((${ct_port}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -171,14 +171,14 @@ Set_port(){ } Set_user(){ echo "请输入 Cloud Torrent 用户名" - stty erase '^H' && read -p "(默认用户名: user):" ct_user + read -e -p "(默认用户名: user):" ct_user [[ -z "${ct_user}" ]] && ct_user="user" echo && echo "========================" echo -e " 用户名 : ${Red_background_prefix} ${ct_user} ${Font_color_suffix}" echo "========================" && echo echo "请输入 Cloud Torrent 用户名的密码" - stty erase '^H' && read -p "(默认密码: 随机生成10位数字+字母):" ct_passwd + read -e -p "(默认密码: 随机生成10位数字+字母):" ct_passwd [[ -z "${ct_passwd}" ]] && ct_passwd=$(date +%s%N | md5sum | head -c 10) echo && echo "========================" echo -e " 密码 : ${Red_background_prefix} ${ct_passwd} ${Font_color_suffix}" @@ -187,7 +187,7 @@ Set_user(){ Set_conf(){ Set_host Set_port - stty erase '^H' && read -p "是否设置 用户名和密码 ? [y/N] :" yn + read -e -p "是否设置 用户名和密码 ? [y/N] :" yn [[ -z "${yn}" ]] && yn="n" if [[ ${yn} == [Yy] ]]; then Set_user @@ -266,7 +266,7 @@ Uninstall_ct(){ check_installed_status echo "确定要卸载 Cloud Torrent ? (y/N)" echo - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then check_pid @@ -389,7 +389,7 @@ else echo -e " 当前状态: ${Red_font_prefix}未安装${Font_color_suffix}" fi echo -stty erase '^H' && read -p " 请输入数字 [0-9]:" num +read -e -p " 请输入数字 [0-9]:" num case "$num" in 0) Update_Shell diff --git a/dowsdns.sh b/dowsdns.sh index 2066aa4..205aa1a 100644 --- a/dowsdns.sh +++ b/dowsdns.sh @@ -128,7 +128,7 @@ Read_wrcd(){ } Set_remote_dns_server(){ echo "请输入 DowsDNS 远程(上游)DNS解析服务器IP" - stty erase '^H' && read -p "(默认: 114.114.114.114):" dd_remote_dns_server + read -e -p "(默认: 114.114.114.114):" dd_remote_dns_server [[ -z "${dd_remote_dns_server}" ]] && dd_remote_dns_server="114.114.114.114" echo } @@ -136,7 +136,7 @@ Set_remote_dns_port(){ while true do echo -e "请输入 DowsDNS 远程(上游)DNS解析服务器端口 [1-65535]" - stty erase '^H' && read -p "(默认: 53):" dd_remote_dns_port + read -e -p "(默认: 53):" dd_remote_dns_port [[ -z "$dd_remote_dns_port" ]] && dd_remote_dns_port="53" echo $((${dd_remote_dns_port}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -160,7 +160,7 @@ Set_remote_dns(){ ${Green_font_prefix}3.${Font_color_suffix} 208.67.222.222 53 ${Green_font_prefix}4.${Font_color_suffix} 208.67.222.222 5353 ${Green_font_prefix}5.${Font_color_suffix} 自定义输入" && echo - stty erase '^H' && read -p "(默认: 1. 114.114.114.114 53):" dd_remote_dns + read -e -p "(默认: 1. 114.114.114.114 53):" dd_remote_dns [[ -z "${dd_remote_dns}" ]] && dd_remote_dns="1" if [[ ${dd_remote_dns} == "1" ]]; then dd_remote_dns_server="114.114.114.114" @@ -191,7 +191,7 @@ Set_local_dns_server(){ echo -e "请选择并输入 DowsDNS 的本地监听方式 ${Green_font_prefix}1.${Font_color_suffix} 127.0.0.1 (只允许本地和局域网设备访问) ${Green_font_prefix}2.${Font_color_suffix} 0.0.0.0 (允许外网访问)" && echo - stty erase '^H' && read -p "(默认: 2. 0.0.0.0):" dd_local_dns_server + read -e -p "(默认: 2. 0.0.0.0):" dd_local_dns_server [[ -z "${dd_local_dns_server}" ]] && dd_local_dns_server="2" if [[ ${dd_local_dns_server} == "1" ]]; then dd_local_dns_server="127.0.0.1" @@ -212,7 +212,7 @@ Set_local_dns_port(){ do echo -e "请输入 DowsDNS 监听端口 [1-65535] 注意:大部分设备是不支持设置 非53端口的DNS服务器的,所以非必须请直接回车默认使用 53端口。" && echo - stty erase '^H' && read -p "(默认: 53):" dd_local_dns_port + read -e -p "(默认: 53):" dd_local_dns_port [[ -z "$dd_local_dns_port" ]] && dd_local_dns_port="53" echo $((${dd_local_dns_port}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -232,7 +232,7 @@ Set_local_dns_port(){ Set_sni_proxy_on(){ echo "是否开启 DowsDNS SNI代理功能?[y/N] 注意:开启此功能后,任何自定义设置的 hosts或泛域名解析(包括DowsDNS自带的),都指向设置的SNI代理IP,如果你没有SNI代理IP,请输入 N !" - stty erase '^H' && read -p "(默认: N 关闭):" dd_sni_proxy_on + read -e -p "(默认: N 关闭):" dd_sni_proxy_on [[ -z "${dd_sni_proxy_on}" ]] && dd_sni_proxy_on="n" if [[ ${dd_sni_proxy_on} == [Yy] ]]; then dd_sni_proxy_on="true" @@ -247,7 +247,7 @@ Set_sni_proxy_ip(){ ddd_sni_proxy_ip=$(wget --no-check-certificate -t2 -T4 -qO- "https://raw.githubusercontent.com/dowsnature/dowsDNS/master/conf/config.json"|grep "sni_proxy_ip"|awk -F ":" '{print $NF}'|sed -r 's/.*\"(.+)\".*/\1/') [[ -z ${ddd_sni_proxy_ip} ]] && ddd_sni_proxy_ip="219.76.4.3" echo "请输入 DowsDNS SNI代理 IP(如果没有就直接回车)" - stty erase '^H' && read -p "(默认: ${ddd_sni_proxy_ip}):" dd_sni_proxy_ip + read -e -p "(默认: ${ddd_sni_proxy_ip}):" dd_sni_proxy_ip [[ -z "${dd_sni_proxy_ip}" ]] && dd_sni_proxy_ip="${ddd_sni_proxy_ip}" echo && echo " ================================================" echo -e " SNI代理 IP : ${Red_background_prefix} ${dd_sni_proxy_ip} ${Font_color_suffix}" @@ -274,13 +274,13 @@ Set_wrcd_name(){ echo "请输入 DowsDNS 要添加/修改的域名(子域名或泛域名) 注意:假如你想要 youtube.com 及其二级域名全部指向 指定的IP,那么你需要添加 *.youtube.com 和 youtube.com 这两个域名解析才有效。 这意味着 *.youtube.com 仅代表如 www.youtube.com xxx.youtube.com 这样的二级域名,而不能代表一级域名(顶级域名) youtube.com !" - stty erase '^H' && read -p "(默认回车取消):" wrcd_name + read -e -p "(默认回车取消):" wrcd_name [[ -z "${wrcd_name}" ]] && echo "已取消..." && exit 0 echo } Set_wrcd_name_1(){ echo "检测到当前添加的域名为 泛域名,是否自动添加 上级域名(如顶级域名,就是上面示例说的 youtube.com) [Y/n]" - stty erase '^H' && read -p "(默认: Y 添加):" wrcd_name_1 + read -e -p "(默认: Y 添加):" wrcd_name_1 [[ -z "${wrcd_name_1}" ]] && wrcd_name_1="y" if [[ ${wrcd_name_1} == [Yy] ]]; then wrcd_name_1=$(echo -e "${wrcd_name}"|cut -c 3-100) @@ -294,7 +294,7 @@ Set_wrcd_name_1(){ Set_wrcd_ip(){ echo "请输入 DowsDNS 刚才添加/修改的域名要指向的IP 注意:如果你开启了 SNI代理功能(config.json),那么你这里设置的自定义泛域名解析都会被 SNI代理功能的SNI代理IP设置所覆盖,也就是统一指向 SNI代理的IP,这里的IP设置就没意义了。" - stty erase '^H' && read -p "(默认回车取消):" wrcd_ip + read -e -p "(默认回车取消):" wrcd_ip [[ -z "${wrcd_ip}" ]] && echo "已取消..." && exit 0 echo } @@ -306,7 +306,7 @@ Set_dowsdns_wrcd(){ ${Green_font_prefix}1.${Font_color_suffix} 添加 泛域名解析 ${Green_font_prefix}2.${Font_color_suffix} 删除 泛域名解析 ${Green_font_prefix}3.${Font_color_suffix} 修改 泛域名解析" && echo - stty erase '^H' && read -p "(默认: 取消):" wrcd_modify + read -e -p "(默认: 取消):" wrcd_modify [[ -z "${wrcd_modify}" ]] && echo "已取消..." && exit 1 if [[ ${wrcd_modify} == "0" ]]; then Read_wrcd @@ -341,7 +341,7 @@ Add_wrcd(){ fi fi echo && echo "是否继续添加 泛域名解析?[Y/n]" - stty erase '^H' && read -p "(默认: Y 继续添加):" wrcd_add_1 + read -e -p "(默认: Y 继续添加):" wrcd_add_1 [[ -z "${wrcd_add_1}" ]] && wrcd_add_1="y" if [[ ${wrcd_add_1} == [Yy] ]]; then continue @@ -357,7 +357,7 @@ Del_wrcd(){ do Read_wrcd echo "请根据上面的列表选择你要删除的 泛域名解析 序号数字 [ 2-${wrcd_json_num} ]" - stty erase '^H' && read -p "(默认回车取消):" del_wrcd_num + read -e -p "(默认回车取消):" del_wrcd_num [[ -z "$del_wrcd_num" ]] && echo "已取消..." && exit 0 echo $((${del_wrcd_num}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -377,7 +377,7 @@ Del_wrcd(){ echo -e "${Error} 删除泛域名解析 失败!" && exit 0 fi echo && echo "是否继续删除 泛域名解析?[Y/n]" - stty erase '^H' && read -p "(默认: Y 继续删除):" wrcd_del_1 + read -e -p "(默认: Y 继续删除):" wrcd_del_1 [[ -z "${wrcd_del_1}" ]] && wrcd_del_1="y" if [[ ${wrcd_del_1} == [Yy] ]]; then continue @@ -399,7 +399,7 @@ Modify_wrcd(){ do Read_wrcd echo "请根据上面的列表选择你要修改的 泛域名解析 序号数字 [ 2-${wrcd_json_num} ]" - stty erase '^H' && read -p "(默认回车取消):" modify_wrcd_num + read -e -p "(默认回车取消):" modify_wrcd_num [[ -z "$modify_wrcd_num" ]] && echo "已取消..." && exit 0 echo $((${modify_wrcd_num}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -479,7 +479,7 @@ Uninstall_dowsdns(){ check_installed_status echo "确定要卸载 DowsDNS ? (y/N)" echo - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then check_pid @@ -582,7 +582,7 @@ else echo -e " 当前状态: ${Red_font_prefix}未安装${Font_color_suffix}" fi echo -stty erase '^H' && read -p " 请输入数字 [0-9]:" num +read -e -p " 请输入数字 [0-9]:" num case "$num" in 0) Update_Shell diff --git a/goflyway.sh b/goflyway.sh index c23e860..5370b39 100644 --- a/goflyway.sh +++ b/goflyway.sh @@ -72,7 +72,7 @@ check_new_ver(){ new_ver=$(wget --no-check-certificate -qO- -t1 -T3 https://api.github.com/repos/coyove/goflyway/releases| grep "tag_name"| head -n 1| awk -F ":" '{print $2}'| sed 's/\"//g;s/,//g;s/ //g') if [[ -z ${new_ver} ]]; then echo -e "${Error} GoFlyway 最新版本获取失败,请手动获取最新版本号[ https://github.com/coyove/goflyway/releases ]" - stty erase '^H' && read -p "请输入版本号 [ 格式如 1.3.0a ] :" new_ver + read -e -p "请输入版本号 [ 格式如 1.3.0a ] :" new_ver [[ -z "${new_ver}" ]] && echo "取消..." && exit 1 else echo -e "${Info} 检测到 GoFlyway 最新版本为 [ ${new_ver} ]" @@ -83,7 +83,7 @@ check_ver_comparison(){ [[ -z ${now_ver} ]] && echo "${new_ver}" > ${Now_ver_File} if [[ ${now_ver} != ${new_ver} ]]; then echo -e "${Info} 发现 GoFlyway 已有新版本 [ ${new_ver} ],当前版本 [ ${now_ver} ]" - stty erase '^H' && read -p "是否更新 ? [Y/n] :" yn + read -e -p "是否更新 ? [Y/n] :" yn [[ -z "${yn}" ]] && yn="y" if [[ $yn == [Yy] ]]; then check_pid @@ -163,7 +163,7 @@ Set_port(){ while true do echo -e "请输入 GoFlyway 监听端口 [1-65535](如果要伪装或者套CDN,那么只能使用端口:80 8080 8880 2052 2082 2086 2095)" - stty erase '^H' && read -p "(默认: 2333):" new_port + read -e -p "(默认: 2333):" new_port [[ -z "${new_port}" ]] && new_port="2333" echo $((${new_port}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -182,7 +182,7 @@ Set_port(){ } Set_passwd(){ echo "请输入 GoFlyway 密码" - stty erase '^H' && read -p "(默认: doub.io):" new_passwd + read -e -p "(默认: doub.io):" new_passwd [[ -z "${new_passwd}" ]] && new_passwd="doub.io" echo && echo "========================" echo -e " 密码 : ${Red_background_prefix} ${new_passwd} ${Font_color_suffix}" @@ -190,7 +190,7 @@ Set_passwd(){ } Set_proxy_pass(){ echo "请输入 GoFlyway 要伪装的网站(反向代理,只支持 HTTP:// 网站)" - stty erase '^H' && read -p "(默认不伪装):" new_proxy_pass + read -e -p "(默认不伪装):" new_proxy_pass if [[ ! -z ${new_proxy_pass} ]]; then echo && echo "========================" echo -e " 伪装 : ${Red_background_prefix} ${new_proxy_pass} ${Font_color_suffix}" @@ -203,7 +203,7 @@ Set_protocol(){ ${Green_font_prefix}1.${Font_color_suffix} HTTP (默认,要使用 CDN、WebSocket 则必须选择 HTTP 协议) ${Green_font_prefix}2.${Font_color_suffix} KCP (将 TCP 数据转为 KCP,并通过UDP方式传输,可复活被TCP阻断的IP) ${Tip} 如果使用 KCP 协议,那么将不能使用 CDN、WebSocket。另外,部分地区对海外的UDP链接会QOS限速,这可能导致 KCP 协议速度不理想。" && echo - stty erase '^H' && read -p "(默认: 1. HTTP):" new_protocol + read -e -p "(默认: 1. HTTP):" new_protocol [[ -z "${new_protocol}" ]] && new_protocol="3" if [[ ${new_protocol} == "1" ]]; then new_protocol="http" @@ -282,7 +282,7 @@ Set_goflyway(){ ${Green_font_prefix}6.${Font_color_suffix} 监控 运行状态 ${Tip} 用户的端口是不能重复的,密码可以重复 !" && echo - stty erase '^H' && read -p "(默认: 取消):" gf_modify + read -e -p "(默认: 取消):" gf_modify [[ -z "${gf_modify}" ]] && echo "已取消..." && exit 1 if [[ ${gf_modify} == "1" ]]; then Modify_port @@ -357,7 +357,7 @@ Uninstall_goflyway(){ check_installed_status echo "确定要卸载 GoFlyway ? (y/N)" echo - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then check_pid @@ -467,7 +467,7 @@ View_user_connection_info(){ echo && echo -e "请选择要显示的格式: ${Green_font_prefix}1.${Font_color_suffix} 显示 IP 格式 ${Green_font_prefix}2.${Font_color_suffix} 显示 IP+IP归属地 格式" && echo - stty erase '^H' && read -p "(默认: 1):" goflyway_connection_info + read -e -p "(默认: 1):" goflyway_connection_info [[ -z "${goflyway_connection_info}" ]] && goflyway_connection_info="1" if [[ "${goflyway_connection_info}" == "1" ]]; then View_user_connection_info_1 "" @@ -514,7 +514,7 @@ Set_crontab_monitor_goflyway(){ if [[ -z "${crontab_monitor_goflyway_status}" ]]; then echo && echo -e "当前监控模式: ${Green_font_prefix}未开启${Font_color_suffix}" && echo echo -e "确定要开启 ${Green_font_prefix}Goflyway 服务端运行状态监控${Font_color_suffix} 功能吗?(当进程关闭则自动启动 Goflyway 服务端)[Y/n]" - stty erase '^H' && read -p "(默认: y):" crontab_monitor_goflyway_status_ny + read -e -p "(默认: y):" crontab_monitor_goflyway_status_ny [[ -z "${crontab_monitor_goflyway_status_ny}" ]] && crontab_monitor_goflyway_status_ny="y" if [[ ${crontab_monitor_goflyway_status_ny} == [Yy] ]]; then crontab_monitor_goflyway_cron_start @@ -524,7 +524,7 @@ Set_crontab_monitor_goflyway(){ else echo && echo -e "当前监控模式: ${Green_font_prefix}已开启${Font_color_suffix}" && echo echo -e "确定要关闭 ${Green_font_prefix}Goflyway 服务端运行状态监控${Font_color_suffix} 功能吗?(当进程关闭则自动启动 Goflyway 服务端)[y/N]" - stty erase '^H' && read -p "(默认: n):" crontab_monitor_goflyway_status_ny + read -e -p "(默认: n):" crontab_monitor_goflyway_status_ny [[ -z "${crontab_monitor_goflyway_status_ny}" ]] && crontab_monitor_goflyway_status_ny="n" if [[ ${crontab_monitor_goflyway_status_ny} == [Yy] ]]; then crontab_monitor_goflyway_cron_stop @@ -645,7 +645,7 @@ else echo -e " 当前状态: ${Red_font_prefix}未安装${Font_color_suffix}" fi echo -stty erase '^H' && read -p " 请输入数字 [0-10]:" num +read -e -p " 请输入数字 [0-10]:" num case "$num" in 0) Update_Shell diff --git a/gogo.sh b/gogo.sh index c26c4b1..8f69e68 100644 --- a/gogo.sh +++ b/gogo.sh @@ -88,7 +88,7 @@ setgogo(){ while true do echo -e "请输入GoGo Server 的 HTTP监听端口 [1-65535]:" - stty erase '^H' && read -p "(默认端口: 8080):" httpport + read -e -p "(默认端口: 8080):" httpport [ -z "$httpport" ] && httpport="8080" expr ${httpport} + 0 &>/dev/null if [ $? -eq 0 ]; then @@ -208,7 +208,7 @@ uninstallgogo(){ check_gogo printf "确定要卸载 GoGo ? (y/N)" printf "\n" - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then PID=`ps -ef | grep "gogo" | grep -v grep | grep -v "gogo.sh" | awk '{print $2}'` diff --git a/haproxy.sh b/haproxy.sh index 114bb9b..e356f9a 100644 --- a/haproxy.sh +++ b/haproxy.sh @@ -92,9 +92,9 @@ installHaProxy(){ } setHaProxy(){ check_HaProxy - stty erase '^H' && read -p "请输入 HaProxy 的 本地监听端口(转发端口) [1-65535](支持端口段: 2333-6666): " HaProxyport + read -e -p "请输入 HaProxy 的 本地监听端口(转发端口) [1-65535](支持端口段: 2333-6666): " HaProxyport [[ -z "${HaProxyport}" ]] && echo "取消..." && exit 1 - stty erase '^H' && read -p "请输入 HaProxy 欲转发的 IP:" HaProxyip + read -e -p "请输入 HaProxy 欲转发的 IP:" HaProxyip [[ -z "${HaProxyip}" ]] && echo "取消..." && exit 1 echo echo "——————————————————————————————" @@ -104,7 +104,7 @@ setHaProxy(){ echo -e " 欲转发 IP : \033[41;37m ${HaProxyip} \033[0m" echo "——————————————————————————————" echo - stty erase '^H' && read -p "请按任意键继续,如有配置错误请使用 Ctrl+C 退出。" var + read -e -p "请按任意键继续,如有配置错误请使用 Ctrl+C 退出。" var HaProxy_port_1=`cat ${HaProxy_cfg_file} | sed -n "12p" | cut -c 12-23 | grep "-"` HaProxy_port=`cat ${HaProxy_cfg_file} | sed -n "12p" | cut -c 12-23` if [[ ${HaProxy_port_1} = "" ]]; then @@ -236,7 +236,7 @@ statusHaProxy(){ uninstallHaProxy(){ check_HaProxy echo "确定要卸载 HaProxy ? [y/N]" - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then PID=`ps -ef | grep "haproxy" | grep -v grep | grep -v "haproxy.sh" | awk '{print $2}'` diff --git a/iptables-pf.sh b/iptables-pf.sh index fcc6c87..19f0ad3 100644 --- a/iptables-pf.sh +++ b/iptables-pf.sh @@ -63,28 +63,28 @@ install_iptables(){ echo -e "${Info} iptables 配置完毕 !" } Set_forwarding_port(){ - stty erase '^H' && read -p "请输入 iptables 欲转发至的 远程端口 [1-65535] (支持端口段 如 2333-6666, 被转发服务器):" forwarding_port + read -e -p "请输入 iptables 欲转发至的 远程端口 [1-65535] (支持端口段 如 2333-6666, 被转发服务器):" forwarding_port [[ -z "${forwarding_port}" ]] && echo "取消..." && exit 1 echo && echo -e " 欲转发端口 : ${Red_font_prefix}${forwarding_port}${Font_color_suffix}" && echo } Set_forwarding_ip(){ - stty erase '^H' && read -p "请输入 iptables 欲转发至的 远程IP(被转发服务器):" forwarding_ip + read -e -p "请输入 iptables 欲转发至的 远程IP(被转发服务器):" forwarding_ip [[ -z "${forwarding_ip}" ]] && echo "取消..." && exit 1 echo && echo -e " 欲转发服务器IP : ${Red_font_prefix}${forwarding_ip}${Font_color_suffix}" && echo } Set_local_port(){ echo -e "请输入 iptables 本地监听端口 [1-65535] (支持端口段 如 2333-6666)" - stty erase '^H' && read -p "(默认端口: ${forwarding_port}):" local_port + read -e -p "(默认端口: ${forwarding_port}):" local_port [[ -z "${local_port}" ]] && local_port="${forwarding_port}" echo && echo -e " 本地监听端口 : ${Red_font_prefix}${local_port}${Font_color_suffix}" && echo } Set_local_ip(){ - stty erase '^H' && read -p "请输入 本服务器的 网卡IP(注意是网卡绑定的IP,而不仅仅是公网IP,回车自动检测外网IP):" local_ip + read -e -p "请输入 本服务器的 网卡IP(注意是网卡绑定的IP,而不仅仅是公网IP,回车自动检测外网IP):" local_ip if [[ -z "${local_ip}" ]]; then local_ip=$(wget -qO- -t1 -T2 ipinfo.io/ip) if [[ -z "${local_ip}" ]]; then echo "${Error} 无法检测到本服务器的公网IP,请手动输入" - stty erase '^H' && read -p "请输入 本服务器的 网卡IP(注意是网卡绑定的IP,而不仅仅是公网IP):" local_ip + read -e -p "请输入 本服务器的 网卡IP(注意是网卡绑定的IP,而不仅仅是公网IP):" local_ip [[ -z "${local_ip}" ]] && echo "取消..." && exit 1 fi fi @@ -95,7 +95,7 @@ Set_forwarding_type(){ 1. TCP 2. UDP 3. TCP+UDP\n" - stty erase '^H' && read -p "(默认: TCP+UDP):" forwarding_type_num + read -e -p "(默认: TCP+UDP):" forwarding_type_num [[ -z "${forwarding_type_num}" ]] && forwarding_type_num="3" if [[ ${forwarding_type_num} == "1" ]]; then forwarding_type="TCP" @@ -121,7 +121,7 @@ Set_Config(){ 欲转发 IP\t: ${Green_font_prefix}${forwarding_ip}${Font_color_suffix} 转发类型\t: ${Green_font_prefix}${forwarding_type}${Font_color_suffix} ——————————————————————————————\n" - stty erase '^H' && read -p "请按任意键继续,如有配置错误请使用 Ctrl+C 退出。" var + read -e -p "请按任意键继续,如有配置错误请使用 Ctrl+C 退出。" var } Add_forwarding(){ check_iptables @@ -168,7 +168,7 @@ Del_forwarding(){ while true do View_forwarding - stty erase '^H' && read -p "请输入数字 来选择要删除的 iptables 端口转发规则(默认回车取消):" Del_forwarding_num + read -e -p "请输入数字 来选择要删除的 iptables 端口转发规则(默认回车取消):" Del_forwarding_num [[ -z "${Del_forwarding_num}" ]] && Del_forwarding_num="0" echo $((${Del_forwarding_num}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -190,7 +190,7 @@ Del_forwarding(){ Uninstall_forwarding(){ check_iptables echo -e "确定要清空 iptables 所有端口转发规则 ? [y/N]" - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then forwarding_text=$(iptables -t nat -vnL PREROUTING|tail -n +3) @@ -262,7 +262,7 @@ echo && echo -e " iptables 端口转发一键管理脚本 ${Red_font_prefix}[v${ ${Green_font_prefix}5.${Font_color_suffix} 删除 iptables 端口转发 ———————————— 注意:初次使用前请请务必执行 ${Green_font_prefix}1. 安装 iptables${Font_color_suffix}(不仅仅是安装)" && echo -stty erase '^H' && read -p " 请输入数字 [0-5]:" num +read -e -p " 请输入数字 [0-5]:" num case "$num" in 0) Update_Shell diff --git a/libsodium.sh b/libsodium.sh index 9200c6d..ce44e53 100644 --- a/libsodium.sh +++ b/libsodium.sh @@ -25,7 +25,7 @@ Check_Libsodium_ver(){ Install_Libsodium(){ if [[ -e ${Libsodiumr_file} ]]; then echo -e "${Error} libsodium 已安装 , 是否覆盖安装(或者更新)?[y/N]" - stty erase '^H' && read -p "(默认: n):" yn + read -e -p "(默认: n):" yn [[ -z ${yn} ]] && yn="n" if [[ ${yn} == [Nn] ]]; then echo "已取消..." && exit 1 diff --git a/lightsocks.sh b/lightsocks.sh index 964de6a..d3714c8 100644 --- a/lightsocks.sh +++ b/lightsocks.sh @@ -71,7 +71,7 @@ check_new_ver(){ lightsocks_new_ver=$(wget --no-check-certificate -qO- https://github.com/gwuhaolin/lightsocks/releases/latest | grep "" | sed -r 's/.*Release (.+) · gwuhaolin.*/\1/') if [[ -z ${lightsocks_new_ver} ]]; then echo -e "${Error} Lightsocks 最新版本获取失败,请手动获取最新版本号[ https://github.com/gwuhaolin/lightsocks/releases/latest ]" - stty erase '^H' && read -p "请输入版本号 [ 格式是日期 , 如 1.0.6 ] :" lightsocks_new_ver + read -e -p "请输入版本号 [ 格式是日期 , 如 1.0.6 ] :" lightsocks_new_ver [[ -z "${lightsocks_new_ver}" ]] && echo "取消..." && exit 1 else echo -e "${Info} 检测到 Lightsocks 最新版本为 [ ${lightsocks_new_ver} ]" @@ -168,7 +168,7 @@ Set_port(){ while true do echo -e "请输入 Lightsocks 端口 [1-65535](端口不能重复,避免冲突)" - stty erase '^H' && read -p "(默认: 随机端口):" ls_port + read -e -p "(默认: 随机端口):" ls_port [[ -z "${ls_port}" ]] && ls_port=$(Generate_the_port 443 65500) echo $((${ls_port}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -194,7 +194,7 @@ Set_lightsocks(){ ${Green_font_prefix}3.${Font_color_suffix} 监控 运行状态 ${Tip} 因为 Lightsocks 限制,所以密码只能自动生成 !" && echo - stty erase '^H' && read -p "(默认: 取消):" ls_modify + read -e -p "(默认: 取消):" ls_modify [[ -z "${ls_modify}" ]] && echo "已取消..." && exit 1 if [[ ${ls_modify} == "1" ]]; then Modify_user "port" @@ -291,7 +291,7 @@ Uninstall_lightsocks(){ check_installed_status echo "确定要卸载 Lightsocks ? (y/N)" echo - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then check_pid @@ -402,7 +402,7 @@ View_user_connection_info(){ echo && echo -e "请选择要显示的格式: ${Green_font_prefix}1.${Font_color_suffix} 显示 IP 格式 ${Green_font_prefix}2.${Font_color_suffix} 显示 IP+IP归属地 格式" && echo - stty erase '^H' && read -p "(默认: 1):" lightsocks_connection_info + read -e -p "(默认: 1):" lightsocks_connection_info [[ -z "${lightsocks_connection_info}" ]] && lightsocks_connection_info="1" if [[ "${lightsocks_connection_info}" == "1" ]]; then View_user_connection_info_1 "" @@ -449,7 +449,7 @@ Set_crontab_monitor_lightsocks(){ if [[ -z "${crontab_monitor_lightsocks_status}" ]]; then echo && echo -e "当前监控模式: ${Green_font_prefix}未开启${Font_color_suffix}" && echo echo -e "确定要开启 ${Green_font_prefix}Lightsocks 服务端运行状态监控${Font_color_suffix} 功能吗?(当进程关闭则自动启动SSR服务端)[Y/n]" - stty erase '^H' && read -p "(默认: y):" crontab_monitor_lightsocks_status_ny + read -e -p "(默认: y):" crontab_monitor_lightsocks_status_ny [[ -z "${crontab_monitor_lightsocks_status_ny}" ]] && crontab_monitor_lightsocks_status_ny="y" if [[ ${crontab_monitor_lightsocks_status_ny} == [Yy] ]]; then crontab_monitor_lightsocks_cron_start @@ -459,7 +459,7 @@ Set_crontab_monitor_lightsocks(){ else echo && echo -e "当前监控模式: ${Green_font_prefix}已开启${Font_color_suffix}" && echo echo -e "确定要关闭 ${Green_font_prefix}Lightsocks 服务端运行状态监控${Font_color_suffix} 功能吗?(当进程关闭则自动启动SSR服务端)[y/N]" - stty erase '^H' && read -p "(默认: n):" crontab_monitor_lightsocks_status_ny + read -e -p "(默认: n):" crontab_monitor_lightsocks_status_ny [[ -z "${crontab_monitor_lightsocks_status_ny}" ]] && crontab_monitor_lightsocks_status_ny="n" if [[ ${crontab_monitor_lightsocks_status_ny} == [Yy] ]]; then crontab_monitor_lightsocks_cron_stop @@ -580,7 +580,7 @@ else echo -e " 当前状态: ${Red_font_prefix}未安装${Font_color_suffix}" fi echo - stty erase '^H' && read -p " 请输入数字 [0-10]:" num + read -e -p " 请输入数字 [0-10]:" num case "$num" in 0) Update_Shell diff --git a/mtproxy.sh b/mtproxy.sh index c591c37..5b90f38 100644 --- a/mtproxy.sh +++ b/mtproxy.sh @@ -163,7 +163,7 @@ Set_port(){ while true do echo -e "请输入 MTProxy 端口 [1-65535]" - stty erase '^H' && read -p "(默认: 7000):" mtp_port + read -e -p "(默认: 7000):" mtp_port [[ -z "${mtp_port}" ]] && mtp_port="7000" echo $((${mtp_port}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -184,7 +184,7 @@ Set_passwd(){ while true do echo "请输入 MTProxy 密匙(手动输入必须为32位,[0-9][a-z][A-Z],建议随机生成)" - stty erase '^H' && read -p "(避免出错,强烈推荐随机生成,直接回车):" mtp_passwd + read -e -p "(避免出错,强烈推荐随机生成,直接回车):" mtp_passwd if [[ -z "${mtp_passwd}" ]]; then mtp_passwd=$(date +%s%N | md5sum | head -c 32) else @@ -198,7 +198,7 @@ Set_passwd(){ } Set_tag(){ echo "请输入 MTProxy 的 TAG标签(TAG标签只有在通过官方机器人 @MTProxybot 分享代理账号后才会获得,不清楚请留空回车)" - stty erase '^H' && read -p "(默认:回车跳过):" mtp_tag + read -e -p "(默认:回车跳过):" mtp_tag if [[ ! -z "${mtp_tag}" ]]; then echo && echo "========================" echo -e " TAG : ${Red_background_prefix} ${mtp_tag} ${Font_color_suffix}" @@ -209,7 +209,7 @@ Set_nat(){ echo -e "\n${Green_font_prefix}当前服务器所有网卡信息:${Font_color_suffix}\n" ifconfig echo "如果本机是NAT服务器(谷歌云、微软云、阿里云等,网卡绑定的IP为 10.xx.xx.xx 开头的),则请输入你的服务器内网IP,否则会导致无法使用。如果不是请直接回车!" - stty erase '^H' && read -p "(默认:回车跳过):" mtp_nat + read -e -p "(默认:回车跳过):" mtp_nat if [[ -z "${mtp_nat}" ]]; then mtp_nat="" else @@ -231,7 +231,7 @@ Set_mtproxy(){ ———————————————— ${Green_font_prefix}6.${Font_color_suffix} 定时 更新 Telegram IP段 ${Green_font_prefix}7.${Font_color_suffix} 监控 运行状态" && echo - stty erase '^H' && read -p "(默认: 取消):" mtp_modify + read -e -p "(默认: 取消):" mtp_modify [[ -z "${mtp_modify}" ]] && echo "已取消..." && exit 1 if [[ ${mtp_modify} == "1" ]]; then Read_config @@ -336,7 +336,7 @@ Restart_mtproxy(){ } Update_mtproxy(){ echo -e "${Tip} 因为官方无最新版本号,所以无法对比版本,请自行判断是否需要更新。是否更新?[Y/n]" - stty erase '^H' && read -p "(默认: y):" yn + read -e -p "(默认: y):" yn [[ -z "${yn}" ]] && yn="y" if [[ ${yn} == [Yy] ]]; then check_installed_status @@ -353,7 +353,7 @@ Uninstall_mtproxy(){ check_installed_status echo "确定要卸载 MTProxy ? (y/N)" echo - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then check_pid @@ -461,7 +461,7 @@ View_user_connection_info(){ echo && echo -e "请选择要显示的格式: ${Green_font_prefix}1.${Font_color_suffix} 显示 IP 格式 ${Green_font_prefix}2.${Font_color_suffix} 显示 IP+IP归属地 格式" && echo - stty erase '^H' && read -p "(默认: 1):" mtproxy_connection_info + read -e -p "(默认: 1):" mtproxy_connection_info [[ -z "${mtproxy_connection_info}" ]] && mtproxy_connection_info="1" if [[ "${mtproxy_connection_info}" == "1" ]]; then View_user_connection_info_1 "" @@ -502,7 +502,7 @@ Set_crontab_monitor_mtproxy(){ if [[ -z "${crontab_monitor_mtproxy_status}" ]]; then echo && echo -e "当前监控模式: ${Red_font_prefix}未开启${Font_color_suffix}" && echo echo -e "确定要开启 ${Green_font_prefix}MTProxy 服务端运行状态监控${Font_color_suffix} 功能吗?(当进程关闭则自动启动 MTProxy 服务端)[Y/n]" - stty erase '^H' && read -p "(默认: y):" crontab_monitor_mtproxy_status_ny + read -e -p "(默认: y):" crontab_monitor_mtproxy_status_ny [[ -z "${crontab_monitor_mtproxy_status_ny}" ]] && crontab_monitor_mtproxy_status_ny="y" if [[ ${crontab_monitor_mtproxy_status_ny} == [Yy] ]]; then crontab_monitor_mtproxy_cron_start @@ -512,7 +512,7 @@ Set_crontab_monitor_mtproxy(){ else echo && echo -e "当前监控模式: ${Green_font_prefix}已开启${Font_color_suffix}" && echo echo -e "确定要关闭 ${Red_font_prefix}MTProxy 服务端运行状态监控${Font_color_suffix} 功能吗?(当进程关闭则自动启动 MTProxy 服务端)[y/N]" - stty erase '^H' && read -p "(默认: n):" crontab_monitor_mtproxy_status_ny + read -e -p "(默认: n):" crontab_monitor_mtproxy_status_ny [[ -z "${crontab_monitor_mtproxy_status_ny}" ]] && crontab_monitor_mtproxy_status_ny="n" if [[ ${crontab_monitor_mtproxy_status_ny} == [Yy] ]]; then crontab_monitor_mtproxy_cron_stop @@ -570,7 +570,7 @@ Set_crontab_update_mtproxy(){ if [[ -z "${crontab_update_mtproxy_status}" ]]; then echo && echo -e "当前自动更新 Telegram IP段功能: ${Red_font_prefix}未开启${Font_color_suffix}" && echo echo -e "确定要开启 ${Green_font_prefix}MTProxy 自动更新 Telegram IP段${Font_color_suffix} 功能吗?[Y/n]" - stty erase '^H' && read -p "(默认: y):" crontab_update_mtproxy_status_ny + read -e -p "(默认: y):" crontab_update_mtproxy_status_ny [[ -z "${crontab_update_mtproxy_status_ny}" ]] && crontab_update_mtproxy_status_ny="y" if [[ ${crontab_update_mtproxy_status_ny} == [Yy] ]]; then crontab_update_mtproxy_cron_start @@ -580,7 +580,7 @@ Set_crontab_update_mtproxy(){ else echo && echo -e "当前自动更新 Telegram IP段功能: ${Green_font_prefix}已开启${Font_color_suffix}" && echo echo -e "确定要关闭 ${Red_font_prefix}MTProxy 自动更新 Telegram IP段${Font_color_suffix} 功能吗?[y/N]" - stty erase '^H' && read -p "(默认: n):" crontab_update_mtproxy_status_ny + read -e -p "(默认: n):" crontab_update_mtproxy_status_ny [[ -z "${crontab_update_mtproxy_status_ny}" ]] && crontab_update_mtproxy_status_ny="n" if [[ ${crontab_update_mtproxy_status_ny} == [Yy] ]]; then crontab_update_mtproxy_cron_stop @@ -693,7 +693,7 @@ else echo -e " 当前状态: ${Red_font_prefix}未安装${Font_color_suffix}" fi echo - stty erase '^H' && read -p " 请输入数字 [0-10]:" num + read -e -p " 请输入数字 [0-10]:" num case "$num" in 0) Update_Shell diff --git a/ocserv.sh b/ocserv.sh index 7b5b10e..6961c9c 100644 --- a/ocserv.sh +++ b/ocserv.sh @@ -121,7 +121,7 @@ crl_signing_key' > ca.tmpl Get_ip if [[ -z "$ip" ]]; then echo -e "${Error} 检测外网IP失败 !" - stty erase '^H' && read -p "请手动输入你的服务器外网IP:" ip + read -e -p "请手动输入你的服务器外网IP:" ip [[ -z "${ip}" ]] && echo "取消..." && over fi echo -e 'cn = "'${ip}'" @@ -224,7 +224,7 @@ Set_ocserv(){ Add_iptables Save_iptables echo "是否重启 ocserv ? (Y/n)" - stty erase '^H' && read -p "(默认: Y):" yn + read -e -p "(默认: Y):" yn [[ -z ${yn} ]] && yn="y" if [[ ${yn} == [Yy] ]]; then Restart_ocserv @@ -232,13 +232,13 @@ Set_ocserv(){ } Set_username(){ echo "请输入 要添加的VPN账号 用户名" - stty erase '^H' && read -p "(默认: admin):" username + read -e -p "(默认: admin):" username [[ -z "${username}" ]] && username="admin" echo && echo -e " 用户名 : ${Red_font_prefix}${username}${Font_color_suffix}" && echo } Set_passwd(){ echo "请输入 要添加的VPN账号 密码" - stty erase '^H' && read -p "(默认: doub.io):" userpass + read -e -p "(默认: doub.io):" userpass [[ -z "${userpass}" ]] && userpass="doub.io" echo && echo -e " 密码 : ${Red_font_prefix}${userpass}${Font_color_suffix}" && echo } @@ -246,7 +246,7 @@ Set_tcp_port(){ while true do echo -e "请输入VPN服务端的TCP端口" - stty erase '^H' && read -p "(默认: 443):" set_tcp_port + read -e -p "(默认: 443):" set_tcp_port [[ -z "$set_tcp_port" ]] && set_tcp_port="443" echo $((${set_tcp_port}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -265,7 +265,7 @@ Set_udp_port(){ while true do echo -e "请输入VPN服务端的UDP端口" - stty erase '^H' && read -p "(默认: ${set_tcp_port}):" set_udp_port + read -e -p "(默认: ${set_tcp_port}):" set_udp_port [[ -z "$set_udp_port" ]] && set_udp_port="${set_tcp_port}" echo $((${set_udp_port}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -335,7 +335,7 @@ Del_User(){ List_User [[ ${User_num} == 1 ]] && echo -e "${Error} 当前仅剩一个账号配置,无法删除 !" && exit 1 echo -e "请输入要删除的VPN账号的用户名" - stty erase '^H' && read -p "(默认取消):" Del_username + read -e -p "(默认取消):" Del_username [[ -z "${Del_username}" ]] && echo "已取消..." && exit 1 user_status=$(cat "${passwd_file}"|grep "${Del_username}"':*:') [[ -z ${user_status} ]] && echo -e "${Error} 用户名不存在 ! [${Del_username}]" && exit 1 @@ -350,7 +350,7 @@ Del_User(){ Modify_User_disabled(){ List_User echo -e "请输入要启用/禁用的VPN账号的用户名" - stty erase '^H' && read -p "(默认取消):" Modify_username + read -e -p "(默认取消):" Modify_username [[ -z "${Modify_username}" ]] && echo "已取消..." && exit 1 user_status=$(cat "${passwd_file}"|grep "${Modify_username}"':*:') [[ -z ${user_status} ]] && echo -e "${Error} 用户名不存在 ! [${Modify_username}]" && exit 1 @@ -385,7 +385,7 @@ Set_Pass(){ ${Green_font_prefix} 3.${Font_color_suffix} 启用/禁用 账号配置 注意:添加/修改/删除 账号配置后,VPN服务端会实时读取,无需重启服务端 !" && echo - stty erase '^H' && read -p "(默认: 取消):" set_num + read -e -p "(默认: 取消):" set_num [[ -z "${set_num}" ]] && echo "已取消..." && exit 1 if [[ ${set_num} == "0" ]]; then List_User @@ -421,7 +421,7 @@ Uninstall_ocserv(){ check_installed_status "un" echo "确定要卸载 ocserv ? (y/N)" echo - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then check_pid @@ -476,7 +476,7 @@ Set_iptables(){ ifconfig_status=$(ifconfig) if [[ -z ${ifconfig_status} ]]; then echo -e "${Error} ifconfig 未安装 !" - stty erase '^H' && read -p "请手动输入你的网卡名(一般情况下,网卡名为 eth0,Debian9 则为 ens3,CentOS Ubuntu 最新版本可能为 enpXsX(X代表数字或字母),OpenVZ 虚拟化则为 venet0):" Network_card + read -e -p "请手动输入你的网卡名(一般情况下,网卡名为 eth0,Debian9 则为 ens3,CentOS Ubuntu 最新版本可能为 enpXsX(X代表数字或字母),OpenVZ 虚拟化则为 venet0):" Network_card [[ -z "${Network_card}" ]] && echo "取消..." && exit 1 else Network_card=$(ifconfig|grep "eth0") @@ -492,7 +492,7 @@ Set_iptables(){ Network_card="venet0" else ifconfig - stty erase '^H' && read -p "检测到本服务器的网卡非 eth0 \ ens3(Debian9) \ venet0(OpenVZ) \ enpXsX(CentOS Ubuntu 最新版本,X代表数字或字母),请根据上面输出的网卡信息手动输入你的网卡名:" Network_card + read -e -p "检测到本服务器的网卡非 eth0 \ ens3(Debian9) \ venet0(OpenVZ) \ enpXsX(CentOS Ubuntu 最新版本,X代表数字或字母),请根据上面输出的网卡信息手动输入你的网卡名:" Network_card [[ -z "${Network_card}" ]] && echo "取消..." && exit 1 fi fi @@ -544,7 +544,7 @@ else echo -e " 当前状态: ${Red_font_prefix}未安装${Font_color_suffix}" fi echo -stty erase '^H' && read -p " 请输入数字 [0-9]:" num +read -e -p " 请输入数字 [0-9]:" num case "$num" in 0) Update_Shell diff --git a/pipes.sh b/pipes.sh index 73674d0..5f90314 100644 --- a/pipes.sh +++ b/pipes.sh @@ -47,7 +47,7 @@ check_ver_comparison(){ if [[ ${pipes_now_ver} != "" ]]; then if [[ ${pipes_now_ver} != ${pipes_new_ver} ]]; then echo -e "${Info_font_prefix}[信息]${Font_suffix} 发现 PipeSocks 已有新版本 [v${pipes_new_ver}] !" - stty erase '^H' && read -p "是否更新 ? [Y/n] :" yn + read -e -p "是否更新 ? [Y/n] :" yn [[ -z "${yn}" ]] && yn="y" if [[ $yn == [Yy] ]]; then PID=`ps -ef|grep "pipesocks"|grep -v "grep"|awk '{print $2}'` && [[ ! -z $PID ]] && kill -9 ${PID} @@ -141,7 +141,7 @@ Set_user_pipes(){ while true do echo -e "请输入 PipeSocks 本地监听端口 [1-65535]" - stty erase '^H' && read -p "(默认: 2333):" pipes_port + read -e -p "(默认: 2333):" pipes_port [[ -z "$pipes_port" ]] && pipes_port="2333" echo $((${pipes_port}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -158,7 +158,7 @@ Set_user_pipes(){ fi done echo "请输入 PipeSocks 密码" - stty erase '^H' && read -p "(默认: doub.io):" pipes_passwd + read -e -p "(默认: doub.io):" pipes_passwd [[ -z "${pipes_passwd}" ]] && pipes_passwd="doub.io" echo && echo "————————————————————" echo -e " 密码 : ${Info_font_prefix}${pipes_passwd}${Font_suffix}" @@ -239,7 +239,7 @@ Log_pipes(){ Uninstall_pipes(){ check_installed_status echo "确定要卸载 PipeSocks ? [y/N]" && echo - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then PID=`ps -ef|grep "pipesocks"|grep -v "grep"|awk '{print $2}'` @@ -284,7 +284,7 @@ else echo -e " 当前状态: ${Error_font_prefix}未安装${Font_suffix}" fi echo -stty erase '^H' && read -p " 请输入数字 [1-9]:" num +read -e -p " 请输入数字 [1-9]:" num case "$num" in 1) Install_pipes diff --git a/pserver.sh b/pserver.sh index ab3ced4..35d8bfb 100644 --- a/pserver.sh +++ b/pserver.sh @@ -153,7 +153,7 @@ Set_port(){ while true do echo -e "请输入 Peerflix Server 监听端口 [1-65535](如果是绑定的域名,那么建议80端口)" - stty erase '^H' && read -p "(默认端口: 9000):" ps_port + read -e -p "(默认端口: 9000):" ps_port [[ -z "${ps_port}" ]] && ps_port="9000" echo $((${ps_port}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -230,7 +230,7 @@ Uninstall_ps(){ check_installed_status echo "确定要卸载 Peerflix Server ? (y/N)" echo - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then check_pid @@ -340,7 +340,7 @@ else echo -e " 当前状态: ${Red_font_prefix}未安装${Font_color_suffix}" fi echo -stty erase '^H' && read -p " 请输入数字 [0-8]:" num +read -e -p " 请输入数字 [0-8]:" num case "$num" in 0) Update_Shell diff --git a/pythonhttp.sh b/pythonhttp.sh index aae9f80..3e88f57 100644 --- a/pythonhttp.sh +++ b/pythonhttp.sh @@ -15,7 +15,7 @@ sethttp(){ while true do echo -e "请输入要开放的HTTP服务端口 [1-65535]" - stty erase '^H' && read -p "(默认端口: 8000):" httpport + read -e -p "(默认端口: 8000):" httpport [[ -z "$httpport" ]] && httpport="8000" expr ${httpport} + 0 &>/dev/null if [[ $? -eq 0 ]]; then @@ -33,7 +33,7 @@ sethttp(){ done #设置目录 echo "请输入要开放的目录(绝对路径)" - stty erase '^H' && read -p "(直接回车, 默认当前文件夹):" httpfile + read -e -p "(直接回车, 默认当前文件夹):" httpfile if [[ ! -z $httpfile ]]; then [[ ! -e $httpfile ]] && echo -e "\033[41;37m [错误] \033[0m 输入的目录不存在 或 当前用户无权限访问, 请检查!" && exit 1 else @@ -48,7 +48,7 @@ sethttp(){ echo -e " 目录 : \033[41;37m ${httpfile} \033[0m" echo "========================" echo - stty erase '^H' && read -p "按任意键继续,如有错误,请使用 Ctrl + C 退出." var + read -e -p "按任意键继续,如有错误,请使用 Ctrl + C 退出." var } iptables_add(){ iptables -I INPUT -m state --state NEW -m tcp -p tcp --dport ${httpport} -j ACCEPT diff --git a/socat.sh b/socat.sh index aad6c6b..9c21d75 100644 --- a/socat.sh +++ b/socat.sh @@ -68,7 +68,7 @@ addSocat(){ while true do echo -e "请输入 Socat 的 本地监听端口 [1-65535]" - stty erase '^H' && read -p "(默认端口: 23333):" Socatport + read -e -p "(默认端口: 23333):" Socatport [[ -z "$Socatport" ]] && Socatport="23333" echo $((${Socatport}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -90,7 +90,7 @@ addSocat(){ while true do echo -e "请输入 Socat 远程被转发 端口 [1-65535]" - stty erase '^H' && read -p "(默认端口: ${Socatport}):" Socatport1 + read -e -p "(默认端口: ${Socatport}):" Socatport1 [[ -z "$Socatport1" ]] && Socatport1=${Socatport} echo $((${Socatport1}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -109,7 +109,7 @@ addSocat(){ fi done # 设置欲转发 IP - stty erase '^H' && read -p "请输入 Socat 远程被转发 IP:" socatip + read -e -p "请输入 Socat 远程被转发 IP:" socatip [[ -z "${socatip}" ]] && echo "取消..." && exit 1 echo echo "——————————————————————————————" @@ -122,7 +122,7 @@ addSocat(){ echo "2. UDP" echo "3. TCP+UDP" echo - stty erase '^H' && read -p "(默认: TCP+UDP):" socattype_num + read -e -p "(默认: TCP+UDP):" socattype_num [[ -z "${socattype_num}" ]] && socattype_num="3" if [[ ${socattype_num} = "1" ]]; then socattype="TCP" @@ -144,7 +144,7 @@ addSocat(){ echo -e " 转发类型\t : ${Red_background_prefix} ${socattype} ${Font_color_suffix}" echo "——————————————————————————————" echo - stty erase '^H' && read -p "请按任意键继续,如有配置错误请使用 Ctrl+C 退出。" var + read -e -p "请按任意键继续,如有配置错误请使用 Ctrl+C 退出。" var startSocat # 获取IP ip=`wget -qO- -t1 -T2 ipinfo.io/ip` @@ -239,7 +239,7 @@ delSocat(){ do # 列出 Socat listSocat - stty erase '^H' && read -p "请输入数字 来选择要终止的 Socat 进程:" stopsocat + read -e -p "请输入数字 来选择要终止的 Socat 进程:" stopsocat [[ -z "${stopsocat}" ]] && stopsocat="0" echo $((${stopsocat}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -289,7 +289,7 @@ tailSocat(){ uninstallSocat(){ check_socat echo "确定要卸载 Socat ? [y/N]" - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then PID=$(ps -ef | grep "socat" | grep -v grep | grep -v ".sh" |awk '{print $2}') @@ -330,7 +330,7 @@ else echo -e " 当前状态: ${Red_font_prefix}未安装${Font_color_suffix}" fi echo -stty erase '^H' && read -p " 请输入数字 [0-9]:" num +read -e -p " 请输入数字 [0-9]:" num case "$num" in 0) Update_Shell diff --git a/ssh_port.sh b/ssh_port.sh index f4f724d..cab1891 100644 --- a/ssh_port.sh +++ b/ssh_port.sh @@ -67,7 +67,7 @@ Set_port(){ do echo -e "\n旧SSH端口:${Green_font_prefix}[${port}]${Font_color_suffix}" echo -e "请输入新的SSH端口 [1-65535]" - stty erase '^H' && read -p "(输入为空则取消):" new_port + read -e -p "(输入为空则取消):" new_port [[ -z "${new_port}" ]] && echo "取消..." && exit 1 echo $((${new_port}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -95,7 +95,7 @@ choose_the_way(){ 一般来说修改SSH端口不会出现什么问题,但保守起见,我做了两个修改方式。 如果不懂请选 ${Green_font_prefix}[2. 保守修改]${Font_color_suffix},避免因为未知问题而导致修改后无法通过 新端口和旧端口 链接服务器!\n ${over_text}\n" - stty erase '^H' && read -p "(默认: 2. 保守修改):" choose_the_way_num + read -e -p "(默认: 2. 保守修改):" choose_the_way_num [[ -z "${choose_the_way_num}" ]] && choose_the_way_num="2" if [[ ${choose_the_way_num} == "1" ]]; then cp -f "${CONF}" "/etc/ssh/sshd_config.bak" diff --git a/ssr.sh b/ssr.sh index 8544046..4e09076 100644 --- a/ssr.sh +++ b/ssr.sh @@ -247,7 +247,7 @@ Set_config_port(){ while true do echo -e "请输入要设置的ShadowsocksR账号 端口" - stty erase '^H' && read -p "(默认: 2333):" ssr_port + read -e -p "(默认: 2333):" ssr_port [[ -z "$ssr_port" ]] && ssr_port="2333" echo $((${ssr_port}+0)) &>/dev/null if [[ $? == 0 ]]; then @@ -264,7 +264,7 @@ Set_config_port(){ } Set_config_password(){ echo "请输入要设置的ShadowsocksR账号 密码" - stty erase '^H' && read -p "(默认: doub.io):" ssr_password + read -e -p "(默认: doub.io):" ssr_password [[ -z "${ssr_password}" ]] && ssr_password="doub.io" echo && echo ${Separator_1} && echo -e " 密码 : ${Green_font_prefix}${ssr_password}${Font_color_suffix}" && echo ${Separator_1} && echo } @@ -294,7 +294,7 @@ Set_config_method(){ ${Green_font_prefix}15.${Font_color_suffix} chacha20 ${Green_font_prefix}16.${Font_color_suffix} chacha20-ietf ${Tip} salsa20/chacha20-*系列加密方式,需要额外安装依赖 libsodium ,否则会无法启动ShadowsocksR !" && echo - stty erase '^H' && read -p "(默认: 5. aes-128-ctr):" ssr_method + read -e -p "(默认: 5. aes-128-ctr):" ssr_method [[ -z "${ssr_method}" ]] && ssr_method="5" if [[ ${ssr_method} == "1" ]]; then ssr_method="none" @@ -343,7 +343,7 @@ Set_config_protocol(){ ${Green_font_prefix}5.${Font_color_suffix} auth_chain_a ${Green_font_prefix}6.${Font_color_suffix} auth_chain_b ${Tip} 如果使用 auth_chain_a 协议,请加密方式选择 none,混淆随意(建议 plain)" && echo - stty erase '^H' && read -p "(默认: 2. auth_sha1_v4):" ssr_protocol + read -e -p "(默认: 2. auth_sha1_v4):" ssr_protocol [[ -z "${ssr_protocol}" ]] && ssr_protocol="2" if [[ ${ssr_protocol} == "1" ]]; then ssr_protocol="origin" @@ -363,7 +363,7 @@ Set_config_protocol(){ echo && echo ${Separator_1} && echo -e " 协议 : ${Green_font_prefix}${ssr_protocol}${Font_color_suffix}" && echo ${Separator_1} && echo if [[ ${ssr_protocol} != "origin" ]]; then if [[ ${ssr_protocol} == "auth_sha1_v4" ]]; then - stty erase '^H' && read -p "是否设置 协议插件兼容原版(_compatible)?[Y/n]" ssr_protocol_yn + read -e -p "是否设置 协议插件兼容原版(_compatible)?[Y/n]" ssr_protocol_yn [[ -z "${ssr_protocol_yn}" ]] && ssr_protocol_yn="y" [[ $ssr_protocol_yn == [Yy] ]] && ssr_protocol=${ssr_protocol}"_compatible" echo @@ -379,7 +379,7 @@ Set_config_obfs(){ ${Green_font_prefix}4.${Font_color_suffix} random_head ${Green_font_prefix}5.${Font_color_suffix} tls1.2_ticket_auth ${Tip} 如果使用 ShadowsocksR 加速游戏,请选择 混淆兼容原版或 plain 混淆,然后客户端选择 plain,否则会增加延迟 !" && echo - stty erase '^H' && read -p "(默认: 2. http_simple):" ssr_obfs + read -e -p "(默认: 2. http_simple):" ssr_obfs [[ -z "${ssr_obfs}" ]] && ssr_obfs="2" if [[ ${ssr_obfs} == "1" ]]; then ssr_obfs="plain" @@ -396,7 +396,7 @@ Set_config_obfs(){ fi echo && echo ${Separator_1} && echo -e " 混淆 : ${Green_font_prefix}${ssr_obfs}${Font_color_suffix}" && echo ${Separator_1} && echo if [[ ${ssr_obfs} != "plain" ]]; then - stty erase '^H' && read -p "是否设置 混淆插件兼容原版(_compatible)?[Y/n]" ssr_obfs_yn + read -e -p "是否设置 混淆插件兼容原版(_compatible)?[Y/n]" ssr_obfs_yn [[ -z "${ssr_obfs_yn}" ]] && ssr_obfs_yn="y" [[ $ssr_obfs_yn == [Yy] ]] && ssr_obfs=${ssr_obfs}"_compatible" echo @@ -407,7 +407,7 @@ Set_config_protocol_param(){ do echo -e "请输入要设置的ShadowsocksR账号 欲限制的设备数 (${Green_font_prefix} auth_* 系列协议 不兼容原版才有效 ${Font_color_suffix})" echo -e "${Tip} 设备数限制:每个端口同一时间能链接的客户端数量(多端口模式,每个端口都是独立计算),建议最少 2个。" - stty erase '^H' && read -p "(默认: 无限):" ssr_protocol_param + read -e -p "(默认: 无限):" ssr_protocol_param [[ -z "$ssr_protocol_param" ]] && ssr_protocol_param="" && echo && break echo $((${ssr_protocol_param}+0)) &>/dev/null if [[ $? == 0 ]]; then @@ -427,7 +427,7 @@ Set_config_speed_limit_per_con(){ do echo -e "请输入要设置的每个端口 单线程 限速上限(单位:KB/S)" echo -e "${Tip} 单线程限速:每个端口 单线程的限速上限,多线程即无效。" - stty erase '^H' && read -p "(默认: 无限):" ssr_speed_limit_per_con + read -e -p "(默认: 无限):" ssr_speed_limit_per_con [[ -z "$ssr_speed_limit_per_con" ]] && ssr_speed_limit_per_con=0 && echo && break echo $((${ssr_speed_limit_per_con}+0)) &>/dev/null if [[ $? == 0 ]]; then @@ -448,7 +448,7 @@ Set_config_speed_limit_per_user(){ echo echo -e "请输入要设置的每个端口 总速度 限速上限(单位:KB/S)" echo -e "${Tip} 端口总限速:每个端口 总速度 限速上限,单个端口整体限速。" - stty erase '^H' && read -p "(默认: 无限):" ssr_speed_limit_per_user + read -e -p "(默认: 无限):" ssr_speed_limit_per_user [[ -z "$ssr_speed_limit_per_user" ]] && ssr_speed_limit_per_user=0 && echo && break echo $((${ssr_speed_limit_per_user}+0)) &>/dev/null if [[ $? == 0 ]]; then @@ -705,7 +705,7 @@ Update_SSR(){ Uninstall_SSR(){ [[ ! -e ${config_user_file} ]] && [[ ! -e ${ssr_folder} ]] && echo -e "${Error} 没有安装 ShadowsocksR,请检查 !" && exit 1 echo "确定要 卸载ShadowsocksR?[y/N]" && echo - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then check_pid @@ -741,7 +741,7 @@ Check_Libsodium_ver(){ Install_Libsodium(){ if [[ -e ${Libsodiumr_file} ]]; then echo -e "${Error} libsodium 已安装 , 是否覆盖安装(更新)?[y/N]" - stty erase '^H' && read -p "(默认: n):" yn + read -e -p "(默认: n):" yn [[ -z ${yn} ]] && yn="n" if [[ ${yn} == [Nn] ]]; then echo "已取消..." && exit 1 @@ -875,7 +875,7 @@ View_user_connection_info(){ echo && echo -e "请选择要显示的格式: ${Green_font_prefix}1.${Font_color_suffix} 显示 IP 格式 ${Green_font_prefix}2.${Font_color_suffix} 显示 IP+IP归属地 格式" && echo - stty erase '^H' && read -p "(默认: 1):" ssr_connection_info + read -e -p "(默认: 1):" ssr_connection_info [[ -z "${ssr_connection_info}" ]] && ssr_connection_info="1" if [[ ${ssr_connection_info} == "1" ]]; then View_user_connection_info_1 "" @@ -929,7 +929,7 @@ Modify_Config(){ ${Green_font_prefix}7.${Font_color_suffix} 修改 单线程限速 ${Green_font_prefix}8.${Font_color_suffix} 修改 端口总限速 ${Green_font_prefix}9.${Font_color_suffix} 修改 全部配置" && echo - stty erase '^H' && read -p "(默认: 取消):" ssr_modify + read -e -p "(默认: 取消):" ssr_modify [[ -z "${ssr_modify}" ]] && echo "已取消..." && exit 1 Get_User if [[ ${ssr_modify} == "1" ]]; then @@ -978,7 +978,7 @@ Modify_Config(){ ${Green_font_prefix}8.${Font_color_suffix} 修改 单线程限速 ${Green_font_prefix}9.${Font_color_suffix} 修改 端口总限速 ${Green_font_prefix}10.${Font_color_suffix} 修改 全部配置" && echo - stty erase '^H' && read -p "(默认: 取消):" ssr_modify + read -e -p "(默认: 取消):" ssr_modify [[ -z "${ssr_modify}" ]] && echo "已取消..." && exit 1 Get_User if [[ ${ssr_modify} == "1" ]]; then @@ -1052,7 +1052,7 @@ Add_multi_port_user(){ Modify_multi_port_user(){ List_multi_port_user echo && echo -e "请输入要修改的用户端口" - stty erase '^H' && read -p "(默认: 取消):" modify_user_port + read -e -p "(默认: 取消):" modify_user_port [[ -z "${modify_user_port}" ]] && echo -e "已取消..." && exit 1 del_user=`cat ${config_user_file}|grep '"'"${modify_user_port}"'"'` if [[ ! -z "${del_user}" ]]; then @@ -1075,7 +1075,7 @@ Del_multi_port_user(){ user_total=`${jq_file} '.port_password' ${config_user_file} | sed '$d' | sed "1d" | wc -l` [[ "${user_total}" = "1" ]] && echo -e "${Error} 多端口用户仅剩 1个,不能删除 !" && exit 1 echo -e "请输入要删除的用户端口" - stty erase '^H' && read -p "(默认: 取消):" del_user_port + read -e -p "(默认: 取消):" del_user_port [[ -z "${del_user_port}" ]] && echo -e "已取消..." && exit 1 del_user=`cat ${config_user_file}|grep '"'"${del_user_port}"'"'` if [[ ! -z ${del_user} ]]; then @@ -1113,7 +1113,7 @@ Port_mode_switching(){ if [[ -z "${now_mode}" ]]; then echo && echo -e " 当前模式: ${Green_font_prefix}单端口${Font_color_suffix}" && echo echo -e "确定要切换为 多端口模式?[y/N]" - stty erase '^H' && read -p "(默认: n):" mode_yn + read -e -p "(默认: n):" mode_yn [[ -z ${mode_yn} ]] && mode_yn="n" if [[ ${mode_yn} == [Yy] ]]; then port=`${jq_file} '.server_port' ${config_user_file}` @@ -1129,7 +1129,7 @@ Port_mode_switching(){ else echo && echo -e " 当前模式: ${Green_font_prefix}多端口${Font_color_suffix}" && echo echo -e "确定要切换为 单端口模式?[y/N]" - stty erase '^H' && read -p "(默认: n):" mode_yn + read -e -p "(默认: n):" mode_yn [[ -z ${mode_yn} ]] && mode_yn="n" if [[ ${mode_yn} == [Yy] ]]; then user_total=`${jq_file} '.port_password' ${config_user_file} | sed '$d' | sed "1d" | wc -l` @@ -1187,7 +1187,7 @@ Configure_Server_Speeder(){ ${Green_font_prefix}6.${Font_color_suffix} 查看 锐速 状态 注意: 锐速和LotServer不能同时安装/启动!" && echo - stty erase '^H' && read -p "(默认: 取消):" server_speeder_num + read -e -p "(默认: 取消):" server_speeder_num [[ -z "${server_speeder_num}" ]] && echo "已取消..." && exit 1 if [[ ${server_speeder_num} == "1" ]]; then Install_ServerSpeeder @@ -1232,7 +1232,7 @@ Install_ServerSpeeder(){ } Uninstall_ServerSpeeder(){ echo "确定要卸载 锐速(Server Speeder)?[y/N]" && echo - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && echo && echo "已取消..." && exit 1 if [[ ${unyn} == [Yy] ]]; then chattr -i /serverspeeder/etc/apx* @@ -1252,7 +1252,7 @@ Configure_LotServer(){ ${Green_font_prefix}6.${Font_color_suffix} 查看 LotServer 状态 注意: 锐速和LotServer不能同时安装/启动!" && echo - stty erase '^H' && read -p "(默认: 取消):" lotserver_num + read -e -p "(默认: 取消):" lotserver_num [[ -z "${lotserver_num}" ]] && echo "已取消..." && exit 1 if [[ ${lotserver_num} == "1" ]]; then Install_LotServer @@ -1293,7 +1293,7 @@ Install_LotServer(){ } Uninstall_LotServer(){ echo "确定要卸载 LotServer?[y/N]" && echo - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && echo && echo "已取消..." && exit 1 if [[ ${unyn} == [Yy] ]]; then wget --no-check-certificate -qO /tmp/appex.sh "https://raw.githubusercontent.com/0oVicero0/serverSpeeder_Install/master/appex.sh" && bash /tmp/appex.sh 'uninstall' @@ -1313,7 +1313,7 @@ echo -e "${Green_font_prefix} [安装前 请注意] ${Font_color_suffix} 1. 安装开启BBR,需要更换内核,存在更换失败等风险(重启后无法开机) 2. 本脚本仅支持 Debian / Ubuntu 系统更换内核,OpenVZ和Docker 不支持更换内核 3. Debian 更换内核过程中会提示 [ 是否终止卸载内核 ] ,请选择 ${Green_font_prefix} NO ${Font_color_suffix}" && echo - stty erase '^H' && read -p "(默认: 取消):" bbr_num + read -e -p "(默认: 取消):" bbr_num [[ -z "${bbr_num}" ]] && echo "已取消..." && exit 1 if [[ ${bbr_num} == "1" ]]; then Install_BBR @@ -1358,7 +1358,7 @@ Other_functions(){ ${Green_font_prefix}5.${Font_color_suffix} 一键解封 BT/PT/SPAM (iptables) ${Green_font_prefix}6.${Font_color_suffix} 切换 ShadowsocksR日志输出模式 ——说明:SSR默认只输出错误日志,此项可切换为输出详细的访问日志" && echo - stty erase '^H' && read -p "(默认: 取消):" other_num + read -e -p "(默认: 取消):" other_num [[ -z "${other_num}" ]] && echo "已取消..." && exit 1 if [[ ${other_num} == "1" ]]; then Configure_BBR @@ -1392,7 +1392,7 @@ Set_config_connect_verbose_info(){ if [[ ${connect_verbose_info} = "0" ]]; then echo && echo -e "当前日志模式: ${Green_font_prefix}简单模式(只输出错误日志)${Font_color_suffix}" && echo echo -e "确定要切换为 ${Green_font_prefix}详细模式(输出详细连接日志+错误日志)${Font_color_suffix}?[y/N]" - stty erase '^H' && read -p "(默认: n):" connect_verbose_info_ny + read -e -p "(默认: n):" connect_verbose_info_ny [[ -z "${connect_verbose_info_ny}" ]] && connect_verbose_info_ny="n" if [[ ${connect_verbose_info_ny} == [Yy] ]]; then ssr_connect_verbose_info="1" @@ -1404,7 +1404,7 @@ Set_config_connect_verbose_info(){ else echo && echo -e "当前日志模式: ${Green_font_prefix}详细模式(输出详细连接日志+错误日志)${Font_color_suffix}" && echo echo -e "确定要切换为 ${Green_font_prefix}简单模式(只输出错误日志)${Font_color_suffix}?[y/N]" - stty erase '^H' && read -p "(默认: n):" connect_verbose_info_ny + read -e -p "(默认: n):" connect_verbose_info_ny [[ -z "${connect_verbose_info_ny}" ]] && connect_verbose_info_ny="n" if [[ ${connect_verbose_info_ny} == [Yy] ]]; then ssr_connect_verbose_info="0" @@ -1469,7 +1469,7 @@ echo -e " ShadowsocksR 一键管理脚本 ${Red_font_prefix}[v${sh_ver}]${Font_ ${Green_font_prefix}15.${Font_color_suffix} 升级脚本 " menu_status -echo && stty erase '^H' && read -p "请输入数字 [1-15]:" num +echo && read -e -p "请输入数字 [1-15]:" num case "$num" in 1) Install_SSR diff --git a/ssr_check.sh b/ssr_check.sh index b12a027..2c5c07e 100644 --- a/ssr_check.sh +++ b/ssr_check.sh @@ -20,7 +20,7 @@ Info="${Green_font_prefix}[信息]${Font_color_suffix}" && Error="${Red_font_pre set_config_ip(){ echo "请输入 ShadowsocksR 账号服务器公网IP" - stty erase '^H' && read -p "(默认取消):" ip + read -e -p "(默认取消):" ip [[ -z "${ip}" ]] && echo "已取消..." && exit 1 echo && echo -e " I P : ${Red_font_prefix}${ip}${Font_color_suffix}" && echo } @@ -28,7 +28,7 @@ set_config_port(){ while true do echo -e "请输入 ShadowsocksR 账号端口" - stty erase '^H' && read -p "(默认: 2333):" port + read -e -p "(默认: 2333):" port [[ -z "$port" ]] && port="2333" echo $((${port}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -45,7 +45,7 @@ set_config_port(){ } set_config_password(){ echo "请输入 ShadowsocksR 账号密码" - stty erase '^H' && read -p "(默认: doub.io):" passwd + read -e -p "(默认: doub.io):" passwd [[ -z "${passwd}" ]] && passwd="doub.io" echo && echo -e " 密码 : ${Red_font_prefix}${passwd}${Font_color_suffix}" && echo } @@ -74,7 +74,7 @@ set_config_method(){ ${Green_font_prefix}15.${Font_color_suffix} chacha20 ${Green_font_prefix}16.${Font_color_suffix} chacha20-ietf ${Tip} salsa20/chacha20-*系列加密方式,需要额外安装依赖 libsodium ,否则会无法启动ShadowsocksR !" && echo - stty erase '^H' && read -p "(默认: 5. aes-128-ctr):" method + read -e -p "(默认: 5. aes-128-ctr):" method [[ -z "${method}" ]] && method="5" if [[ ${method} == "1" ]]; then method="none" @@ -121,7 +121,7 @@ set_config_protocol(){ ${Green_font_prefix}4.${Font_color_suffix} auth_aes128_sha1 ${Green_font_prefix}5.${Font_color_suffix} auth_chain_a ${Tip} 如果使用 auth_chain_a 协议,请加密方式选择 none,混淆随意(建议 plain)" && echo - stty erase '^H' && read -p "(默认: 2. auth_sha1_v4):" protocol + read -e -p "(默认: 2. auth_sha1_v4):" protocol [[ -z "${protocol}" ]] && protocol="2" if [[ ${protocol} == "1" ]]; then protocol="origin" @@ -146,7 +146,7 @@ set_config_obfs(){ ${Green_font_prefix}4.${Font_color_suffix} random_head ${Green_font_prefix}5.${Font_color_suffix} tls1.2_ticket_auth ${Tip} 如果使用 ShadowsocksR 加速游戏,请选择 混淆兼容原版或 plain 混淆,然后客户端选择 plain,否则会增加延迟 !" && echo - stty erase '^H' && read -p "(默认: 5. tls1.2_ticket_auth):" obfs + read -e -p "(默认: 5. tls1.2_ticket_auth):" obfs [[ -z "${obfs}" ]] && obfs="5" if [[ ${obfs} == "1" ]]; then obfs="plain" @@ -165,7 +165,7 @@ set_config_obfs(){ } set_config_like(){ echo "请输入 ShadowsocksR 的链接(SS/SSR链接皆可,如 ss://xxxx ssr://xxxx)" - stty erase '^H' && read -p "(默认回车取消):" Like + read -e -p "(默认回车取消):" Like [[ -z "${Like}" ]] && echo "已取消..." && exit 1 echo && echo -e " 链接 : ${Red_font_prefix}${Like}${Font_color_suffix}" && echo } @@ -173,7 +173,7 @@ set_config_user(){ echo -e "请输入选择输入方式 ${Green_font_prefix}1.${Font_color_suffix} 输入ShadowsocksR账号全部信息(Shadowsocks原版也可以) ${Green_font_prefix}2.${Font_color_suffix} 输入ShadowsocksR账号的 SSR链接(Shadowsocks原版也可以)" - stty erase '^H' && read -p "(默认:2):" enter_type + read -e -p "(默认:2):" enter_type [[ -z "${enter_type}" ]] && enter_type="2" if [[ ${enter_type} == "1" ]]; then echo -e "下面依次开始输入要检测可用性的 ShadowsocksR账号信息。" && echo diff --git a/ssrmu.sh b/ssrmu.sh index 7d41387..d3cb93c 100644 --- a/ssrmu.sh +++ b/ssrmu.sh @@ -331,7 +331,7 @@ View_User(){ while true do echo -e "请输入要查看账号信息的用户 端口" - stty erase '^H' && read -p "(默认: 取消):" View_user_port + read -e -p "(默认: 取消):" View_user_port [[ -z "${View_user_port}" ]] && echo -e "已取消..." && exit 1 View_user=$(cat "${config_user_mudb_file}"|grep '"port": '"${View_user_port}"',') if [[ ! -z ${View_user} ]]; then @@ -373,7 +373,7 @@ View_User_info(){ # 设置 配置信息 Set_config_user(){ echo "请输入要设置的用户 用户名(请勿重复, 用于区分, 不支持中文、空格, 会报错 !)" - stty erase '^H' && read -p "(默认: doubi):" ssr_user + read -e -p "(默认: doubi):" ssr_user [[ -z "${ssr_user}" ]] && ssr_user="doubi" ssr_user=$(echo "${ssr_user}"|sed 's/ //g') echo && echo ${Separator_1} && echo -e " 用户名 : ${Green_font_prefix}${ssr_user}${Font_color_suffix}" && echo ${Separator_1} && echo @@ -382,7 +382,7 @@ Set_config_port(){ while true do echo -e "请输入要设置的用户 端口(请勿重复, 用于区分)" - stty erase '^H' && read -p "(默认: 2333):" ssr_port + read -e -p "(默认: 2333):" ssr_port [[ -z "$ssr_port" ]] && ssr_port="2333" echo $((${ssr_port}+0)) &>/dev/null if [[ $? == 0 ]]; then @@ -399,7 +399,7 @@ Set_config_port(){ } Set_config_password(){ echo "请输入要设置的用户 密码" - stty erase '^H' && read -p "(默认: doub.io):" ssr_password + read -e -p "(默认: doub.io):" ssr_password [[ -z "${ssr_password}" ]] && ssr_password="doub.io" echo && echo ${Separator_1} && echo -e " 密码 : ${Green_font_prefix}${ssr_password}${Font_color_suffix}" && echo ${Separator_1} && echo } @@ -429,7 +429,7 @@ Set_config_method(){ ${Green_font_prefix}15.${Font_color_suffix} chacha20 ${Green_font_prefix}16.${Font_color_suffix} chacha20-ietf ${Tip} salsa20/chacha20-*系列加密方式,需要额外安装依赖 libsodium ,否则会无法启动ShadowsocksR !" && echo - stty erase '^H' && read -p "(默认: 5. aes-128-ctr):" ssr_method + read -e -p "(默认: 5. aes-128-ctr):" ssr_method [[ -z "${ssr_method}" ]] && ssr_method="5" if [[ ${ssr_method} == "1" ]]; then ssr_method="none" @@ -478,7 +478,7 @@ Set_config_protocol(){ ${Green_font_prefix}5.${Font_color_suffix} auth_chain_a ${Green_font_prefix}6.${Font_color_suffix} auth_chain_b ${Tip} 如果使用 auth_chain_* 系列协议,建议加密方式选择 none (该系列协议自带 RC4 加密),混淆随意" && echo - stty erase '^H' && read -p "(默认: 3. auth_aes128_md5):" ssr_protocol + read -e -p "(默认: 3. auth_aes128_md5):" ssr_protocol [[ -z "${ssr_protocol}" ]] && ssr_protocol="3" if [[ ${ssr_protocol} == "1" ]]; then ssr_protocol="origin" @@ -498,7 +498,7 @@ Set_config_protocol(){ echo && echo ${Separator_1} && echo -e " 协议 : ${Green_font_prefix}${ssr_protocol}${Font_color_suffix}" && echo ${Separator_1} && echo if [[ ${ssr_protocol} != "origin" ]]; then if [[ ${ssr_protocol} == "auth_sha1_v4" ]]; then - stty erase '^H' && read -p "是否设置 协议插件兼容原版(_compatible)?[Y/n]" ssr_protocol_yn + read -e -p "是否设置 协议插件兼容原版(_compatible)?[Y/n]" ssr_protocol_yn [[ -z "${ssr_protocol_yn}" ]] && ssr_protocol_yn="y" [[ $ssr_protocol_yn == [Yy] ]] && ssr_protocol=${ssr_protocol}"_compatible" echo @@ -515,7 +515,7 @@ Set_config_obfs(){ ${Green_font_prefix}5.${Font_color_suffix} tls1.2_ticket_auth ${Tip} 如果使用 ShadowsocksR 代理游戏,建议选择 混淆兼容原版或 plain 混淆,然后客户端选择 plain,否则会增加延迟 ! 另外, 如果你选择了 tls1.2_ticket_auth,那么客户端可以选择 tls1.2_ticket_fastauth,这样即能伪装特征 又不会增加延迟 !" && echo - stty erase '^H' && read -p "(默认: 2. http_simple):" ssr_obfs + read -e -p "(默认: 2. http_simple):" ssr_obfs [[ -z "${ssr_obfs}" ]] && ssr_obfs="2" if [[ ${ssr_obfs} == "1" ]]; then ssr_obfs="plain" @@ -532,7 +532,7 @@ Set_config_obfs(){ fi echo && echo ${Separator_1} && echo -e " 混淆 : ${Green_font_prefix}${ssr_obfs}${Font_color_suffix}" && echo ${Separator_1} && echo if [[ ${ssr_obfs} != "plain" ]]; then - stty erase '^H' && read -p "是否设置 混淆插件兼容原版(_compatible)?[Y/n]" ssr_obfs_yn + read -e -p "是否设置 混淆插件兼容原版(_compatible)?[Y/n]" ssr_obfs_yn [[ -z "${ssr_obfs_yn}" ]] && ssr_obfs_yn="y" [[ $ssr_obfs_yn == [Yy] ]] && ssr_obfs=${ssr_obfs}"_compatible" echo @@ -543,7 +543,7 @@ Set_config_protocol_param(){ do echo -e "请输入要设置的用户 欲限制的设备数 (${Green_font_prefix} auth_* 系列协议 不兼容原版才有效 ${Font_color_suffix})" echo -e "${Tip} 设备数限制:每个端口同一时间能链接的客户端数量(多端口模式,每个端口都是独立计算),建议最少 2个。" - stty erase '^H' && read -p "(默认: 无限):" ssr_protocol_param + read -e -p "(默认: 无限):" ssr_protocol_param [[ -z "$ssr_protocol_param" ]] && ssr_protocol_param="" && echo && break echo $((${ssr_protocol_param}+0)) &>/dev/null if [[ $? == 0 ]]; then @@ -563,7 +563,7 @@ Set_config_speed_limit_per_con(){ do echo -e "请输入要设置的用户 单线程 限速上限(单位:KB/S)" echo -e "${Tip} 单线程限速:每个端口 单线程的限速上限,多线程即无效。" - stty erase '^H' && read -p "(默认: 无限):" ssr_speed_limit_per_con + read -e -p "(默认: 无限):" ssr_speed_limit_per_con [[ -z "$ssr_speed_limit_per_con" ]] && ssr_speed_limit_per_con=0 && echo && break echo $((${ssr_speed_limit_per_con}+0)) &>/dev/null if [[ $? == 0 ]]; then @@ -584,7 +584,7 @@ Set_config_speed_limit_per_user(){ echo echo -e "请输入要设置的用户 总速度 限速上限(单位:KB/S)" echo -e "${Tip} 端口总限速:每个端口 总速度 限速上限,单个端口整体限速。" - stty erase '^H' && read -p "(默认: 无限):" ssr_speed_limit_per_user + read -e -p "(默认: 无限):" ssr_speed_limit_per_user [[ -z "$ssr_speed_limit_per_user" ]] && ssr_speed_limit_per_user=0 && echo && break echo $((${ssr_speed_limit_per_user}+0)) &>/dev/null if [[ $? == 0 ]]; then @@ -604,7 +604,7 @@ Set_config_transfer(){ do echo echo -e "请输入要设置的用户 可使用的总流量上限(单位: GB, 1-838868 GB)" - stty erase '^H' && read -p "(默认: 无限):" ssr_transfer + read -e -p "(默认: 无限):" ssr_transfer [[ -z "$ssr_transfer" ]] && ssr_transfer="838868" && echo && break echo $((${ssr_transfer}+0)) &>/dev/null if [[ $? == 0 ]]; then @@ -626,7 +626,7 @@ Set_config_forbid(){ 封禁多个端口格式: 23,465 封禁 端口段格式: 233-266 封禁多种格式端口: 25,465,233-666 (不带冒号:)" - stty erase '^H' && read -p "(默认为空 不禁止访问任何端口):" ssr_forbid + read -e -p "(默认为空 不禁止访问任何端口):" ssr_forbid [[ -z "${ssr_forbid}" ]] && ssr_forbid="" echo && echo ${Separator_1} && echo -e " 禁止的端口 : ${Green_font_prefix}${ssr_forbid}${Font_color_suffix}" && echo ${Separator_1} && echo } @@ -651,7 +651,7 @@ Set_config_enable(){ done if [[ "${enable}" == "1" ]]; then echo -e "端口 [${ssr_port}] 的账号状态为:${Green_font_prefix}启用${Font_color_suffix} , 是否切换为 ${Red_font_prefix}禁用${Font_color_suffix} ?[Y/n]" - stty erase '^H' && read -p "(默认: Y):" ssr_enable_yn + read -e -p "(默认: Y):" ssr_enable_yn [[ -z "${ssr_enable_yn}" ]] && ssr_enable_yn="y" if [[ "${ssr_enable_yn}" == [Yy] ]]; then ssr_enable="0" @@ -660,7 +660,7 @@ Set_config_enable(){ fi elif [[ "${enable}" == "0" ]]; then echo -e "端口 [${ssr_port}] 的账号状态为:${Green_font_prefix}禁用${Font_color_suffix} , 是否切换为 ${Red_font_prefix}启用${Font_color_suffix} ?[Y/n]" - stty erase '^H' && read -p "(默认: Y):" ssr_enable_yn + read -e -p "(默认: Y):" ssr_enable_yn [[ -z "${ssr_enable_yn}" ]] && ssr_enable_yn = "y" if [[ "${ssr_enable_yn}" == [Yy] ]]; then ssr_enable="1" @@ -682,13 +682,13 @@ Set_user_api_server_pub_addr(){ fi fi echo "请输入用户配置中要显示的 服务器IP或域名 (当服务器有多个IP时,可以指定用户配置中显示的IP或者域名)" - stty erase '^H' && read -p "(默认自动检测外网IP):" ssr_server_pub_addr + read -e -p "(默认自动检测外网IP):" ssr_server_pub_addr if [[ -z "${ssr_server_pub_addr}" ]]; then Get_IP if [[ ${ip} == "VPS_IP" ]]; then while true do - stty erase '^H' && read -p "${Error} 自动检测外网IP失败,请手动输入服务器IP或域名" ssr_server_pub_addr + read -e -p "${Error} 自动检测外网IP失败,请手动输入服务器IP或域名" ssr_server_pub_addr if [[ -z "$ssr_server_pub_addr" ]]; then echo -e "${Error} 不能为空!" else @@ -964,7 +964,7 @@ Update_SSR(){ Uninstall_SSR(){ [[ ! -e ${ssr_folder} ]] && echo -e "${Error} 没有安装 ShadowsocksR,请检查 !" && exit 1 echo "确定要 卸载ShadowsocksR?[y/N]" && echo - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then check_pid @@ -1002,7 +1002,7 @@ Check_Libsodium_ver(){ Install_Libsodium(){ if [[ -e ${Libsodiumr_file} ]]; then echo -e "${Error} libsodium 已安装 , 是否覆盖安装(更新)?[y/N]" - stty erase '^H' && read -p "(默认: n):" yn + read -e -p "(默认: n):" yn [[ -z ${yn} ]] && yn="n" if [[ ${yn} == [Nn] ]]; then echo "已取消..." && exit 1 @@ -1100,7 +1100,7 @@ View_user_connection_info(){ echo && echo -e "请选择要显示的格式: ${Green_font_prefix}1.${Font_color_suffix} 显示 IP 格式 ${Green_font_prefix}2.${Font_color_suffix} 显示 IP+IP归属地 格式" && echo - stty erase '^H' && read -p "(默认: 1):" ssr_connection_info + read -e -p "(默认: 1):" ssr_connection_info [[ -z "${ssr_connection_info}" ]] && ssr_connection_info="1" if [[ ${ssr_connection_info} == "1" ]]; then View_user_connection_info_1 "" @@ -1146,7 +1146,7 @@ Modify_port(){ while true do echo -e "请输入要修改的用户 端口" - stty erase '^H' && read -p "(默认: 取消):" ssr_port + read -e -p "(默认: 取消):" ssr_port [[ -z "${ssr_port}" ]] && echo -e "已取消..." && exit 1 Modify_user=$(cat "${config_user_mudb_file}"|grep '"port": '"${ssr_port}"',') if [[ ! -z ${Modify_user} ]]; then @@ -1176,7 +1176,7 @@ Modify_Config(){ ${Green_font_prefix}13.${Font_color_suffix} 修改 用户配置中显示的IP或域名 ${Tip} 用户的用户名和端口是无法修改,如果需要修改请使用脚本的 手动修改功能 !" && echo - stty erase '^H' && read -p "(默认: 取消):" ssr_modify + read -e -p "(默认: 取消):" ssr_modify [[ -z "${ssr_modify}" ]] && echo "已取消..." && exit 1 if [[ ${ssr_modify} == "1" ]]; then Add_port_user @@ -1268,7 +1268,7 @@ Add_port_user(){ Save_iptables echo -e "${Info} 用户添加成功 ${Green_font_prefix}[用户名: ${ssr_user} , 端口: ${ssr_port}]${Font_color_suffix} " echo - stty erase '^H' && read -p "是否继续 添加用户配置?[Y/n]:" addyn + read -e -p "是否继续 添加用户配置?[Y/n]:" addyn [[ -z ${addyn} ]] && addyn="y" if [[ ${addyn} == [Nn] ]]; then Get_User_info "${ssr_port}" @@ -1286,7 +1286,7 @@ Del_port_user(){ while true do echo -e "请输入要删除的用户 端口" - stty erase '^H' && read -p "(默认: 取消):" del_user_port + read -e -p "(默认: 取消):" del_user_port [[ -z "${del_user_port}" ]] && echo -e "已取消..." && exit 1 del_user=$(cat "${config_user_mudb_file}"|grep '"port": '"${del_user_port}"',') if [[ ! -z ${del_user} ]]; then @@ -1309,7 +1309,7 @@ Manually_Modify_Config(){ SSR_installation_status vi ${config_user_mudb_file} echo "是否现在重启ShadowsocksR?[Y/n]" && echo - stty erase '^H' && read -p "(默认: y):" yn + read -e -p "(默认: y):" yn [[ -z ${yn} ]] && yn="y" if [[ ${yn} == [Yy] ]]; then Restart_SSR @@ -1323,13 +1323,13 @@ Clear_transfer(){ ${Green_font_prefix}3.${Font_color_suffix} 启动 定时所有用户流量清零 ${Green_font_prefix}4.${Font_color_suffix} 停止 定时所有用户流量清零 ${Green_font_prefix}5.${Font_color_suffix} 修改 定时所有用户流量清零" && echo - stty erase '^H' && read -p "(默认: 取消):" ssr_modify + read -e -p "(默认: 取消):" ssr_modify [[ -z "${ssr_modify}" ]] && echo "已取消..." && exit 1 if [[ ${ssr_modify} == "1" ]]; then Clear_transfer_one elif [[ ${ssr_modify} == "2" ]]; then echo "确定要 清零 所有用户已使用流量?[y/N]" && echo - stty erase '^H' && read -p "(默认: n):" yn + read -e -p "(默认: n):" yn [[ -z ${yn} ]] && yn="n" if [[ ${yn} == [Yy] ]]; then Clear_transfer_all @@ -1355,7 +1355,7 @@ Clear_transfer_one(){ while true do echo -e "请输入要清零已使用流量的用户 端口" - stty erase '^H' && read -p "(默认: 取消):" Clear_transfer_user_port + read -e -p "(默认: 取消):" Clear_transfer_user_port [[ -z "${Clear_transfer_user_port}" ]] && echo -e "已取消..." && exit 1 Clear_transfer_user=$(cat "${config_user_mudb_file}"|grep '"port": '"${Clear_transfer_user_port}"',') if [[ ! -z ${Clear_transfer_user} ]]; then @@ -1427,7 +1427,7 @@ Set_crontab(){ ${Green_font_prefix} 0 2 */7 * * ${Font_color_suffix} 代表 每7天2点0分 清零已使用流量 ${Green_font_prefix} 0 2 * * 0 ${Font_color_suffix} 代表 每个星期日(7) 清零已使用流量 ${Green_font_prefix} 0 2 * * 3 ${Font_color_suffix} 代表 每个星期三(3) 清零已使用流量" && echo - stty erase '^H' && read -p "(默认: 0 2 1 * * 每月1日2点0分):" Crontab_time + read -e -p "(默认: 0 2 1 * * 每月1日2点0分):" Crontab_time [[ -z "${Crontab_time}" ]] && Crontab_time="0 2 1 * *" } Start_SSR(){ @@ -1466,7 +1466,7 @@ Configure_Server_Speeder(){ ${Green_font_prefix}6.${Font_color_suffix} 查看 锐速 状态 注意: 锐速和LotServer不能同时安装/启动!" && echo - stty erase '^H' && read -p "(默认: 取消):" server_speeder_num + read -e -p "(默认: 取消):" server_speeder_num [[ -z "${server_speeder_num}" ]] && echo "已取消..." && exit 1 if [[ ${server_speeder_num} == "1" ]]; then Install_ServerSpeeder @@ -1510,7 +1510,7 @@ Install_ServerSpeeder(){ } Uninstall_ServerSpeeder(){ echo "确定要卸载 锐速(Server Speeder)?[y/N]" && echo - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && echo && echo "已取消..." && exit 1 if [[ ${unyn} == [Yy] ]]; then chattr -i /serverspeeder/etc/apx* @@ -1530,7 +1530,7 @@ Configure_LotServer(){ ${Green_font_prefix}6.${Font_color_suffix} 查看 LotServer 状态 注意: 锐速和LotServer不能同时安装/启动!" && echo - stty erase '^H' && read -p "(默认: 取消):" lotserver_num + read -e -p "(默认: 取消):" lotserver_num [[ -z "${lotserver_num}" ]] && echo "已取消..." && exit 1 if [[ ${lotserver_num} == "1" ]]; then Install_LotServer @@ -1571,7 +1571,7 @@ Install_LotServer(){ } Uninstall_LotServer(){ echo "确定要卸载 LotServer?[y/N]" && echo - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && echo && echo "已取消..." && exit 1 if [[ ${unyn} == [Yy] ]]; then wget --no-check-certificate -qO /tmp/appex.sh "https://raw.githubusercontent.com/0oVicero0/serverSpeeder_Install/master/appex.sh" && bash /tmp/appex.sh 'uninstall' @@ -1591,7 +1591,7 @@ echo -e "${Green_font_prefix} [安装前 请注意] ${Font_color_suffix} 1. 安装开启BBR,需要更换内核,存在更换失败等风险(重启后无法开机) 2. 本脚本仅支持 Debian / Ubuntu 系统更换内核,OpenVZ和Docker 不支持更换内核 3. Debian 更换内核过程中会提示 [ 是否终止卸载内核 ] ,请选择 ${Green_font_prefix} NO ${Font_color_suffix}" && echo - stty erase '^H' && read -p "(默认: 取消):" bbr_num + read -e -p "(默认: 取消):" bbr_num [[ -z "${bbr_num}" ]] && echo "已取消..." && exit 1 if [[ ${bbr_num} == "1" ]]; then Install_BBR @@ -1639,7 +1639,7 @@ Other_functions(){ —— 说明:SSR默认只输出错误日志,此项可切换为输出详细的访问日志。 ${Green_font_prefix}7.${Font_color_suffix} 监控 ShadowsocksR服务端运行状态 —— 说明:该功能适合于SSR服务端经常进程结束,启动该功能后会每分钟检测一次,当进程不存在则自动启动SSR服务端。" && echo - stty erase '^H' && read -p "(默认: 取消):" other_num + read -e -p "(默认: 取消):" other_num [[ -z "${other_num}" ]] && echo "已取消..." && exit 1 if [[ ${other_num} == "1" ]]; then Configure_BBR @@ -1676,7 +1676,7 @@ Set_config_connect_verbose_info(){ if [[ ${connect_verbose_info} = "0" ]]; then echo && echo -e "当前日志模式: ${Green_font_prefix}简单模式(只输出错误日志)${Font_color_suffix}" && echo echo -e "确定要切换为 ${Green_font_prefix}详细模式(输出详细连接日志+错误日志)${Font_color_suffix}?[y/N]" - stty erase '^H' && read -p "(默认: n):" connect_verbose_info_ny + read -e -p "(默认: n):" connect_verbose_info_ny [[ -z "${connect_verbose_info_ny}" ]] && connect_verbose_info_ny="n" if [[ ${connect_verbose_info_ny} == [Yy] ]]; then ssr_connect_verbose_info="1" @@ -1688,7 +1688,7 @@ Set_config_connect_verbose_info(){ else echo && echo -e "当前日志模式: ${Green_font_prefix}详细模式(输出详细连接日志+错误日志)${Font_color_suffix}" && echo echo -e "确定要切换为 ${Green_font_prefix}简单模式(只输出错误日志)${Font_color_suffix}?[y/N]" - stty erase '^H' && read -p "(默认: n):" connect_verbose_info_ny + read -e -p "(默认: n):" connect_verbose_info_ny [[ -z "${connect_verbose_info_ny}" ]] && connect_verbose_info_ny="n" if [[ ${connect_verbose_info_ny} == [Yy] ]]; then ssr_connect_verbose_info="0" @@ -1705,7 +1705,7 @@ Set_crontab_monitor_ssr(){ if [[ -z "${crontab_monitor_ssr_status}" ]]; then echo && echo -e "当前监控模式: ${Green_font_prefix}未开启${Font_color_suffix}" && echo echo -e "确定要开启为 ${Green_font_prefix}ShadowsocksR服务端运行状态监控${Font_color_suffix} 功能吗?(当进程关闭则自动启动SSR服务端)[Y/n]" - stty erase '^H' && read -p "(默认: y):" crontab_monitor_ssr_status_ny + read -e -p "(默认: y):" crontab_monitor_ssr_status_ny [[ -z "${crontab_monitor_ssr_status_ny}" ]] && crontab_monitor_ssr_status_ny="y" if [[ ${crontab_monitor_ssr_status_ny} == [Yy] ]]; then crontab_monitor_ssr_cron_start @@ -1715,7 +1715,7 @@ Set_crontab_monitor_ssr(){ else echo && echo -e "当前监控模式: ${Green_font_prefix}已开启${Font_color_suffix}" && echo echo -e "确定要关闭为 ${Green_font_prefix}ShadowsocksR服务端运行状态监控${Font_color_suffix} 功能吗?(当进程关闭则自动启动SSR服务端)[y/N]" - stty erase '^H' && read -p "(默认: n):" crontab_monitor_ssr_status_ny + read -e -p "(默认: n):" crontab_monitor_ssr_status_ny [[ -z "${crontab_monitor_ssr_status_ny}" ]] && crontab_monitor_ssr_status_ny="n" if [[ ${crontab_monitor_ssr_status_ny} == [Yy] ]]; then crontab_monitor_ssr_cron_stop @@ -1822,7 +1822,7 @@ else ${Green_font_prefix}15.${Font_color_suffix} 升级脚本 " menu_status - echo && stty erase '^H' && read -p "请输入数字 [1-15]:" num + echo && read -e -p "请输入数字 [1-15]:" num case "$num" in 1) Install_SSR diff --git a/ssrstatus.sh b/ssrstatus.sh index 4700666..22ec4b7 100644 --- a/ssrstatus.sh +++ b/ssrstatus.sh @@ -47,7 +47,7 @@ check_installed_server_status(){ } set_config_ip(){ echo "请输入 ShadowsocksR 账号服务器公网IP" - stty erase '^H' && read -p "(默认取消):" ip + read -e -p "(默认取消):" ip [[ -z "${ip}" ]] && echo "已取消..." && exit 1 echo && echo -e " I P : ${Red_font_prefix}${ip}${Font_color_suffix}" && echo } @@ -55,7 +55,7 @@ set_config_port(){ while true do echo -e "请输入 ShadowsocksR 账号端口" - stty erase '^H' && read -p "(默认: 2333):" port + read -e -p "(默认: 2333):" port [[ -z "$port" ]] && port="2333" echo $((${port}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -72,7 +72,7 @@ set_config_port(){ } set_config_password(){ echo "请输入 ShadowsocksR 账号密码" - stty erase '^H' && read -p "(默认: doub.io):" passwd + read -e -p "(默认: doub.io):" passwd [[ -z "${passwd}" ]] && passwd="doub.io" echo && echo -e " 密码 : ${Red_font_prefix}${passwd}${Font_color_suffix}" && echo } @@ -100,7 +100,7 @@ set_config_method(){ ${Green_font_prefix}15.${Font_color_suffix} chacha20 ${Green_font_prefix}16.${Font_color_suffix} chacha20-ietf ${Tip} salsa20/chacha20-*系列加密方式,需要额外安装依赖 libsodium ,否则会无法启动ShadowsocksR !" && echo - stty erase '^H' && read -p "(默认: 5. aes-128-ctr):" method + read -e -p "(默认: 5. aes-128-ctr):" method [[ -z "${method}" ]] && method="5" if [[ ${method} == "1" ]]; then method="none" @@ -146,7 +146,7 @@ set_config_protocol(){ ${Green_font_prefix}3.${Font_color_suffix} auth_aes128_md5 ${Green_font_prefix}4.${Font_color_suffix} auth_aes128_sha1 ${Green_font_prefix}5.${Font_color_suffix} auth_chain_a" && echo - stty erase '^H' && read -p "(默认: 2. auth_sha1_v4):" protocol + read -e -p "(默认: 2. auth_sha1_v4):" protocol [[ -z "${protocol}" ]] && protocol="2" if [[ ${protocol} == "1" ]]; then protocol="origin" @@ -170,7 +170,7 @@ set_config_obfs(){ ${Green_font_prefix}3.${Font_color_suffix} http_post ${Green_font_prefix}4.${Font_color_suffix} random_head ${Green_font_prefix}5.${Font_color_suffix} tls1.2_ticket_auth" && echo - stty erase '^H' && read -p "(默认: 5. tls1.2_ticket_auth):" obfs + read -e -p "(默认: 5. tls1.2_ticket_auth):" obfs [[ -z "${obfs}" ]] && obfs="5" if [[ ${obfs} == "1" ]]; then obfs="plain" @@ -189,7 +189,7 @@ set_config_obfs(){ } set_config_like(){ echo "请输入 ShadowsocksR 的链接(SS/SSR链接皆可,如 ss://xxxx ssr://xxxx)" - stty erase '^H' && read -p "(默认回车取消):" Like + read -e -p "(默认回车取消):" Like [[ -z "${Like}" ]] && echo "已取消..." && exit 1 echo && echo -e " 链接 : ${Red_font_prefix}${Like}${Font_color_suffix}" && echo } @@ -197,7 +197,7 @@ set_config_user(){ echo -e "请输入选择输入方式 ${Green_font_prefix}1.${Font_color_suffix} 输入ShadowsocksR账号全部信息(Shadowsocks原版也可以) ${Green_font_prefix}2.${Font_color_suffix} 输入ShadowsocksR账号的 SSR链接(Shadowsocks原版也可以)" - stty erase '^H' && read -p "(默认:2):" enter_type + read -e -p "(默认:2):" enter_type [[ -z "${enter_type}" ]] && enter_type="2" if [[ ${enter_type} == "1" ]]; then echo -e "下面依次开始输入要检测可用性的 ShadowsocksR账号信息。" && echo @@ -218,20 +218,20 @@ set_config_user(){ } set_config_name(){ echo "请输入 ShadowsocksR 账号的名称(用于区分,取个名字,可重复)" - stty erase '^H' && read -p "(默认取消):" Config_Name + read -e -p "(默认取消):" Config_Name [[ -z "${Config_Name}" ]] && echo "已取消..." && exit 1 echo && echo -e " 名称 : ${Red_font_prefix}${Config_Name}${Font_color_suffix}" && echo } set_config_location(){ echo "请输入 ShadowsocksR 账号的位置(用于区分,可重复)" - stty erase '^H' && read -p "(默认取消):" Config_Location + read -e -p "(默认取消):" Config_Location [[ -z "${Config_Location}" ]] && echo "已取消..." && exit 1 echo && echo -e " 位置 : ${Red_font_prefix}${Config_Location}${Font_color_suffix}" && echo } Set_server(){ echo -e "请输入 SSRStatus 网站要设置的 域名[server] 默认为本机IP为域名,例如输入: toyoo.ml,如果要使用本机IP,请留空直接回车" - stty erase '^H' && read -p "(默认: 本机IP):" server_s + read -e -p "(默认: 本机IP):" server_s [[ -z "$server_s" ]] && server_s="" echo && echo -e " IP/域名[server]: ${Red_background_prefix} ${server_s} ${Font_color_suffix}" && echo @@ -240,7 +240,7 @@ Set_server_port(){ while true do echo -e "请输入 SSRStatus 网站要设置的 域名/IP的端口[1-65535](如果是域名的话,一般建议用 http 80 端口)" - stty erase '^H' && read -p "(默认: 8888):" server_port_s + read -e -p "(默认: 8888):" server_port_s [[ -z "$server_port_s" ]] && server_port_s="8888" echo $((${server_port_s}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -266,7 +266,7 @@ Set_crontab(){ ${Green_font_prefix}7.${Font_color_suffix} 1小时 ${Green_font_prefix}8.${Font_color_suffix} 2小时 ${Green_font_prefix}9.${Font_color_suffix} 自定义输入" && echo - stty erase '^H' && read -p "(默认: 2. 10分钟):" Crontab_time + read -e -p "(默认: 2. 10分钟):" Crontab_time [[ -z "${Crontab_time}" ]] && Crontab_time="2" if [[ ${Crontab_time} == "1" ]]; then Crontab_time="*/5 * * * *" @@ -301,7 +301,7 @@ Set_crontab_customize(){ ${Green_font_prefix} 10 * * * * ${Font_color_suffix} 代表每小时的第10分 检测一次 ${Green_font_prefix} * 2 * * * ${Font_color_suffix} 代表每天的第2点 检测一次 ${Green_font_prefix} 0 0 2 * * ${Font_color_suffix} 代表每2天的0点0分 检测一次" && echo - stty erase '^H' && read -p "(默认: */10 * * * *):" Crontab_time + read -e -p "(默认: */10 * * * *):" Crontab_time [[ -z "${Crontab_time}" ]] && Crontab_time="*/10 * * * *" } GO(){ @@ -516,7 +516,7 @@ Test_one(){ while true do echo -e "请选择你要单独测试的账号序号" - stty erase '^H' && read -p "(默认取消):" Test_one_num + read -e -p "(默认取消):" Test_one_num [[ -z "${Test_one_num}" ]] && echo "已取消..." && exit 1 echo $((${Test_one_num}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -548,7 +548,7 @@ Set_SSRStatus(){ ———————— ${Green_font_prefix} 4.${Font_color_suffix} 启用/禁用 账号配置 注意:添加/修改/删除 账号配置后,不会立即更新,需要自动(定时)/手动检测一次所有账号,网页才会更新 !" && echo - stty erase '^H' && read -p "(默认: 取消):" server_num + read -e -p "(默认: 取消):" server_num [[ -z "${server_num}" ]] && echo "已取消..." && exit 1 if [[ ${server_num} == "1" ]]; then Add_SSRStatus @@ -594,7 +594,7 @@ Del_SSRStatus(){ while true do echo -e "请选择你要删除的账号序号" - stty erase '^H' && read -p "(默认取消):" Del_num + read -e -p "(默认取消):" Del_num [[ -z "${Del_num}" ]] && echo "已取消..." && exit 1 echo $((${Del_num}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -619,7 +619,7 @@ Modify_SSRStatus(){ while true do echo -e "请选择你要修改的账号序号" - stty erase '^H' && read -p "(默认取消):" Modify_num + read -e -p "(默认取消):" Modify_num [[ -z "${Modify_num}" ]] && echo "已取消..." && exit 1 echo $((${Modify_num}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -659,7 +659,7 @@ Modify_SSRStatus_disabled(){ while true do echo -e "请选择你要启用/禁用的账号序号" - stty erase '^H' && read -p "(默认取消):" Modify_num + read -e -p "(默认取消):" Modify_num [[ -z "${Modify_num}" ]] && echo "已取消..." && exit 1 echo $((${Modify_num}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -709,7 +709,7 @@ Installation_dependency(){ } Install_caddy(){ echo -e "是否由脚本自动配置HTTP服务(在线监控网站)[Y/n]" - stty erase '^H' && read -p "(默认: Y 自动部署):" caddy_yn + read -e -p "(默认: Y 自动部署):" caddy_yn [[ -z "$caddy_yn" ]] && caddy_yn="y" if [[ "${caddy_yn}" == [Yy] ]]; then Set_server @@ -772,7 +772,7 @@ Uninstall_Web(){ check_installed_server_status echo "确定要卸载 SSRStatus 网页文件(自动部署的Caddy并不会删除) ? [y/N]" echo - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then /etc/init.d/caddy stop @@ -838,7 +838,7 @@ else echo -e " 当前状态: Web网页 ${Red_font_prefix}未安装${Font_color_suffix}" fi echo -stty erase '^H' && read -p " 请输入数字 [0-9]:" num +read -e -p " 请输入数字 [0-9]:" num case "$num" in 0) Update_Shell diff --git a/status.sh b/status.sh index 8088047..4731cf6 100644 --- a/status.sh +++ b/status.sh @@ -249,11 +249,11 @@ Set_server(){ if [[ ${mode} == "server" ]]; then echo -e "请输入 ServerStatus 服务端中网站要设置的 域名[server] 默认为本机IP为域名,例如输入: toyoo.pw ,如果要使用本机IP,请留空直接回车" - stty erase '^H' && read -p "(默认: 本机IP):" server_s + read -e -p "(默认: 本机IP):" server_s [[ -z "$server_s" ]] && server_s="" else echo -e "请输入 ServerStatus 服务端的 IP/域名[server]" - stty erase '^H' && read -p "(默认: 127.0.0.1):" server_s + read -e -p "(默认: 127.0.0.1):" server_s [[ -z "$server_s" ]] && server_s="127.0.0.1" fi @@ -265,7 +265,7 @@ Set_server_http_port(){ while true do echo -e "请输入 ServerStatus 服务端中网站要设置的 域名/IP的端口[1-65535](如果是域名的话,一般用 80 端口)" - stty erase '^H' && read -p "(默认: 8888):" server_http_port_s + read -e -p "(默认: 8888):" server_http_port_s [[ -z "$server_http_port_s" ]] && server_http_port_s="8888" echo $((${server_http_port_s}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -286,7 +286,7 @@ Set_server_port(){ while true do echo -e "请输入 ServerStatus 服务端监听的端口[1-65535](用于服务端接收客户端消息的端口,客户端要填写这个端口)" - stty erase '^H' && read -p "(默认: 35601):" server_port_s + read -e -p "(默认: 35601):" server_port_s [[ -z "$server_port_s" ]] && server_port_s="35601" echo $((${server_port_s}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -311,7 +311,7 @@ Set_username(){ else echo -e "请输入 ServerStatus 服务端中对应配置的用户名[username](字母/数字,不可与其他账号重复)" fi - stty erase '^H' && read -p "(默认: 取消):" username_s + read -e -p "(默认: 取消):" username_s [[ -z "$username_s" ]] && echo "已取消..." && exit 0 echo && echo " ================================================" echo -e " 账号[username]: ${Red_background_prefix} ${username_s} ${Font_color_suffix}" @@ -325,7 +325,7 @@ Set_password(){ else echo -e "请输入 ServerStatus 服务端中对应配置的密码[password](字母/数字)" fi - stty erase '^H' && read -p "(默认: doub.io):" password_s + read -e -p "(默认: doub.io):" password_s [[ -z "$password_s" ]] && password_s="doub.io" echo && echo " ================================================" echo -e " 密码[password]: ${Red_background_prefix} ${password_s} ${Font_color_suffix}" @@ -333,7 +333,7 @@ Set_password(){ } Set_name(){ echo -e "请输入 ServerStatus 服务端要设置的节点名称[name](支持中文,前提是你的系统和SSH工具支持中文输入,仅仅是个名字)" - stty erase '^H' && read -p "(默认: Server 01):" name_s + read -e -p "(默认: Server 01):" name_s [[ -z "$name_s" ]] && name_s="Server 01" echo && echo " ================================================" echo -e " 节点名称[name]: ${Red_background_prefix} ${name_s} ${Font_color_suffix}" @@ -341,7 +341,7 @@ Set_name(){ } Set_type(){ echo -e "请输入 ServerStatus 服务端要设置的节点虚拟化类型[type](例如 OpenVZ / KVM)" - stty erase '^H' && read -p "(默认: KVM):" type_s + read -e -p "(默认: KVM):" type_s [[ -z "$type_s" ]] && type_s="KVM" echo && echo " ================================================" echo -e " 虚拟化类型[type]: ${Red_background_prefix} ${type_s} ${Font_color_suffix}" @@ -349,7 +349,7 @@ Set_type(){ } Set_location(){ echo -e "请输入 ServerStatus 服务端要设置的节点位置[location](支持中文,前提是你的系统和SSH工具支持中文输入)" - stty erase '^H' && read -p "(默认: Hong Kong):" location_s + read -e -p "(默认: Hong Kong):" location_s [[ -z "$location_s" ]] && location_s="Hong Kong" echo && echo " ================================================" echo -e " 节点位置[location]: ${Red_background_prefix} ${location_s} ${Font_color_suffix}" @@ -385,7 +385,7 @@ Set_ServerStatus_server(){ ${Green_font_prefix} 9.${Font_color_suffix} 启用/禁用 节点配置 ———————— ${Green_font_prefix}10.${Font_color_suffix} 修改 服务端监听端口" && echo - stty erase '^H' && read -p "(默认: 取消):" server_num + read -e -p "(默认: 取消):" server_num [[ -z "${server_num}" ]] && echo "已取消..." && exit 1 if [[ ${server_num} == "1" ]]; then Add_ServerStatus_server @@ -460,7 +460,7 @@ Del_ServerStatus_server(){ List_ServerStatus_server [[ "${conf_text_total}" = "1" ]] && echo -e "${Error} 节点配置仅剩 1个,不能删除 !" && exit 1 echo -e "请输入要删除的节点用户名" - stty erase '^H' && read -p "(默认: 取消):" del_server_username + read -e -p "(默认: 取消):" del_server_username [[ -z "${del_server_username}" ]] && echo -e "已取消..." && exit 1 del_username=`cat -n ${server_conf}|grep '"username": "'"${del_server_username}"'"'|awk '{print $1}'` if [[ ! -z ${del_username} ]]; then @@ -481,7 +481,7 @@ Del_ServerStatus_server(){ Modify_ServerStatus_server_username(){ List_ServerStatus_server echo -e "请输入要修改的节点用户名" - stty erase '^H' && read -p "(默认: 取消):" manually_username + read -e -p "(默认: 取消):" manually_username [[ -z "${manually_username}" ]] && echo -e "已取消..." && exit 1 Set_username_num=$(cat -n ${server_conf}|grep '"username": "'"${manually_username}"'"'|awk '{print $1}') if [[ ! -z ${Set_username_num} ]]; then @@ -497,7 +497,7 @@ Modify_ServerStatus_server_username(){ Modify_ServerStatus_server_password(){ List_ServerStatus_server echo -e "请输入要修改的节点用户名" - stty erase '^H' && read -p "(默认: 取消):" manually_username + read -e -p "(默认: 取消):" manually_username [[ -z "${manually_username}" ]] && echo -e "已取消..." && exit 1 Set_username_num=$(cat -n ${server_conf}|grep '"username": "'"${manually_username}"'"'|awk '{print $1}') if [[ ! -z ${Set_username_num} ]]; then @@ -513,7 +513,7 @@ Modify_ServerStatus_server_password(){ Modify_ServerStatus_server_name(){ List_ServerStatus_server echo -e "请输入要修改的节点用户名" - stty erase '^H' && read -p "(默认: 取消):" manually_username + read -e -p "(默认: 取消):" manually_username [[ -z "${manually_username}" ]] && echo -e "已取消..." && exit 1 Set_username_num=$(cat -n ${server_conf}|grep '"username": "'"${manually_username}"'"'|awk '{print $1}') if [[ ! -z ${Set_username_num} ]]; then @@ -529,7 +529,7 @@ Modify_ServerStatus_server_name(){ Modify_ServerStatus_server_type(){ List_ServerStatus_server echo -e "请输入要修改的节点用户名" - stty erase '^H' && read -p "(默认: 取消):" manually_username + read -e -p "(默认: 取消):" manually_username [[ -z "${manually_username}" ]] && echo -e "已取消..." && exit 1 Set_username_num=$(cat -n ${server_conf}|grep '"username": "'"${manually_username}"'"'|awk '{print $1}') if [[ ! -z ${Set_username_num} ]]; then @@ -545,7 +545,7 @@ Modify_ServerStatus_server_type(){ Modify_ServerStatus_server_location(){ List_ServerStatus_server echo -e "请输入要修改的节点用户名" - stty erase '^H' && read -p "(默认: 取消):" manually_username + read -e -p "(默认: 取消):" manually_username [[ -z "${manually_username}" ]] && echo -e "已取消..." && exit 1 Set_username_num=$(cat -n ${server_conf}|grep '"username": "'"${manually_username}"'"'|awk '{print $1}') if [[ ! -z ${Set_username_num} ]]; then @@ -561,7 +561,7 @@ Modify_ServerStatus_server_location(){ Modify_ServerStatus_server_all(){ List_ServerStatus_server echo -e "请输入要修改的节点用户名" - stty erase '^H' && read -p "(默认: 取消):" manually_username + read -e -p "(默认: 取消):" manually_username [[ -z "${manually_username}" ]] && echo -e "已取消..." && exit 1 Set_username_num=$(cat -n ${server_conf}|grep '"username": "'"${manually_username}"'"'|awk '{print $1}') if [[ ! -z ${Set_username_num} ]]; then @@ -591,7 +591,7 @@ Modify_ServerStatus_server_all(){ Modify_ServerStatus_server_disabled(){ List_ServerStatus_server echo -e "请输入要修改的节点用户名" - stty erase '^H' && read -p "(默认: 取消):" manually_username + read -e -p "(默认: 取消):" manually_username [[ -z "${manually_username}" ]] && echo -e "已取消..." && exit 1 Set_username_num=$(cat -n ${server_conf}|grep '"username": "'"${manually_username}"'"'|awk '{print $1}') if [[ ! -z ${Set_username_num} ]]; then @@ -640,7 +640,7 @@ Install_jq(){ Install_caddy(){ echo echo -e "${Info} 是否由脚本自动配置HTTP服务(服务端的在线监控网站),如果选择 N,则请在其他HTTP服务中配置网站根目录为:${Green_font_prefix}${web_file}${Font_color_suffix} [Y/n]" - stty erase '^H' && read -p "(默认: Y 自动部署):" caddy_yn + read -e -p "(默认: Y 自动部署):" caddy_yn [[ -z "$caddy_yn" ]] && caddy_yn="y" if [[ "${caddy_yn}" == [Yy] ]]; then Set_server "server" @@ -709,7 +709,7 @@ Install_ServerStatus_client(){ cat /etc/redhat-release |grep 7\..*|grep -i centos>/dev/null if [[ $? != 0 ]]; then echo -e "${Info} 检测到你的系统为 CentOS6,该系统自带的 Python2.6 版本过低,会导致无法运行客户端,如果你有能力升级为 Python2.7,那么请继续(否则建议更换系统):[y/N]" - stty erase '^H' && read -p "(默认: N 继续安装):" sys_centos6 + read -e -p "(默认: N 继续安装):" sys_centos6 [[ -z "$sys_centos6" ]] && sys_centos6="n" if [[ "${sys_centos6}" == [Nn] ]]; then echo -e "\n${Info} 已取消...\n" @@ -793,7 +793,7 @@ Uninstall_ServerStatus_server(){ check_installed_server_status echo "确定要卸载 ServerStatus 服务端(如果同时安装了客户端,则只会删除服务端) ? [y/N]" echo - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then check_pid_server @@ -846,7 +846,7 @@ Uninstall_ServerStatus_client(){ check_installed_client_status echo "确定要卸载 ServerStatus 客户端(如果同时安装了服务端,则只会删除客户端) ? [y/N]" echo - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then check_pid_client @@ -982,7 +982,7 @@ else fi fi echo -stty erase '^H' && read -p " 请输入数字 [0-10]:" num +read -e -p " 请输入数字 [0-10]:" num case "$num" in 0) Update_Shell @@ -1052,7 +1052,7 @@ else echo -e " 当前状态: 服务端 ${Red_font_prefix}未安装${Font_color_suffix}" fi echo -stty erase '^H' && read -p " 请输入数字 [0-10]:" num +read -e -p " 请输入数字 [0-10]:" num case "$num" in 0) Update_Shell diff --git a/tinymapper.sh b/tinymapper.sh index d5509a8..d75e78f 100644 --- a/tinymapper.sh +++ b/tinymapper.sh @@ -89,7 +89,7 @@ check_new_ver(){ tinymapper_new_ver=$(wget --no-check-certificate -qO- https://api.github.com/repos/wangyu-/tinyPortMapper/releases | grep -o '"tag_name": ".*"' |grep -v '20180620.0'|head -n 1| sed 's/"//g;s/v//g' | sed 's/tag_name: //g') if [[ -z ${tinymapper_new_ver} ]]; then echo -e "${Error} tinyPortMapper 最新版本获取失败,请手动获取最新版本号[ https://github.com/wangyu-/tinyPortMapper/releases ]" - stty erase '^H' && read -p "请输入版本号 [ 格式是日期 , 如 20180224.0 ] :" tinymapper_new_ver + read -e -p "请输入版本号 [ 格式是日期 , 如 20180224.0 ] :" tinymapper_new_ver [[ -z "${tinymapper_new_ver}" ]] && echo "取消..." && exit 1 else echo -e "${Info} 检测到 tinyPortMapper 最新版本为 [ ${tinymapper_new_ver} ]" @@ -124,7 +124,7 @@ Install_tinyPortMapper(){ Uninstall_tinyPortMapper(){ check_tinyPortMapper echo "确定要 卸载 tinyPortMapper?[y/N]" && echo - stty erase '^H' && read -p "(默认: n):" unyn + read -e -p "(默认: n):" unyn [[ -z ${unyn} ]] && unyn="n" if [[ ${unyn} == [Yy] ]]; then Uninstall_forwarding "Uninstall" @@ -184,7 +184,7 @@ Add_forwarding(){ 远程转发端口\t : ${Red_background_prefix} ${Mapper_Port} ${Font_color_suffix} 转发类型\t : ${Red_background_prefix} ${Mapper_Type_1} ${Font_color_suffix} ——————————————————————————————\n" - stty erase '^H' && read -p "请按任意键继续,如有配置错误请使用 Ctrl+C 退出。" var + read -e -p "请按任意键继续,如有配置错误请使用 Ctrl+C 退出。" var Start_tinyPortMapper Get_IP clear @@ -201,7 +201,7 @@ Set_local_Port(){ while true do echo -e "请输入 tinyPortMapper 的 本地监听端口 [1-65535]" - stty erase '^H' && read -p "(默认回车取消):" local_Port + read -e -p "(默认回车取消):" local_Port [[ -z "${local_Port}" ]] && echo "已取消..." && exit 1 echo $((${local_Port}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -224,7 +224,7 @@ Set_Mapper_Port(){ while true do echo -e "请输入 tinyPortMapper 远程被转发 端口 [1-65535](就是被中转服务器的端口)" - stty erase '^H' && read -p "(默认同本地监听端口: ${local_Port}):" Mapper_Port + read -e -p "(默认同本地监听端口: ${local_Port}):" Mapper_Port [[ -z "${Mapper_Port}" ]] && Mapper_Port=${local_Port} echo $((${Mapper_Port}+0)) &>/dev/null if [[ $? -eq 0 ]]; then @@ -245,7 +245,7 @@ Set_Mapper_Port(){ } Set_Mapper_IP(){ echo -e "请输入 tinyPortMapper 远程被转发 IP(就是被中转服务器的外网IP)" - stty erase '^H' && read -p "(默认回车取消):" Mapper_IP + read -e -p "(默认回车取消):" Mapper_IP [[ -z "${Mapper_IP}" ]] && echo "已取消..." && exit 1 echo echo "——————————————————————————————" @@ -256,7 +256,7 @@ Set_Mapper_IP(){ Set_Mapper_Type(){ echo -e "请输入数字 来选择 tinyPortMapper 转发类型:" echo -e " 1. TCP\n 2. UDP\n 3. TCP+UDP(ALL)\n" - stty erase '^H' && read -p "(默认: TCP+UDP):" Mapper_Type_num + read -e -p "(默认: TCP+UDP):" Mapper_Type_num [[ -z "${Mapper_Type_num}" ]] && Mapper_Type_num="3" if [[ ${Mapper_Type_num} = "1" ]]; then Mapper_Type="TCP" @@ -331,7 +331,7 @@ Del_forwarding(){ while true do View_forwarding - stty erase '^H' && read -p "请输入你要终止的 tinyPortMapper 本地监听端口:" Del_forwarding_port + read -e -p "请输入你要终止的 tinyPortMapper 本地监听端口:" Del_forwarding_port [[ -z "${Del_forwarding_port}" ]] && echo "已取消..." && exit 0 Del_port=$(echo -e "${tinymapper_list_all}"|grep ${Del_forwarding_port}) if [[ ! -z ${Del_port} ]]; then @@ -392,7 +392,7 @@ echo && echo -e " tinyPortMapper 端口转发一键管理脚本 ${Red_font_prefi ${Green_font_prefix}6.${Font_color_suffix} 删除 tinyPortMapper 端口转发 ———————————— ${Green_font_prefix}7.${Font_color_suffix} 查看 tinyPortMapper 输出日志" && echo -stty erase '^H' && read -p " 请输入数字 [0-7]:" num +read -e -p " 请输入数字 [0-7]:" num case "$num" in 0) Update_Shell