Skip to content

Commit

Permalink
Update mtproxy.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
chummumm authored Feb 16, 2020
1 parent dad8657 commit 4c09b3e
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions mtproxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ git clone https://github.com/chummumm/mtprotoproxy.git /etc/mtproxy &&
echo -n '请输入mtproxy运行端口:'
read num &&
if [ ! -n "$num" ]; then
echo -e '\033[32m端口已设置为默认(1973)\033[0m'
echo -e '\033[32m端口已设置为默认(1973)\033[0m' &&
num=1973
else
judge=`echo "$num*1" | bc ` &&
if [ $judge -ne 0 ]; then
Expand All @@ -22,6 +23,18 @@ secret=$(head -c 16 /dev/urandom | xxd -ps) &&
sed -i "s/0000000054655212aa12221200000001/$secret/g" /etc/mtproxy/config.py &&
sed -i 's/"secure": False,/"secure": True,/g' /etc/mtproxy/config.py
sed -i 's/AD_TAG/#AD_TAG/g' /etc/mtproxy/config.py &&
echo -n '请输入需要伪装的域名:'
read domain &&
if [ ! -n "$domain" ]; then
echo -e '\033[32m使用默认伪装域名(www.cloudflare.com)\033[0m' &&
domain=www.cloudflare.com
else
sed -i "s/www.cloudflare.com/$domain/g" /etc/mtproxy/config.py
fi &&
STR="$domain" &&
HEXVAL=$(xxd -pu <<< "$STR") &&
hexdomain=${HEXVAL%0a} &&
ip=$(curl ip.sb) &&
echo 开始注册mtproxy守护进程...... &&
wget -q --no-check-certificate https://raw.githubusercontent.com/chummumm/one-key-mtp/master/mtproxy.service -O /etc/systemd/system/mtproxy.service &&
sed -i "s/mtprotoproxy.py/\/etc\/mtproxy\/mtprotoproxy.py/g" /etc/systemd/system/mtproxy.service &&
Expand All @@ -30,7 +43,11 @@ systemctl enable mtproxy &&
systemctl start mtproxy &&
systemctl restart mtproxy &&
echo 完成. &&
clear &&
echo 'mtproxy.service已注册,通过systemctl status mtproxy可查看配置信息(如果有防火墙请手动放行端口).' &&
echo -e '\033[32m注意!!!!!!使用systemctl status mtproxy查看配置信息显示不全时请使用方向键右键进行查看!!!!!!\033[0m' &&
echo '删除mtproxy及其守护进程请运行:wget --no-check-certificate https://raw.githubusercontent.com/chummumm/one-key-mtp/master/deletemtproxy.sh && bash deletemtproxy.sh' &&
echo -e '\033[32m请使用 systemctl status mtproxy 命令查看证书是否获取成功\033[0m' &&
echo -e '\033[32m代理信息:\033[0m' &&
echo -e "\033[32mtg://proxy?server=$ip&port=$num&secret=dd$secret\033[0m" &&
echo -e "\033[32mtg://proxy?server=$ip&port=$num&secret=ee$secret$hexdomain\033[0m" &&
echo '删除mtproxy及其守护进程请运行: wget --no-check-certificate https://raw.githubusercontent.com/chummumm/one-key-mtp/master/deletemtproxy.sh && bash deletemtproxy.sh' &&
rm -- "$0"

0 comments on commit 4c09b3e

Please sign in to comment.