From 05bd787ab0b6b44bffe7ca93615203592d580a52 Mon Sep 17 00:00:00 2001 From: Flyzy2005 Date: Sat, 20 Jan 2018 17:29:15 +0800 Subject: [PATCH] first commit --- ss-fly.sh | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ sshelp | 9 ++++++++ 2 files changed, 76 insertions(+) create mode 100755 ss-fly.sh create mode 100644 sshelp diff --git a/ss-fly.sh b/ss-fly.sh new file mode 100755 index 0000000..797abc9 --- /dev/null +++ b/ss-fly.sh @@ -0,0 +1,67 @@ +#! /bin/bash +# Copyright (c) 2018 flyzy2005 + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +usage () { + cat $DIR/sshelp +} + +wrong_para_prompt() { + echo "参数输入错误!$1" +} + +install() { + if [[ "$#" -ne 1 ]]; then + wrong_para_prompt "请输入密码" + return 1 + fi + echo "{ + \"server\":\"0.0.0.0\", + \"server_port\":8388, + \"local_address\": \"127.0.0.1\", + \"local_port\":1080, + \"password\":\"$1\", + \"timeout\":300, + \"method\":\"aes-256-cfb\" +}" > /etc/shadowsocks.json + apt-get update + apt-get install -y python-pip + pip install --upgrade pip + pip install setuptools + pip install shadowsocks + chmod 755 /etc/shadowsocks.json + apt-get install python-m2crypto + ssserver -c /etc/shadowsocks.json -d start + sed -i '$i\ssserver -c /etc/shadowsocks.json -d start' /etc/rc.local + echo '安装成功~尽情冲浪吧' +} + +if [ "$#" -eq 0 ]; then + usage + exit 0 +fi + +case $1 in + -h|h|help ) + usage + exit 0; + ;; + -v|v|version ) + echo 'ss-fly Version 1.0, 2018-01-20, Copyright (c) 2018 flyzy2005' + exit 0; + ;; +esac + +if [ "$EUID" -ne 0 ]; then + echo '必需以root身份运行,请使用sudo命令' + exit 1; +fi + +case $1 in + -i|i|install ) + install $2 + ;; + * ) + usage + ;; +esac diff --git a/sshelp b/sshelp new file mode 100644 index 0000000..2062b42 --- /dev/null +++ b/sshelp @@ -0,0 +1,9 @@ +声明: + 只在Vultr的Ubuntu16.04上测试了 +用法: + 显示版本: + ss-fly.sh -v|v|version + 显示帮助: + ss-fly.sh [-h|h|help] + 一键安装: + ss-fly.sh -i|i|install \ No newline at end of file