diff --git a/softcenter/app.json.js b/softcenter/app.json.js index 4b2fbc3..6ea7132 100644 --- a/softcenter/app.json.js +++ b/softcenter/app.json.js @@ -80,6 +80,16 @@ "title": "frpc穿透", "version": "2.1.15" }, + { + "build_date": "2019-01-16_20:42:05", + "description": "ss-server", + "home_url": "Module_ssserver.asp", + "md5": "685832dcb4a2a9df0c080043269922c5", + "name": "ssserver", + "tar_url": "ssserver/ssserver.tar.gz", + "title": "ss-server", + "version": "2.1" + }, { "build_date": "2019-01-13_19:04:43", "description": "kms", diff --git a/ssserver/backup.sh b/ssserver/backup.sh new file mode 100644 index 0000000..e71b0fc --- /dev/null +++ b/ssserver/backup.sh @@ -0,0 +1,24 @@ +#! /bin/sh + +# you can do something here +# this shell scripts will run at the end of build.py scripts + +tar_name="$1.tar.gz" + +mkdir -p history +if [ ! -f ./history/version ];then + touch ./history/version +fi + +version_old=`cat history/version | awk '{print $1}' | sort -rn |sed -n 1p` +version_new=`cat config.json.js |grep "version"|cut -d"\"" -f 4` +md5_old=`cat history/version | sort -nk1 | awk '{print $1}' |sed -n 1p` +md5_new=` md5sum $tar_name | awk '{print $1}'` + +if [ -f ./$tar_name ];then + if [ "$version_old" != "$version_new" ];then + mkdir ./history/$version_new/ + cp ./$tar_name ./history/$version_new/ + echo $version_new $md5_new >> ./history/version + fi +fi diff --git a/ssserver/build.sh b/ssserver/build.sh new file mode 100755 index 0000000..7144ae6 --- /dev/null +++ b/ssserver/build.sh @@ -0,0 +1,32 @@ +#!/bin/sh + + +MODULE=ssserver +VERSION=2.1 +TITLE=ss-server +DESCRIPTION=ss-server +HOME_URL=Module_ssserver.asp + +# Check and include base +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +if [ "$MODULE" == "" ]; then + echo "module not found" + exit 1 +fi + +if [ -f "$DIR/$MODULE/$MODULE/install.sh" ]; then + echo "install script not found" + exit 2 +fi + +# now include build_base.sh +. $DIR/../softcenter/build_base.sh + +# change to module directory +cd $DIR + +# do something here + +do_build_result + +sh backup.sh $MODULE diff --git a/ssserver/config.json.js b/ssserver/config.json.js new file mode 100644 index 0000000..af21c83 --- /dev/null +++ b/ssserver/config.json.js @@ -0,0 +1,8 @@ +{ +"version":"2.1", +"md5":"685832dcb4a2a9df0c080043269922c5", +"home_url":"Module_ssserver.asp", +"title":"ss-server", +"description":"ss-server", +"build_date":"2019-01-16_20:42:05" +} diff --git a/ssserver/history/2.1/ssserver.tar.gz b/ssserver/history/2.1/ssserver.tar.gz new file mode 100644 index 0000000..b3f8a25 Binary files /dev/null and b/ssserver/history/2.1/ssserver.tar.gz differ diff --git a/ssserver/history/version b/ssserver/history/version new file mode 100644 index 0000000..9e64480 --- /dev/null +++ b/ssserver/history/version @@ -0,0 +1 @@ +2.1 685832dcb4a2a9df0c080043269922c5 diff --git a/ssserver/ssserver.tar.gz b/ssserver/ssserver.tar.gz new file mode 100644 index 0000000..b3f8a25 Binary files /dev/null and b/ssserver/ssserver.tar.gz differ diff --git a/ssserver/ssserver/bin/obfs-server b/ssserver/ssserver/bin/obfs-server new file mode 100755 index 0000000..7647e08 Binary files /dev/null and b/ssserver/ssserver/bin/obfs-server differ diff --git a/ssserver/ssserver/bin/ss-server b/ssserver/ssserver/bin/ss-server new file mode 100755 index 0000000..1a6d734 Binary files /dev/null and b/ssserver/ssserver/bin/ss-server differ diff --git a/ssserver/ssserver/install.sh b/ssserver/ssserver/install.sh new file mode 100644 index 0000000..225b706 --- /dev/null +++ b/ssserver/ssserver/install.sh @@ -0,0 +1,19 @@ +#! /bin/sh +cd /tmp +cp -rf /tmp/ssserver/bin/* /jffs/softcenter/bin +cp -rf /tmp/ssserver/scripts/* /jffs/softcenter/scripts/ +cp -rf /tmp/ssserver/webs/* /jffs/softcenter/webs/ +cp -rf /tmp/ssserver/res/* /jffs/softcenter/res/ +if [ ! -L "/jffs/softcenter/init.d/S10Softcenter.sh" ]; then + cp -f /jffs/softcenter/scripts/ssserver.sh /jffs/softcenter/init.d/S66ssserver.sh +fi + +cd / +rm -rf /tmp/ssserver* >/dev/null 2>&1 + + +chmod 755 /jffs/softcenter/bin/ss-server +chmod 755 /jffs/softcenter/bin/* +chmod 755 /jffs/softcenter/init.d/* +chmod 755 /jffs/softcenter/scripts/* + diff --git a/ssserver/ssserver/res/icon-ssserver.png b/ssserver/ssserver/res/icon-ssserver.png new file mode 100644 index 0000000..8903338 Binary files /dev/null and b/ssserver/ssserver/res/icon-ssserver.png differ diff --git a/ssserver/ssserver/scripts/ssserver.sh b/ssserver/ssserver/scripts/ssserver.sh new file mode 100644 index 0000000..82a600d --- /dev/null +++ b/ssserver/ssserver/scripts/ssserver.sh @@ -0,0 +1,102 @@ +#!/bin/sh + +# ====================================变量定义==================================== +# 版本号定义 +version="2.2" +# 引用环境变量等 +source /jffs/softcenter/scripts/base.sh + +# 导入skipd数据 +eval `dbus export ssserver` + +# kill first +stop_ssserver(){ + killall ss-server + killall obfs-server +} + +# start ssserver +start_ssserver(){ + + [ $ssserver_udp -ne 1 ] && ARG_UDP="" || ARG_UDP="-u"; + if [ "$ssserver_obfs" == "http" ];then + ARG_OBFS="--plugin obfs-server --plugin-opts obfs=http" + elif [ "$ssserver_obfs" == "tls" ];then + ARG_OBFS="--plugin obfs-server --plugin-opts obfs=tls" + else + ARG_OBFS="" + fi + + #ss-server -c /jffs/softcenter/ssserver/ss.json $ARG_UDP $ARG_OBFS -f /tmp/ssserver.pid + /jffs/softcenter/bin/ss-server -s 0.0.0.0 -p $ssserver_port -k $ssserver_password -m $ssserver_method -t $ssserver_time $ARG_UDP -f /tmp/ssserver.pid $ARG_OBFS +} + +open_port(){ + iptables -t filter -I INPUT -p tcp --dport $ssserver_port -j ACCEPT >/dev/null 2>&1 + iptables -t filter -I INPUT -p udp --dport $ssserver_port -j ACCEPT >/dev/null 2>&1 +} + +close_port(){ + iptables -t filter -D INPUT -p tcp --dport $ssserver_port -j ACCEPT >/dev/null 2>&1 + iptables -t filter -D INPUT -p udp --dport $ssserver_port -j ACCEPT >/dev/null 2>&1 +} + +write_nat_start(){ + echo 添加nat-start触发事件... + dbus set __event__onnatstart_ssserver="/jffs/softcenter/scripts/ssserver.sh" +} + +remove_nat_start(){ + echo 删除nat-start触发... + dbus remove __event__onnatstart_koolproxy +} + +write_output(){ + ss_enable=`dbus get ss_basic_enable` + if [ "$ssserver_use_ss" == "1" ] && [ "$ss_enable" == "1" ];then + if [ ! -L "/tmp/etc/dnsmasq.user/gfwlist.conf" ];then + echo link gfwlist.conf + ln -sf /jffs/softcenter/ss/rules/gfwlist.conf /tmp/etc/dnsmasq.user/gfwlist.conf + fi + service restart_dnsmasq + iptables -t nat -A OUTPUT -p tcp -m set --match-set gfwlist dst -j REDIRECT --to-ports 3333 + fi +} + +del_output(){ + iptables -t nat -D OUTPUT -p tcp -m set --match-set gfwlist dst -j REDIRECT --to-ports 3333 >/dev/null 2>&1 +} + +case $ACTION in +start) + if [ "$ssserver_enable" == "1" ];then + logger "[软件中心]: 启动ss-server!" + start_ssserver + open_port + write_output + else + logger "[软件中心]: ss-server未设置开机启动,跳过!" + fi + ;; +stop | kill ) + close_port + stop_ssserver + remove_nat_start + del_output + ;; +restart) + close_port + stop_ssserver + del_output + sleep 1 + start_ssserver + open_port + write_nat_start + write_output + ;; +*) + close_port + del_output + open_port + write_output +esac diff --git a/ssserver/ssserver/scripts/ssserver_config.sh b/ssserver/ssserver/scripts/ssserver_config.sh new file mode 100644 index 0000000..90c6c48 --- /dev/null +++ b/ssserver/ssserver/scripts/ssserver_config.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +eval `dbus export ssserver` + +if [ "$ssserver_enable" == "1" ];then + sh /jffs/softcenter/scripts/ssserver.sh restart +else + sh /jffs/softcenter/scripts/ssserver.sh stop +fi diff --git a/ssserver/ssserver/uninstall.sh b/ssserver/ssserver/uninstall.sh new file mode 100644 index 0000000..7563adf --- /dev/null +++ b/ssserver/ssserver/uninstall.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +rm -rf /jffs/softcenter/bin/ssserver +rm -rf /jffs/softcenter/init.d/jffs/softcenter/init.d/S66ssserver.sh +rm -rf /jffs/softcenter/scripts/ssserve*.sh +rm -rf /jffs/softcenter/webs/Module_ssserver.asp +rm -rf /jffs/softcenter/scripts/uninstall_ssserver.sh diff --git a/ssserver/ssserver/webs/Module_ssserver.asp b/ssserver/ssserver/webs/Module_ssserver.asp new file mode 100644 index 0000000..5a8c90f --- /dev/null +++ b/ssserver/ssserver/webs/Module_ssserver.asp @@ -0,0 +1,248 @@ + + +
+ + + + + + +