add aria2 kuainiao

This commit is contained in:
paldier 2019-01-13 14:32:48 +08:00
parent 1a386bb072
commit 387d2890f7
54 changed files with 5079 additions and 327 deletions

BIN
aria2/aria2.tar.gz Normal file

Binary file not shown.

View File

BIN
aria2/aria2/bin/aria2c Executable file

Binary file not shown.

1
aria2/aria2/bin/version Normal file
View File

@ -0,0 +1 @@
1.7.5

24
aria2/aria2/install.sh Normal file
View File

@ -0,0 +1,24 @@
#! /bin/sh
cd /tmp
cp -rf /tmp/aria2/bin/* /jffs/softcenter/
cp -rf /tmp/aria2/res/* /jffs/softcenter/res/
cp -rf /tmp/aria2/scripts/* /jffs/softcenter/scripts/
cp -rf /tmp/aria2/webs/* /jffs/softcenter/webs/
cp -rf /tmp/aria2/perp/aria2 /jffs/softcenter/perp/
cp -rf /tmp/aria2/uninstall.sh /jffs/softcenter/scripts/uninstall_aria2.sh
rm -rf /tmp/aria2* >/dev/null 2>&1
if [ ! -f /jffs/softcenter/bin/aria2.session ];then
touch /jffs/softcenter/bin/aria2.session
fi
chmod 755 /jffs/softcenter/bin/aria2
chmod 755 /jffs/softcenter/init.d/*
chmod 755 /jffs/softcenter/scripts/aria2*
chmod 755 /jffs/softcenter/perp/aria2/*
check_ddnsto_en=`dbus get ddnsto_enable`
if [ "${check_ddnsto_en}"x = "1"x ]; then
dbus set aria2_ddnsto=true
fi
/jffs/softcenter/scripts/aria2_config.sh

View File

@ -0,0 +1,6 @@
#!/bin/sh
if test ${1} = 'start' ; then
exec tinylog -k 5 -t /var/log/${2}
fi
exit 0

View File

@ -0,0 +1,22 @@
#!/bin/sh
exec 2>&1
Aria2_enable=`dbus get aria2_enable`
Aria2_restart=`dbus get aria2_restart`
Aria2_sleep=`dbus get aria2_sleep`
if test ${1} = 'start' ; then
if [ "$Aria2_enable" == "1" ];then
if [ "$Aria2_restart" == "1" ]; then
echo "Aria2 restart flag detected, it will now be reset"
dbus set aria2_restart=0
elif [ "$Aria2_sleep" -gt 0 ]; then
echo "Awaiting $Aria2_sleep seconds before launching aria2..."
sleep $Aria2_sleep
fi
exec /jffs/softcenter/bin/aria2c --conf-path=/jffs/softcenter/etc/aria2.conf
fi
fi
exit 0

View File

@ -0,0 +1 @@
<% nvram_dump(".aria2.log",""); %>

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -0,0 +1,8 @@
#!/bin/sh
eval `dbus export aria2`
if [ "$aria2_enable" == "1" ];then
sh /jffs/softcenter/scripts/aria2_run.sh restart
else
sh /jffs/softcenter/scripts/aria2_run.sh stop
fi

View File

@ -0,0 +1,158 @@
#!/bin/sh
# define variables
eval `dbus export aria2`
source /jffs/softcenter/scripts/base.sh
export PERP_BASE=/jffs/softcenter/perp
#old_token=$(cat /jffs/softcenter/aria2/aria2.conf|grep rpc-secret|cut -d "=" -f2)
check_ddnsto=`dbus get aria2_ddnsto`
if [ "${check_ddnsto}"x = "true"x ]; then
ddnsto_route_id=`/jffs/softcenter/bin/ddnsto -w | awk '{print $2}'`
token=`echo $(dbus get ddnsto_token)-${ddnsto_route_id}`
else
token=${aria2_rpc_secret}
fi
ddns=$(nvram get ddns_hostname_x)
usb_disk1=`/bin/mount | grep -E 'mnt' | sed -n 1p | cut -d" " -f3`
usb_disk2=`/bin/mount | grep -E 'mnt' | sed -n 2p | cut -d" " -f3`
dbus set aria2_warning=""
echo ""
echo "#############################################################"
printf "%0s%50s%10s\n" "#" "Aria2c Auto config Script for Merlin ARM" "#"
printf "%0s%37s%23s\n" "#" "Website: http://jffs/softcenter.cn" "#"
printf "%0s%46s%14s\n" "#" "Author: sadoneli <sadoneli@gmail.com>" "#"
echo "#############################################################"
echo ""
# start aria2c
creat_conf(){
cat > /jffs/softcenter/aria2/aria2.conf <<EOF
`dbus list aria2 | grep -vw aria2_enable | grep -vw aria2_ddnsto | grep -vw aria2_binary| grep -vw aria2_binary_custom | grep -vw aria2_check | grep -vw aria2_check_time | grep -vw aria2_sleep | grep -vw aria2_update_enable| grep -vw aria2_update_sel | grep -vw aria2_version | grep -vw aria2_cpulimit_enable | grep -vw aria2_cpulimit_value| grep -vw aria2_version_web | grep -vw aria2_warning | grep -vw aria2_custom | grep -vw aria2_install_status|grep -vw aria2_restart |grep -vw aria2_dir| sed 's/aria2_//g' | sed 's/_/-/g'`
`dbus list aria2|grep -w aria2_dir|sed 's/aria2_//g'`
EOF
cat >> /jffs/softcenter/aria2/aria2.conf <<EOF
`dbus list aria2|grep -w aria2_custom|sed 's/aria2_custom=//g'|sed 's/,/\n/g'`
EOF
# if [ "$aria2_enable_rpc" = "false" ];then
# sed -i '/rpc/d' /jffs/softcenter/aria2/aria2.conf
# fi
}
start_aria2(){
#/jffs/softcenter/aria2/aria2c --conf-path=/jffs/softcenter/aria2/aria2.conf -D >/dev/null 2>&1 &
perpctl A aria2
}
# generate token
generate_token(){
sed -i "s/rpc-secret=.*/rpc-secret=$token/g" "/jffs/softcenter/etc/aria2.conf"
dbus set aria2_rpc_secret="$token"
}
# open firewall port
open_port(){
echo open firewall port $aria2_rpc_listen_port and 8088
iptables -I INPUT -p tcp --dport $aria2_rpc_listen_port -j ACCEPT >/dev/null 2>&1
iptables -I INPUT -p tcp --dport 8088 -j ACCEPT >/dev/null 2>&1
iptables -I INPUT -p tcp --dport 6881:6889 -j ACCEPT >/dev/null 2>&1
iptables -I INPUT -p tcp --dport 51413 -j ACCEPT >/dev/null 2>&1
iptables -I INPUT -p tcp --dport 52413 -j ACCEPT >/dev/null 2>&1
iptables -I INPUT -p udp --dport 52413 -j ACCEPT >/dev/null 2>&1
echo done
}
# close firewall port
close_port(){
echo close firewall port $aria2_rpc_listen_port and 8088
iptables -D INPUT -p tcp --dport $aria2_rpc_listen_port -j ACCEPT >/dev/null 2>&1
iptables -D INPUT -p tcp --dport 8088 -j ACCEPT >/dev/null 2>&1
iptables -D INPUT -p tcp --dport 6881:6889 -j ACCEPT >/dev/null 2>&1
iptables -D INPUT -p tcp --dport 51413 -j ACCEPT >/dev/null 2>&1
iptables -D INPUT -p tcp --dport 52413 -j ACCEPT >/dev/null 2>&1
iptables -D INPUT -p udp --dport 52413 -j ACCEPT >/dev/null 2>&1
echo done
}
# kill aria2
kill_aria2(){
perpctl X aria2
killall aria2c >/dev/null 2>&1
}
del_process_check(){
cru d aria2_guard >/dev/null 2>&1
}
add_cpulimit(){
if [ "$aria2_cpulimit_enable" = "true" ];then
limit=`expr $aria2_cpulimit_value \* 2`
cpulimit -e aria2c -l $limit >/dev/null 2>&1 &
fi
}
load_default(){
del_version_check
kill_aria2
close_port
dbus set tmp_aria2_version=`dbus get aria2_version`
dbus set tmp_aria2_version_web=`dbus get aria2_version_web`
for r in `dbus list aria2|cut -d"=" -f 1`
do
dbus remove $r
done
dbus set aria2_enable=0
dbus set aria2_install_status=1
dbus set aria2_version=`dbus get tmp_aria2_version`
dbus set aria2_version_web=`dbus get tmp_aria2_version_web`
dbus remove tmp_aria2_version
}
# ============================================
case $ACTION in
start)
if [ "$aria2_enable" == "1" ];then
creat_conf
generate_token
start_aria2
open_port
add_cpulimit
dbus set __event__onnatstart_shellinlinux=/jffs/softcenter/scripts/aria2_run.sh
fi
;;
stop | kill )
kill_aria2
killall cpulimit
close_port
dbus remove aria2_custom
dbus remove __event__onnatstart_shellinlinux
;;
restart)
del_process_check
killall cpulimit
kill_aria2
close_port
sleep 1
creat_conf
generate_token
start_aria2
open_port
add_cpulimit
dbus remove __event__onnatstart_shellinlinux
sleep 1
dbus set __event__onnatstart_shellinlinux=/jffs/softcenter/scripts/aria2_run.sh
;;
default)
load_default
;;
*)
close_port
open_port
;;
esac

View File

@ -0,0 +1,13 @@
#! /bin/sh
source /jffs/softcenter/scripts/base.sh
aria2_status=`ps | grep -w /jffs/softcenter/aria2/aria2c | grep -cv grep`
aria2_pid=`ps | grep -w /jffs/softcenter/aria2/aria2c | grep -v grep | awk '{print $1}'`
aria2_version=`/jffs/softcenter/aria2/aria2c --version | head -n 1`
if [ "$aria2_status"x = "1"x ];then
echo 进程运行正常!${aria2_version}PID$aria2_pid > /tmp/.aria2.log
else
echo \<em\>【警告】:进程未运行!\<\/em\> ${aria2_version} > /tmp/.aria2.log
fi
echo XU6J03M6 >> /tmp/.aria2.log
sleep 2
rm -rf /tmp/.aria2.log

11
aria2/aria2/uninstall.sh Normal file
View File

@ -0,0 +1,11 @@
#!/bin/sh
sh /jffs/softcenter/scripts/aria2_run.sh stop
rm -rf /jffs/softcenter/bin/aria2*
rm -rf /jffs/softcenter/perp/aria2
rm -rf /jffs/softcenter/scripts/aria2_config.sh
rm -rf /jffs/softcenter/scripts/aria2_status.sh
rm -rf /jffs/softcenter/res/aria2_check.html
rm -rf /jffs/softcenter/res/icon-aria2.png
rm -rf /jffs/softcenter/webs/Module_aria2.asp
rm -fr /jffs/softcenter/scripts/uninstall_aria2.sh

File diff suppressed because it is too large Load Diff

25
aria2/backup.sh Normal file
View File

@ -0,0 +1,25 @@
#! /bin/sh
# you can do something here
# this shell scripts will run at the end of build.py scripts
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 aria2.tar.gz | awk '{print $1}'`
if [ -f ./aria2.tar.gz ];then
if [ "$version_old" != "$version_new" ];then
mkdir ./history/$version_new/
cp ./aria2.tar.gz ./history/$version_new/
echo $version_new $md5_new >> ./history/version
fi
fi

61
aria2/build.py Normal file
View File

@ -0,0 +1,61 @@
#!/usr/bin/env python
# _*_ coding:utf-8 _*_
import os
import json
import codecs
import hashlib
from string import Template
parent_path = os.path.dirname(os.path.realpath(__file__))
def md5sum(full_path):
with open(full_path, 'rb') as rf:
return hashlib.md5(rf.read()).hexdigest()
def get_or_create():
conf_path = os.path.join(parent_path, "config.json.js")
conf = {}
if not os.path.isfile(conf_path):
print u"config.json.js 文件找不到build.py 一定得放插件根目录。自动为您生成一个config.json.js其它信息请您自己修改。"
module_name = os.path.basename(parent_path)
conf["module"] = module_name
conf["version"] = "0.0.1"
conf["home_url"] = ("Module_%s.asp" % module_name)
conf["title"] = "title of " + module_name
conf["description"] = "description of " + module_name
else:
with codecs.open(conf_path, "r", "utf-8") as fc:
conf = json.loads(fc.read())
return conf
def build_module():
try:
conf = get_or_create()
except:
print u"config.json.js 文件格式错误"
traceback.print_exc()
if "module" not in conf:
print u"没有 module 在 config.json.js 里"
return
module_path = os.path.join(parent_path, conf["module"])
if not os.path.isdir(module_path):
print u"找不到对应的 %s 文件夹config.json.js 里面的 module 值不对?" % module_path
return
install_path = os.path.join(parent_path, conf["module"], "install.sh")
if not os.path.isfile(install_path):
print u"找不到对应的 %s 文件,插件确实 install.sh 文件"
return
print u"生成中..."
t = Template("cd $parent_path && rm -f $module.tar.gz && tar -zcf $module.tar.gz $module")
os.system(t.substitute({"parent_path": parent_path, "module": conf["module"]}))
conf["md5"] = md5sum(os.path.join(parent_path, conf["module"] + ".tar.gz"))
conf_path = os.path.join(parent_path, "config.json.js")
with codecs.open(conf_path, "w", "utf-8") as fw:
json.dump(conf, fw, sort_keys = True, indent = 4, ensure_ascii=False, encoding='utf8')
print u"生成完成", conf["module"] + ".tar.gz"
hook_path = os.path.join(parent_path, "backup.sh")
if os.path.isfile(hook_path):
os.system(hook_path)
build_module()

33
aria2/build.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/sh
MODULE=aria2
VERSION=2.4
TITLE=Aria2
DESCRIPTION=linux下载利器
HOME_URL=Module_aria2.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

8
aria2/config.json.js Normal file
View File

@ -0,0 +1,8 @@
{
"version":"2.4",
"md5":"cdd0a74446c977528b6c0bd39f6d85bb",
"home_url":"Module_aria2.asp",
"title":"Aria2",
"description":"linux下载利器",
"build_date":"2019-01-13_14:31:33"
}

Binary file not shown.

1
aria2/history/version Normal file
View File

@ -0,0 +1 @@
2.4 cdd0a74446c977528b6c0bd39f6d85bb

2
aria2/version Normal file
View File

@ -0,0 +1,2 @@
2.4
cdd0a74446c977528b6c0bd39f6d85bb

View File

@ -1,8 +1,8 @@
{ {
"version":"3.8.4", "version":"3.8.4",
"md5":"42c61e110449a52a19b76931d432df7a", "md5":"1ad5b05d424832237b00028327e9a90e",
"home_url":"Module_koolproxy.asp", "home_url":"Module_koolproxy.asp",
"title":"koolproxy", "title":"koolproxy",
"description":"去广告,没烦恼", "description":"去广告,没烦恼",
"build_date":"2019-01-13_00:10:53" "build_date":"2019-01-13_02:08:34"
} }

Binary file not shown.

View File

@ -2,22 +2,26 @@
eval `dbus export koolproxy` eval `dbus export koolproxy`
# stop first # stop first
dbus set koolproxy_enable=0 [ "$koolproxy_enable" == "1" ] && sh /jffs/softcenter/koolproxy/kp_config.sh stop
[ -f /jffs/softcenter/koolproxy/koolproxy.sh ] && sh /jffs/softcenter/koolproxy/koolproxy.sh stop
[ -f /jffs/softcenter/koolproxy/kp_config.sh ] && sh /jffs/softcenter/koolproxy/kp_config.sh stop
# remove old files # remove old files
rm -rf /jffs/softcenter/bin/koolproxy >/dev/null 2>&1 rm -rf /jffs/softcenter/bin/koolproxy >/dev/null 2>&1
rm -rf /jffs/softcenter/koolproxy/koolproxy.sh >/dev/null 2>&1 rm -rf /jffs/softcenter/init.d/*koolproxy.sh
rm -rf /jffs/softcenter/koolproxy/nat_load.sh >/dev/null 2>&1 rm -rf /jffs/softcenter/scripts/koolproxy*
rm -rf /jffs/softcenter/koolproxy/data/*.dat >/dev/null 2>&1 rm -rf /jffs/softcenter/webs/Module_koolproxy.asp
rm -rf /jffs/softcenter/koolproxy/data/*.txt >/dev/null 2>&1 rm -rf /jffs/softcenter/koolproxy/*.sh >/dev/null 2>&1
rm -rf /jffs/softcenter/koolproxy/data/*.conf >/dev/null 2>&1 rm -rf /jffs/softcenter/koolproxy/koolproxy >/dev/null 2>&1
rm -rf /jffs/softcenter/koolproxy/data/gen_ca.sh >/dev/null 2>&1 rm -rf /jffs/softcenter/koolproxy/data/*.sh >/dev/null 2>&1
rm -rf /jffs/softcenter/koolproxy/data/koolproxy_ipset.conf >/dev/null 2>&1
rm -rf /jffs/softcenter/koolproxy/data/openssl.cnf >/dev/null 2>&1 rm -rf /jffs/softcenter/koolproxy/data/openssl.cnf >/dev/null 2>&1
rm -rf /jffs/softcenter/koolproxy/data/version >/dev/null 2>&1 rm -rf /jffs/softcenter/koolproxy/data/rules/*.dat >/dev/null 2>&1
rm -rf /jffs/softcenter/koolproxy/data/serial >/dev/null 2>&1 rm -rf /jffs/softcenter/koolproxy/data/rules/daily.txt >/dev/null 2>&1
rm -rf /jffs/softcenter/koolproxy/rule_store >/dev/null 2>&1 rm -rf /jffs/softcenter/koolproxy/data/rules/koolproxy.txt >/dev/null 2>&1
rm -rf /jffs/softcenter/koolproxy/data/rules/1.dat >/dev/null 2>&1
# remove old ss event
cd /tmp
dbus list __|grep koolproxy |cut -d "=" -f1 | sed 's/-A/iptables -t nat -D/g'|sed 's/^/dbus remove /g' > remove.sh && chmod 777 remove.sh && ./remove.sh
# copy new files # copy new files
cd /tmp cd /tmp
@ -33,24 +37,20 @@ else
cp -rf /tmp/koolproxy/koolproxy /jffs/softcenter/ cp -rf /tmp/koolproxy/koolproxy /jffs/softcenter/
mv /tmp/user.txt.tmp /jffs/softcenter/koolproxy/data/rules/user.txt mv /tmp/user.txt.tmp /jffs/softcenter/koolproxy/data/rules/user.txt
fi fi
cp -f /tmp/koolproxy/uninstall.sh /jffs/softcenter/scripts/uninstall_koolproxy.sh cp -f /tmp/koolproxy/uninstall.sh /jffs/softcenter/scripts/uninstall_koolproxy.sh
cd /
chmod 755 /jffs/softcenter/koolproxy/koolproxy
chmod 755 /jffs/softcenter/koolproxy/* chmod 755 /jffs/softcenter/koolproxy/*
chmod 755 /jffs/softcenter/koolproxy/data/* chmod 755 /jffs/softcenter/koolproxy/data/*
chmod 755 /jffs/softcenter/scripts/* chmod 755 /jffs/softcenter/scripts/*
[ ! -e "/jffs/softcenter/bin/koolproxy" ] && cp -f /jffs/softcenter/koolproxy/koolproxy /jffs/softcenter/bin/koolproxy [ ! -e "/jffs/softcenter/bin/koolproxy" ] && cp -f /jffs/softcenter/koolproxy/koolproxy /jffs/softcenter/bin/koolproxy
[ ! -L "/jffs/softcenter/init.d/S98koolproxy.sh" ] && ln -sf /jffs/softcenter/koolproxy/kp_config.sh /jffs/softcenter/init.d/S98koolproxy.sh
rm -rf /tmp/koolproxy* >/dev/null 2>&1 rm -rf /tmp/koolproxy* >/dev/null 2>&1
[ -z "$koolproxy_policy" ] && dbus set koolproxy_policy=1 [ -z "$koolproxy_policy" ] && dbus set koolproxy_policy=1
[ -z "$koolproxy_acl_default_mode" ] && dbus set koolproxy_acl_default_mode=1 [ -z "$koolproxy_acl_default_mode" ] && dbus set koolproxy_acl_default_mode=1
dbus set softcenter_module_koolproxy_install=1 dbus set softcenter_module_koolproxy_install=1
dbus set softcenter_module_koolproxy_version=3.3.7 dbus set softcenter_module_koolproxy_version=3.8.4
dbus set koolproxy_version=3.3.7 dbus set koolproxy_version=3.8.4
[ "$koolproxy_enable" == "1" ] && sh /jffs/softcenter/koolproxy/kp_config.sh restart

View File

@ -47,7 +47,7 @@ write_sourcelist(){
fi fi
if [ -n "$koolproxy_custom_rule" ];then if [ -n "$koolproxy_custom_rule" ];then
echo $koolproxy_custom_rule| base64_decode |sed 's/\\n/\n/g' > $KP_DIR/data/rules/user.txt echo $koolproxy_custom_rule| base64 -d |sed 's/\\n/\n/g' > $KP_DIR/data/rules/user.txt
dbus remove koolproxy_custom_rule dbus remove koolproxy_custom_rule
fi fi
} }
@ -90,16 +90,16 @@ remove_nat_start(){
add_ipset_conf(){ add_ipset_conf(){
if [ "$koolproxy_mode" == "2" ];then if [ "$koolproxy_mode" == "2" ];then
echo_date 添加黑名单软连接... echo_date 添加黑名单软连接...
rm -rf /jffs/configs/dnsmasq.d/koolproxy_ipset.conf rm -rf /etc/dnsmasq.user/koolproxy_ipset.conf
ln -sf /jffs/softcenter/koolproxy/data/koolproxy_ipset.conf /jffs/configs/dnsmasq.d/koolproxy_ipset.conf ln -sf /jffs/softcenter/koolproxy/data/koolproxy_ipset.conf /etc/dnsmasq.user/koolproxy_ipset.conf
dnsmasq_restart=1 dnsmasq_restart=1
fi fi
} }
remove_ipset_conf(){ remove_ipset_conf(){
if [ -L "/jffs/configs/dnsmasq.d/koolproxy_ipset.conf" ];then if [ -L "/etc/dnsmasq.user/koolproxy_ipset.conf" ];then
echo_date 移除黑名单软连接... echo_date 移除黑名单软连接...
rm -rf /jffs/configs/dnsmasq.d/koolproxy_ipset.conf rm -rf /etc/dnsmasq.user/koolproxy_ipset.conf
dnsmasq_restart=1 dnsmasq_restart=1
fi fi
} }
@ -288,6 +288,8 @@ detect_cert(){
echo_date 检测到首次运行开始生成koolproxy证书用于https过滤 echo_date 检测到首次运行开始生成koolproxy证书用于https过滤
echo_date 生成证书需要较长时间,请一定耐心等待!!! echo_date 生成证书需要较长时间,请一定耐心等待!!!
cd $KP_DIR/data && sh gen_ca.sh cd $KP_DIR/data && sh gen_ca.sh
mkdir -p /jffs/koolproxy/certs/
cp -f /jffs/softcenter/koolproxy/certs/ca.crt /jffs/koolproxy/certs/
echo_date 证书生成完毕!!! echo_date 证书生成完毕!!!
fi fi
} }

View File

@ -14,7 +14,7 @@ rules_date_local=`cat $KSROOT/koolproxy/data/rules/koolproxy.txt | sed -n '3p'|
rules_nu_local=`grep -E -v "^!" $KSROOT/koolproxy/data/rules/koolproxy.txt | wc -l` rules_nu_local=`grep -E -v "^!" $KSROOT/koolproxy/data/rules/koolproxy.txt | wc -l`
video_date_local=`cat $KSROOT/koolproxy/data/rules/koolproxy.txt | sed -n '4p'|awk '{print $3,$4}'` video_date_local=`cat $KSROOT/koolproxy/data/rules/koolproxy.txt | sed -n '4p'|awk '{print $3,$4}'`
daily_nu_local=`grep -E -v "^!" $KSROOT/koolproxy/data/rules/daily.txt | wc -l` daily_nu_local=`grep -E -v "^!" $KSROOT/koolproxy/data/rules/daily.txt | wc -l`
custom_nu_local=`grep -E -v "^!" $KSROOT/koolproxy/data/rules/user.txt | wc -l` #custom_nu_local=`grep -E -v "^!" $KSROOT/koolproxy/data/rules/user.txt | wc -l`
rm -rf /tmp/kp_tp.txt rm -rf /tmp/kp_tp.txt
tp_rules=`dbus list koolproxy_rule_file_|cut -d "=" -f1|cut -d "_" -f4|sort -n` tp_rules=`dbus list koolproxy_rule_file_|cut -d "=" -f1|cut -d "_" -f4|sort -n`
@ -40,9 +40,9 @@ else
fi fi
rm -rf /tmp/koolproxy.log rm -rf /tmp/koolproxy.log
if [ "$status" == "2" ];then if [ "$status" == "2" ];then
echo "$date$version 运行正常!(PID: $pid)@@<span>$rules_date_local / $rules_nu_local条</span>@@<span>$daily_nu_local条</span>@@<span>$video_date_local<span>@@<span>$custom_nu_local条</span>$TP" > /tmp/koolproxy.log echo "$date$version 运行正常!(PID: $pid)@@<span>$rules_date_local / $rules_nu_local条</span>@@<span>$daily_nu_local条</span>@@<span>$video_date_local<span>$TP" > /tmp/koolproxy.log
else else
echo "<font color='#FF0000'>【警告】:进程未运行!请点击提交按钮!</font>@@<span>$rules_date_local / $rules_nu_local条</span>@@<span>$daily_nu_local条</span>@@<span>$video_date_local<span>@@<span>$custom_nu_local条</span>$TP" > /tmp/koolproxy.log echo "<font color='#FF0000'>【警告】:进程未运行!请点击提交按钮!</font>@@<span>$rules_date_local / $rules_nu_local条</span>@@<span>$daily_nu_local条</span>@@<span>$video_date_local<span>$TP" > /tmp/koolproxy.log
fi fi
echo XU6J03M6 >> /tmp/koolproxy.log echo XU6J03M6 >> /tmp/koolproxy.log

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +1,2 @@
3.8.4 3.8.4
42c61e110449a52a19b76931d432df7a 1ad5b05d424832237b00028327e9a90e

35
kuainiao/Changelog.txt Normal file
View File

@ -0,0 +1,35 @@
Koolshare Asuswrt-Merlin KuaiNiao Changelog
===========================================
0.3.4 ( 20/06/2016 14:41:00 )
-fix 修复迅雷快鸟心跳保持失败
0.3.3 ( 17/05/2016 13:34:00 )
-fix 修复运行脚本bug
0.3.2 ( 17/05/2016 13:28:00 )
-fix 修复运行脚本bug
0.3.0 ( 17/05/2016 12:33:26 )
-fix 更换协议版本为1.0.8
0.2.5
-fix 修复加速状态提示
0.2.4
-fix remove old install module and set version check in web
0.2.3
-fix fix installation issue
0.2.2
-fix adapt to new softerware center
0.2.1 ( 11/04/2016 17:07:36 )
- fix 双WAN模式下获取网关地址的错误
- change 修复默认的MAC地址获取逻辑防止迅雷检查异常
0.2.0 ( 01/04/2016 15:19:20 )
- add 支持双WAN模式下的快鸟绑定指定端口加速
0.1.2 ( 31/03/2016 10:41:28 )
- fix 因为迅雷移动端登陆接口增加UA认证导致的插件无法使用的异常

24
kuainiao/backup.sh Normal file
View File

@ -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

22
kuainiao/build.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/sh
MODULE=kuainiao
VERSION=0.3.6
TITLE=讯雷快鸟
DESCRIPTION="迅雷快鸟,为上网加速而生~"
HOME_URL=Module_kuainiao.asp
# Check and include base
DIR="$( cd "$( dirname "$BASH_SOURCE[0]" )" && pwd )"
# now include build_base.sh
. $DIR/../softcenter/build_base.sh
# change to module directory
cd $DIR
# do something here
do_build_result
# now backup
sh backup.sh $MODULE

8
kuainiao/config.json.js Normal file
View File

@ -0,0 +1,8 @@
{
"version":"0.3.6",
"md5":"915e63000cbf3a98887930b04aa874ec",
"home_url":"Module_kuainiao.asp",
"title":"讯雷快鸟",
"description":"迅雷快鸟,为上网加速而生~",
"build_date":"2019-01-13_14:01:15"
}

Binary file not shown.

1
kuainiao/history/version Normal file
View File

@ -0,0 +1 @@
0.3.6 915e63000cbf3a98887930b04aa874ec

BIN
kuainiao/kuainiao.tar.gz Normal file

Binary file not shown.

View File

@ -0,0 +1,14 @@
#!/bin/sh
if [ ! -d /jffs/softcenter/kuainiao ]; then
mkdir -p /jffs/softcenter/kuainiao
fi
cp -rf /tmp/kuainiao/scripts/* /jffs/softcenter/scripts/
cp -rf /tmp/kuainiao/webs/* /jffs/softcenter/webs/
cp -rf /tmp/kuainiao/res/* /jffs/softcenter/res/
cp -rf /tmp/kuainiao/kuainiao/kuainiao.sh /jffs/softcenter/kuainiao/
rm -rf /tmp/kuainiao* >/dev/null 2>&1
chmod a+x /jffs/softcenter/scripts/kuainiao_config.sh
chmod a+x /jffs/softcenter/kuainiao/kuainiao.sh

View File

@ -0,0 +1,155 @@
#!/bin/sh
eval `dbus export kuainiao`
source /jffs/softcenter/scripts/base.sh
version="0.3.6"
#双WAN判断
wans_mode=$(nvram get wans_mode)
if [ "$kuainiao_config_wan" == "1" ] && [ "$wans_mode" == "lb" ]; then
wan_selected=$(nvram get wan0_ipaddr)
if [ "$wan_selected" != "0.0.0.0" ]; then
bind_address=$wan_selected
else
bind_address=""
fi
elif [ "$kuainiao_config_wan" == "2" ] && [ "$wans_mode" == "lb" ]; then
wan_selected=$(nvram get wan1_ipaddr)
if [ "$wan_selected" != "0.0.0.0" ]; then
bind_address=$wan_selected
else
bind_address=""
fi
else
bind_address=""
fi
#定义请求函数
if [ -n "$bind_address" ]; then
HTTP_REQ="wget --bind-address=$bind_address --no-check-certificate -O - "
POST_ARG="--post-data="
else
HTTP_REQ="wget --no-check-certificate -O - "
POST_ARG="--post-data="
fi
#获取加速API
get_kuainiao_api(){
portal=`$HTTP_REQ http://api.portal.swjsq.vip.xunlei.com:81/v2/queryportal`
portal_ip=`echo $portal|grep -oE '([0-9]{1,3}[\.]){3}[0-9]{1,3}'`
portal_port_temp=`echo $portal|grep -oE "port...[0-9]{1,5}"`
portal_port=`echo $portal_port_temp|grep -oE '[0-9]{1,5}'`
if [ -z "$portal_ip" ]
then
dbus set kuainiao_warning="迅雷快鸟服务API获取失败请检查网络环境或稍后再试!"
#echo "迅雷快鸟服务API获取失败请检查网络环境或稍后再试!"
else
api_url="http://$portal_ip:$portal_port/v2"
dbus set kuainiao_config_api=$api_url
fi
}
#从dbus中获取uidpwd等
uid=$kuainiao_config_uid
pwd=$kuainiao_config_pwd
nic=$kuainiao_config_nic
peerid=$kuainiao_config_peerid
uid_orig=$uid
api_url=$kuainiao_config_api
devicesign=$kuainiao_device_sign
dial_account=$kuainiao_dial_account
app_version=$kuainiao_app_version
#初始化计数器
if [ -z "$kuainiao_run_i" ]; then
dbus ram kuainiao_run_i=6
kuainiao_run_i=6
fi
#初始化运行状态(kuainiao_run_status 0表示运行异常1表示运行正常)
if [ -z "$kuainiao_run_status" ]; then
dbus ram kuainiao_run_status=0
kuainiao_run_status=0
fi
#判断是否可以加速
if [[ ! $kuainiao_can_upgrade -eq 1 ]]; then
dbus ram kuainiao_run_i=6
dbus ram kuainiao_run_warnning="您的宽带不能使用讯鸟快鸟加速!"$(date "+%Y-%m-%d %H:%M:%S")
dbus ram kuainiao_run_status=0
exit 21
fi
#初始化日期
if [[ -z $kuainiao_run_orig_day ]]; then
day_of_month_orig=`date +%d`
orig_day_of_month=`echo $day_of_month_orig|grep -oE "[1-9]{1,2}"`
dbus ram kuainiao_run_orig_day=$orig_day_of_month
kuainiao_run_orig_day=$orig_day_of_month
fi
#开始执行逻辑
##判断是否跨天
day_of_month_orig=`date +%d`
day_of_month=`echo $day_of_month_orig|grep -oE "[1-9]{1,2}"`
if [[ -z $kuainiao_run_orig_day || $day_of_month -ne $kuainiao_run_orig_day ]]; then
dbus ram kuainiao_run_orig_day=$day_of_month
kuainiao_run_orig_day=$day_of_month
_ts=`date +%s`000
$HTTP_REQ "$api_url/recover?peerid=$peerid&userid=$uid&user_type=1&sessionid=$kuainiao_run_session&dial_account=$dial_account&client_type=android-swjsq-$app_version&client_version=androidswjsq-$app_version&os=android-5.0.1.24SmallRice&time_and=$_ts"
dbus ram kuainiao_run_i=6
kuainiao_run_i=6
sleep 5
fi
#判断是否需要重新登陆
if test $kuainiao_run_i -ge 6; then
#改变sequenceNo值
sequence=$(expr $kuainiao_run_i + 100001)
ret=`$HTTP_REQ --header "User-Agent: android-async-http/xl-acc-sdk/version-1.6.1.177600" https://login.mobile.reg2t.sandai.net:443/ $POST_ARG"{\"userName\": \""$kuainiao_config_uname"\", \"businessType\": 68, \"clientVersion\": \"2.0.3.4\", \"appName\": \"ANDROID-com.xunlei.vip.swjsq\", \"isCompressed\": 0, \"sequenceNo\": "$sequence", \"sessionID\": \"\", \"loginType\": 0, \"rsaKey\": {\"e\": \"010001\", \"n\": \"AC69F5CCC8BDE47CD3D371603748378C9CFAD2938A6B021E0E191013975AD683F5CBF9ADE8BD7D46B4D2EC2D78AF146F1DD2D50DC51446BB8880B8CE88D476694DFC60594393BEEFAA16F5DBCEBE22F89D640F5336E42F587DC4AFEDEFEAC36CF007009CCCE5C1ACB4FF06FBA69802A8085C2C54BADD0597FC83E6870F1E36FD\"}, \"cmdID\": 1, \"verifyCode\": \"\", \"peerID\": \""$peerid"\", \"protocolVersion\": 108, \"platformVersion\": 1, \"passWord\": \""$pwd"\", \"extensionList\": \"\", \"verifyKey\": \"\", \"sdkVersion\": 177550, \"devicesign\": \""$devicesign"\"}"`
session=`echo $ret|awk -F '"sessionID":' '{print $2}'|awk -F ',' '{print $1}'|grep -oE "[A-F,0-9]{32}"`
uid=`echo $ret|awk -F '"userID":' '{print $2}' | awk -F ',' '{print $1}'`
#判断登陆是否成功
if [ -z "$session" ]; then
#登陆失败重置计数器到6
dbus ram kuainiao_run_i=6
dbus ram kuainiao_run_warnning="迅雷账号登陆失败!请检查迅雷账号配置!"$(date "+%Y-%m-%d %H:%M:%S")
dbus ram kuainiao_run_status=0
exit 20
else
#登陆成功设置登陆日期和session
day_of_month_orig=`date +%d`
orig_day_of_month=`echo $day_of_month_orig|grep -oE "[1-9]{1,2}"`
dbus ram kuainiao_run_orig_day=$orig_day_of_month
dbus ram kuainiao_run_session=$session
kuainiao_run_orig_day=$orig_day_of_month
kuainiao_run_session=$session
fi
#判断返回的uid
if [ -z "$uid" ]; then
uid=$uid_orig
fi
#登陆完成重置计数器
dbus ram kuainiao_run_i=0
kuainiao_run_i=0
#登录完成重置下加速api
get_kuainiao_api
#开始加速
_ts=`date +%s`000
$HTTP_REQ "$api_url/upgrade?peerid=$peerid&userid=$uid&user_type=1&sessionid=$kuainiao_run_session&dial_account=$dial_account&client_type=android-swjsq-$app_version&client_version=androidswjsq-$app_version&os=android-5.0.1.24SmallRice&time_and=$_ts"
fi
sleep 1
#保持心跳
_ts=`date +%s`000
ret=`$HTTP_REQ "$api_url/keepalive?peerid=$peerid&userid=$uid&user_type=1&sessionid=$kuainiao_run_session&dial_account=$dial_account&client_type=android-swjsq-$app_version&client_version=androidswjsq-$app_version&os=android-5.0.1.24SmallRice&time_and=$_ts"`
if [ ! -z "`echo $ret|grep "not exist channel"`" ]; then
dbus ram kuainiao_run_i=6
dbus ram kuainiao_run_warnning="迅雷快鸟心跳保持失败!"$(date "+%Y-%m-%d %H:%M:%S")
dbus ram kuainiao_run_status=0
exit 22
else
dbus ram kuainiao_run_i=$(expr $kuainiao_run_i + 1)
dbus ram kuainiao_run_warnning="迅雷快鸟运行正常!"$(date "+%Y-%m-%d %H:%M:%S")
dbus ram kuainiao_run_status=1
fi

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -0,0 +1 @@
var md5; md5 || (md5 = function(){function i(a,b){a[b>>5]|=128<<b%32,a[(b+64>>>9<<4)+14]=b;for(var c=1732584193,d=-271733879,e=-1732584194,f=271733878,g=0;a.length>g;g+=16){var h=c,i=d,j=e,o=f;c=k(c,d,e,f,a[g+0],7,-680876936),f=k(f,c,d,e,a[g+1],12,-389564586),e=k(e,f,c,d,a[g+2],17,606105819),d=k(d,e,f,c,a[g+3],22,-1044525330),c=k(c,d,e,f,a[g+4],7,-176418897),f=k(f,c,d,e,a[g+5],12,1200080426),e=k(e,f,c,d,a[g+6],17,-1473231341),d=k(d,e,f,c,a[g+7],22,-45705983),c=k(c,d,e,f,a[g+8],7,1770035416),f=k(f,c,d,e,a[g+9],12,-1958414417),e=k(e,f,c,d,a[g+10],17,-42063),d=k(d,e,f,c,a[g+11],22,-1990404162),c=k(c,d,e,f,a[g+12],7,1804603682),f=k(f,c,d,e,a[g+13],12,-40341101),e=k(e,f,c,d,a[g+14],17,-1502002290),d=k(d,e,f,c,a[g+15],22,1236535329),c=l(c,d,e,f,a[g+1],5,-165796510),f=l(f,c,d,e,a[g+6],9,-1069501632),e=l(e,f,c,d,a[g+11],14,643717713),d=l(d,e,f,c,a[g+0],20,-373897302),c=l(c,d,e,f,a[g+5],5,-701558691),f=l(f,c,d,e,a[g+10],9,38016083),e=l(e,f,c,d,a[g+15],14,-660478335),d=l(d,e,f,c,a[g+4],20,-405537848),c=l(c,d,e,f,a[g+9],5,568446438),f=l(f,c,d,e,a[g+14],9,-1019803690),e=l(e,f,c,d,a[g+3],14,-187363961),d=l(d,e,f,c,a[g+8],20,1163531501),c=l(c,d,e,f,a[g+13],5,-1444681467),f=l(f,c,d,e,a[g+2],9,-51403784),e=l(e,f,c,d,a[g+7],14,1735328473),d=l(d,e,f,c,a[g+12],20,-1926607734),c=m(c,d,e,f,a[g+5],4,-378558),f=m(f,c,d,e,a[g+8],11,-2022574463),e=m(e,f,c,d,a[g+11],16,1839030562),d=m(d,e,f,c,a[g+14],23,-35309556),c=m(c,d,e,f,a[g+1],4,-1530992060),f=m(f,c,d,e,a[g+4],11,1272893353),e=m(e,f,c,d,a[g+7],16,-155497632),d=m(d,e,f,c,a[g+10],23,-1094730640),c=m(c,d,e,f,a[g+13],4,681279174),f=m(f,c,d,e,a[g+0],11,-358537222),e=m(e,f,c,d,a[g+3],16,-722521979),d=m(d,e,f,c,a[g+6],23,76029189),c=m(c,d,e,f,a[g+9],4,-640364487),f=m(f,c,d,e,a[g+12],11,-421815835),e=m(e,f,c,d,a[g+15],16,530742520),d=m(d,e,f,c,a[g+2],23,-995338651),c=n(c,d,e,f,a[g+0],6,-198630844),f=n(f,c,d,e,a[g+7],10,1126891415),e=n(e,f,c,d,a[g+14],15,-1416354905),d=n(d,e,f,c,a[g+5],21,-57434055),c=n(c,d,e,f,a[g+12],6,1700485571),f=n(f,c,d,e,a[g+3],10,-1894986606),e=n(e,f,c,d,a[g+10],15,-1051523),d=n(d,e,f,c,a[g+1],21,-2054922799),c=n(c,d,e,f,a[g+8],6,1873313359),f=n(f,c,d,e,a[g+15],10,-30611744),e=n(e,f,c,d,a[g+6],15,-1560198380),d=n(d,e,f,c,a[g+13],21,1309151649),c=n(c,d,e,f,a[g+4],6,-145523070),f=n(f,c,d,e,a[g+11],10,-1120210379),e=n(e,f,c,d,a[g+2],15,718787259),d=n(d,e,f,c,a[g+9],21,-343485551),c=p(c,h),d=p(d,i),e=p(e,j),f=p(f,o)}return[c,d,e,f]}function j(a,b,c,d,e,f){return p(q(p(p(b,a),p(d,f)),e),c)}function k(a,b,c,d,e,f,g){return j(b&c|~b&d,a,b,e,f,g)}function l(a,b,c,d,e,f,g){return j(b&d|c&~d,a,b,e,f,g)}function m(a,b,c,d,e,f,g){return j(b^c^d,a,b,e,f,g)}function n(a,b,c,d,e,f,g){return j(c^(b|~d),a,b,e,f,g)}function p(a,b){var c=(a&65535)+(b&65535),d=(a>>16)+(b>>16)+(c>>16);return d<<16|c&65535}function q(a,b){return a<<b|a>>>32-b}function r(a){for(var b=[],d=(1<<c)-1,e=0;a.length*c>e;e+=c)b[e>>5]|=(a.charCodeAt(e/c)&d)<<e%32;return b}function t(b){for(var c=a?"0123456789ABCDEF":"0123456789abcdef",d="",e=0;b.length*4>e;e++)d+=c.charAt(b[e>>2]>>e%4*8+4&15)+c.charAt(b[e>>2]>>e%4*8&15);return d}var a=0,c=8;return function(a){return t(i(r(a),a.length*c))}}());

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,202 @@
/*
* A JavaScript implementation of the Secure Hash Algorithm, SHA-1, as defined
* in FIPS PUB 180-1
* Version 2.1a Copyright Paul Johnston 2000 - 2002.
* Other contributors: Greg Holt, Andrew Kepert, Ydnar, Lostinet
* Distributed under the BSD License
* See http://pajhome.org.uk/crypt/md5 for details.
*/
/*
* Configurable variables. You may need to tweak these to be compatible with
* the server-side, but the defaults work in most cases.
*/
var hexcase = 0; /* hex output format. 0 - lowercase; 1 - uppercase */
var b64pad = ""; /* base-64 pad character. "=" for strict RFC compliance */
var chrsz = 8; /* bits per input character. 8 - ASCII; 16 - Unicode */
/*
* These are the functions you'll usually want to call
* They take string arguments and return either hex or base-64 encoded strings
*/
function hex_sha1(s){return binb2hex(core_sha1(str2binb(s),s.length * chrsz));}
function b64_sha1(s){return binb2b64(core_sha1(str2binb(s),s.length * chrsz));}
function str_sha1(s){return binb2str(core_sha1(str2binb(s),s.length * chrsz));}
function hex_hmac_sha1(key, data){ return binb2hex(core_hmac_sha1(key, data));}
function b64_hmac_sha1(key, data){ return binb2b64(core_hmac_sha1(key, data));}
function str_hmac_sha1(key, data){ return binb2str(core_hmac_sha1(key, data));}
/*
* Perform a simple self-test to see if the VM is working
*/
function sha1_vm_test()
{
return hex_sha1("abc") == "a9993e364706816aba3e25717850c26c9cd0d89d";
}
/*
* Calculate the SHA-1 of an array of big-endian words, and a bit length
*/
function core_sha1(x, len)
{
/* append padding */
x[len >> 5] |= 0x80 << (24 - len % 32);
x[((len + 64 >> 9) << 4) + 15] = len;
var w = Array(80);
var a = 1732584193;
var b = -271733879;
var c = -1732584194;
var d = 271733878;
var e = -1009589776;
for(var i = 0; i < x.length; i += 16)
{
var olda = a;
var oldb = b;
var oldc = c;
var oldd = d;
var olde = e;
for(var j = 0; j < 80; j++)
{
if(j < 16) w[j] = x[i + j];
else w[j] = rol(w[j-3] ^ w[j-8] ^ w[j-14] ^ w[j-16], 1);
var t = safe_add(safe_add(rol(a, 5), sha1_ft(j, b, c, d)),
safe_add(safe_add(e, w[j]), sha1_kt(j)));
e = d;
d = c;
c = rol(b, 30);
b = a;
a = t;
}
a = safe_add(a, olda);
b = safe_add(b, oldb);
c = safe_add(c, oldc);
d = safe_add(d, oldd);
e = safe_add(e, olde);
}
return Array(a, b, c, d, e);
}
/*
* Perform the appropriate triplet combination function for the current
* iteration
*/
function sha1_ft(t, b, c, d)
{
if(t < 20) return (b & c) | ((~b) & d);
if(t < 40) return b ^ c ^ d;
if(t < 60) return (b & c) | (b & d) | (c & d);
return b ^ c ^ d;
}
/*
* Determine the appropriate additive constant for the current iteration
*/
function sha1_kt(t)
{
return (t < 20) ? 1518500249 : (t < 40) ? 1859775393 :
(t < 60) ? -1894007588 : -899497514;
}
/*
* Calculate the HMAC-SHA1 of a key and some data
*/
function core_hmac_sha1(key, data)
{
var bkey = str2binb(key);
if(bkey.length > 16) bkey = core_sha1(bkey, key.length * chrsz);
var ipad = Array(16), opad = Array(16);
for(var i = 0; i < 16; i++)
{
ipad[i] = bkey[i] ^ 0x36363636;
opad[i] = bkey[i] ^ 0x5C5C5C5C;
}
var hash = core_sha1(ipad.concat(str2binb(data)), 512 + data.length * chrsz);
return core_sha1(opad.concat(hash), 512 + 160);
}
/*
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
* to work around bugs in some JS interpreters.
*/
function safe_add(x, y)
{
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
}
/*
* Bitwise rotate a 32-bit number to the left.
*/
function rol(num, cnt)
{
return (num << cnt) | (num >>> (32 - cnt));
}
/*
* Convert an 8-bit or 16-bit string to an array of big-endian words
* In 8-bit function, characters >255 have their hi-byte silently ignored.
*/
function str2binb(str)
{
var bin = Array();
var mask = (1 << chrsz) - 1;
for(var i = 0; i < str.length * chrsz; i += chrsz)
bin[i>>5] |= (str.charCodeAt(i / chrsz) & mask) << (32 - chrsz - i%32);
return bin;
}
/*
* Convert an array of big-endian words to a string
*/
function binb2str(bin)
{
var str = "";
var mask = (1 << chrsz) - 1;
for(var i = 0; i < bin.length * 32; i += chrsz)
str += String.fromCharCode((bin[i>>5] >>> (32 - chrsz - i%32)) & mask);
return str;
}
/*
* Convert an array of big-endian words to a hex string.
*/
function binb2hex(binarray)
{
var hex_tab = hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
var str = "";
for(var i = 0; i < binarray.length * 4; i++)
{
str += hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8+4)) & 0xF) +
hex_tab.charAt((binarray[i>>2] >> ((3 - i%4)*8 )) & 0xF);
}
return str;
}
/*
* Convert an array of big-endian words to a base-64 string
*/
function binb2b64(binarray)
{
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var str = "";
for(var i = 0; i < binarray.length * 4; i += 3)
{
var triplet = (((binarray[i >> 2] >> 8 * (3 - i %4)) & 0xFF) << 16)
| (((binarray[i+1 >> 2] >> 8 * (3 - (i+1)%4)) & 0xFF) << 8 )
| ((binarray[i+2 >> 2] >> 8 * (3 - (i+2)%4)) & 0xFF);
for(var j = 0; j < 4; j++)
{
if(i * 8 + j * 6 > binarray.length * 32) str += b64pad;
else str += tab.charAt((triplet >> 6*(3-j)) & 0x3F);
}
}
return str;
}

View File

@ -0,0 +1,252 @@
#!/bin/sh
eval `dbus export kuainiao`
source /jffs/softcenter/scripts/base.sh
version="0.3.6"
kuainiaocru=$(cru l | grep "kuainiao")
startkuainiao=$(ls -l /jffs/softcenter/init.d/ | grep "S80Kuainiao")
app_version="2.0.3.4"
#双WAN判断
wans_mode=$(nvram get wans_mode)
if [ "$kuainiao_config_wan" == "1" ] && [ "$wans_mode" == "lb" ]; then
wan_selected=$(nvram get wan0_ipaddr)
if [ "$wan_selected" != "0.0.0.0" ]; then
bind_address=$wan_selected
else
bind_address=""
fi
elif [ "$kuainiao_config_wan" == "2" ] && [ "$wans_mode" == "lb" ]; then
wan_selected=$(nvram get wan1_ipaddr)
if [ "$wan_selected" != "0.0.0.0" ]; then
bind_address=$wan_selected
else
bind_address=""
fi
else
bind_address=""
fi
#定义请求函数
if [ -n "$bind_address" ]; then
HTTP_REQ="wget --bind-address=$bind_address --no-check-certificate -O - "
POST_ARG="--post-data="
else
HTTP_REQ="wget --no-check-certificate -O - "
POST_ARG="--post-data="
fi
#数据mock
uname=$kuainiao_config_uname
pwd=$kuainiao_config_pwd
devicesign=$kuainiao_device_sign
#获取用户真实MAC地址
get_mac_addr(){
if [ -n "$bind_address" ] && [ "$kuainiao_config_wan" == "1" ]; then
nic=wan0_hwaddr
elif [ -n "$bind_address" ] && [ "$kuainiao_config_wan" == "2" ]; then
nic=wan1_hwaddr
else
nic=wan_hwaddr
fi
peerid=$(nvram get $nic|awk 'gsub(/:/, "") {printf("%s", toupper($1))}')004V
}
get_mac_addr
#nic=eth0
#peerid=$(ifconfig $nic|grep $nic|awk 'gsub(/:/, "") {print $5}')004V
#转存参数
dbus set kuainiao_config_nic=$nic
dbus set kuainiao_config_peerid=$peerid
dbus set kuainiao_version=$version
dbus set kuainiao_app_version=$app_version
#获取迅雷用户uid
get_xunlei_uid(){
ret=`$HTTP_REQ --header "User-Agent: android-async-http/xl-acc-sdk/version-1.6.1.177600" https://login.mobile.reg2t.sandai.net:443/ $POST_ARG"{\"userName\": \""$uname"\", \"businessType\": 68, \"clientVersion\": \"2.0.3.4\", \"appName\": \"ANDROID-com.xunlei.vip.swjsq\", \"isCompressed\": 0, \"sequenceNo\": 1000001, \"sessionID\": \"\", \"loginType\": 0, \"rsaKey\": {\"e\": \"010001\", \"n\": \"AC69F5CCC8BDE47CD3D371603748378C9CFAD2938A6B021E0E191013975AD683F5CBF9ADE8BD7D46B4D2EC2D78AF146F1DD2D50DC51446BB8880B8CE88D476694DFC60594393BEEFAA16F5DBCEBE22F89D640F5336E42F587DC4AFEDEFEAC36CF007009CCCE5C1ACB4FF06FBA69802A8085C2C54BADD0597FC83E6870F1E36FD\"}, \"cmdID\": 1, \"verifyCode\": \"\", \"peerID\": \""$peerid"\", \"protocolVersion\": 108, \"platformVersion\": 1, \"passWord\": \""$pwd"\", \"extensionList\": \"\", \"verifyKey\": \"\", \"sdkVersion\": 177550, \"devicesign\": \""$devicesign"\"}"`
#判断是否登陆成功
session=`echo $ret|awk -F '"sessionID":' '{print $2}'|awk -F ',' '{print $1}'|grep -oE "[A-F,0-9]{32}"`
if [ -z "$session" ]
then
dbus set kuainiao_warning="迅雷账号登陆失败,请检查输入的用户名密码!"
#echo "迅雷账号登陆失败,请检查输入的用户名密码!"
else
uid=`echo $ret|awk -F '"userID":' '{print $2}'|awk -F ',' '{print $1}'`
dbus set kuainiao_config_uid=$uid
fi
}
#获取加速API
get_kuainiao_api(){
portal=`$HTTP_REQ http://api.portal.swjsq.vip.xunlei.com:81/v2/queryportal`
portal_ip=`echo $portal|grep -oE '([0-9]{1,3}[\.]){3}[0-9]{1,3}'`
portal_port_temp=`echo $portal|grep -oE "port...[0-9]{1,5}"`
portal_port=`echo $portal_port_temp|grep -oE '[0-9]{1,5}'`
if [ -z "$portal_ip" ]
then
dbus set kuainiao_warning="迅雷快鸟服务API获取失败请检查网络环境或稍后再试!"
#echo "迅雷快鸟服务API获取失败请检查网络环境或稍后再试!"
else
api_url="http://$portal_ip:$portal_port/v2"
dbus set kuainiao_config_api=$api_url
fi
}
#检测快鸟加速信息
get_bandwidth(){
if [ -n "$api_url" ]; then
band=$(bandwidth)
can_upgrade=`echo $band|awk -F '"can_upgrade":' '{print $2}'|awk -F ',' '{print $1}'`
dbus set kuainiao_can_upgrade=$can_upgrade
kuainiao_can_upgrade=$can_upgrade
dial_account=`echo $band|awk -F '"dial_account":' '{print $2}'|awk -F ',' '{print $1}'|grep -oE '[0-9]{1,20}'`
dbus set kuainiao_dial_account=$dial_account
kuainiao_dial_account=$dial_account
#判断是否满足加速条件
if [[ $can_upgrade -eq 1 ]]; then
#echo "迅雷快鸟可以加速~~~愉快的开始加速吧~~"
#获取加速详细信息
old_downstream=`echo $band|awk -F '"bandwidth":' '{print $2}'|awk -F '"downstream":' '{print $2}'|awk -F ',' '{print $1}'`
max_downstream=`echo $band|awk -F '"max_bandwidth":' '{print $2}'|awk -F '"downstream":' '{print $2}'|awk -F ',' '{print $1}'`
dbus set kuainiao_warning="迅雷快鸟可以加速~~~愉快的开始加速吧~~"
dbus set kuainiao_old_downstream=$old_downstream
dbus set kuainiao_max_downstream=$max_downstream
else
dbus set kuainiao_warning="T_T 不能加速啊,不满足加速条件哦~~"
#echo "T_T 不能加速啊,不满足加速条件哦~~"
fi
fi
}
#检测是否可以使用迅雷快鸟服务
check_kuainiao(){
portal=`$HTTP_REQ http://api.portal.swjsq.vip.xunlei.com:81/v2/queryportal`
portal_ip=`echo $portal|grep -oE '([0-9]{1,3}[\.]){3}[0-9]{1,3}'`
portal_port_temp=`echo $portal|grep -oE "port...[0-9]{1,5}"`
portal_port=`echo $portal_port_temp|grep -oE '[0-9]{1,5}'`
if [ -z "$portal_ip" ]
then
#export kuainiao_warning="迅雷快鸟服务API获取失败请检查网络环境或稍后再试!"
echo "迅雷快鸟服务API获取失败请检查网络环境或稍后再试!"
else
api_url="http://$portal_ip:$portal_port/v2"
#开始尝试加速
res=`$HTTP_REQ "$api_url/upgrade?peerid=$peerid&userid=$uid&user_type=1&sessionid=$session"`
#echo $res
errno=`echo $res|awk -F '"errno":' '{print $2}'|awk -F ',' '{print $1}'`
#判断是否加速成功(errno=812的时候为:当前宽带已处于提速状态)
if [ -n "$errno" ]
then
richmessage=`echo $res|awk -F '"richmessage":' '{print $2}'|awk -F ',' '{print $1}'|awk '{sub(/^"*/,"");sub(/"*$/,"")}1'`
#export kuainiao_warning=$richmessage
echo $richmessage
else
downstream=`echo $ret|awk -F '"downstream":' '{print $2}'|awk -F ',' '{print $1}'`
upstream=`echo $ret|awk -F '"upstream":' '{print $2}'|awk -F ',' '{print $1}'`
fi
fi
}
#检测试用加速信息
query_try_info(){
info=`$HTTP_REQ "$api_url/query_try_info?peerid=$peerid&userid=$uid&user_type=1&sessionid=$session"`
echo $info
}
##{"errno":0,"message":"","number_of_try":0,"richmessage":"","sequence":0,"timestamp":1455936922,"try_duration":10}
#检测提速带宽
bandwidth(){
_ts=`date +%s`000
width=`$HTTP_REQ "$api_url/bandwidth?peerid=$peerid&userid=$uid&user_type=1&sessionid=$session&dial_account=$dial_account&client_type=android-swjsq-$app_version&client_version=androidswjsq-$app_version&os=android-5.0.1.24SmallRice&time_and=$_ts"`
echo $width
}
##{"bandwidth":{"downstream":51200,"upstream":0},"can_upgrade":1,"dial_account":"100001318645","errno":0,"max_bandwidth":{"downstream":102400,"upstream":0},"message":"","province":"bei_jing","province_name":"北京","richmessage":"","sequence":0,"sp":"cnc","sp_name":"联通","timestamp":1455936922}
#迅雷快鸟加速心跳
kuainiao_keepalive(){
_ts=`date +%s`000
keepalive=`$HTTP_REQ "$api_url/keepalive?peerid=$peerid&userid=$uid&user_type=1&sessionid=$session&dial_account=$dial_account&client_type=android-swjsq-$app_version&client_version=androidswjsq-$app_version&os=android-5.0.1.24SmallRice&time_and=$_ts"`
echo $keepalive
}
#快鸟加速注销
kuainiao_recover(){
_ts=`date +%s`000
recover=`$HTTP_REQ "$api_url/recover?peerid=$peerid&userid=$uid&user_type=1&sessionid=$session&dial_account=$dial_account&client_type=android-swjsq-$app_version&client_version=androidswjsq-$app_version&os=android-5.0.1.24SmallRice&time_and=$_ts"`
echo $recover
}
#将执行脚本写入crontab定时运行
add_kuainiao_cru(){
if [ "$kuainiao_can_upgrade" == "1" ] && [ -f /jffs/softcenter/kuainiao/kuainiao.sh ]; then
#确保有执行权限
chmod +x /jffs/softcenter/kuainiao/kuainiao.sh
cru a kuainiao "*/4 * * * * /jffs/softcenter/kuainiao/kuainiao.sh"
fi
}
#加入开机自动运行
auto_start(){
if [ "$kuainiao_can_upgrade" == "1" ] && [ "$kuainiao_start" == "1" ] && [ -f /jffs/softcenter/kuainiao/kuainiao.sh ]; then
if [ -f /jffs/softcenter/init.d/S80Kuainiao.sh ]; then
rm -rf /jffs/softcenter/init.d/S80Kuainiao.sh
fi
cat > /jffs/softcenter/init.d/S80Kuainiao.sh <<EOF
#!/bin/sh
cru a kuainiao "*/4 * * * * /jffs/softcenter/kuainiao/kuainiao.sh"
dbus ram kuainiao_run_i=6
sh /jffs/softcenter/kuainiao/kuainiao.sh
EOF
chmod +x /jffs/softcenter/init.d/S80Kuainiao.sh
fi
}
#停止快鸟服务
stop_kuainiao(){
#停掉cru里的任务
if [ ! -z "$kuainiaocru" ]; then
cru d kuainiao
fi
#停止自启动
if [ -f /jffs/softcenter/init.d/S80Kuainiao.sh ]; then
rm -rf /jffs/softcenter/init.d/S80Kuainiao.sh
fi
#清理运行环境临时变量
dbus remove kuainiao_run_i
dbus ram kuainiao_run_warnning=""
dbus ram kuainiao_run_status=0
dbus remove kuainiao_run_orig_day
dbus remove kuainiao_run_session
}
##主逻辑
#执行初始化
dbus set kuainiao_warning=""
dbus set kuainiao_can_upgrade=0
stop_kuainiao
if [ "$kuainiao_enable" == "1" ]; then
#登陆迅雷获取uid
get_xunlei_uid
#判断是否登陆成功
if [ -n "$uid" ]; then
get_kuainiao_api
get_bandwidth
dbus set kuainiao_config_downstream=$(expr $old_downstream / 1024)
dbus set kuainiao_config_max_downstream=$(expr $max_downstream / 1024)
#写入crontab
add_kuainiao_cru
#开机执行
auto_start
#开始初始化执行
sleep $kuainiao_time
#判断cru脚本是否正在执行
kuainiao_is_run=$(ps|grep '/jffs/softcenter/kuainiao/kuainiao.sh'|grep -v grep)
if [ ! -z "$kuainiao_is_run" ]; then
sleep 5
fi
dbus ram kuainiao_run_i=6
sh /jffs/softcenter/kuainiao/kuainiao.sh
fi
fi

View File

@ -0,0 +1,374 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta HTTP-EQUIV="Pragma" CONTENT="no-cache"/>
<meta HTTP-EQUIV="Expires" CONTENT="-1"/>
<link rel="shortcut icon" href="images/favicon.png"/>
<link rel="icon" href="images/favicon.png"/>
<title>软件中心 - 迅雷快鸟设置</title>
<link rel="stylesheet" type="text/css" href="index_style.css"/>
<link rel="stylesheet" type="text/css" href="form_style.css"/>
<link rel="stylesheet" type="text/css" href="usp_style.css"/>
<link rel="stylesheet" type="text/css" href="ParentalControl.css">
<link rel="stylesheet" type="text/css" href="css/icon.css">
<link rel="stylesheet" type="text/css" href="css/element.css">
<script type="text/javascript" src="/state.js"></script>
<script type="text/javascript" src="/popup.js"></script>
<script type="text/javascript" src="/help.js"></script>
<script type="text/javascript" src="/validator.js"></script>
<script type="text/javascript" src="/js/jquery.js"></script>
<script type="text/javascript" src="/general.js"></script>
<script type="text/javascript" src="/switcherplugin/jquery.iphone-switch.js"></script>
<script type="text/javascript" src="/dbconf?p=kuainiao_&v=<% uptime(); %>"></script>
<script type="text/javascript" src="/res/rsa.js"></script>
<script type="text/javascript" src="/res/md5.js"></script>
<script type="text/javascript" src="/res/sha1.js"></script>
<script type="text/javascript">
function init() {
show_menu(menu_hook);
buildswitch();
var rrt = document.getElementById("switch");
if (document.form.kuainiao_enable.value != "1") {
rrt.checked = false;
document.getElementById('Kuainiao_detail_table').style.display = "none";
} else {
rrt.checked = true;
document.getElementById('Kuainiao_detail_table').style.display = "";
}
//双wan开始判断
var lb_mode = '<% nvram_get("wans_mode"); %>';
if(lb_mode !== "lb"){
document.getElementById('double_wan_set').style.display = "none";
document.getElementById('select_wan').style.display = "none";
document.form.kuainiao_config_wan.value = 0;
} else {
check_selected("kuainiao_config_wan", db_kuainiao_.kuainiao_config_wan);
}
//conf2obj();
//var conf_ajax = setInterval("conf2obj();", 60000);
version_show();
write_kuainiao_install_status();
check_selected("kuainiao_start", db_kuainiao_.kuainiao_start);
check_selected("kuainiao_time", db_kuainiao_.kuainiao_time);
}
//生成设备id
var wan_mac = '<% nvram_get("wan_hwaddr"); %>';
var fake_device_id = md5(wan_mac);
var device_sign = "div100."+fake_device_id+md5(hex_sha1(fake_device_id+"com.xunlei.vip.swjsq68700d1872b772946a6940e4b51827e8af"));
var kn = '00AC69F5CCC8BDE47CD3D371603748378C9CFAD2938A6B021E0E191013975AD683F5CBF9ADE8BD7D46B4D2EC2D78AF146F1DD2D50DC51446BB8880B8CE88D476694DFC60594393BEEFAA16F5DBCEBE22F89D640F5336E42F587DC4AFEDEFEAC36CF007009CCCE5C1ACB4FF06FBA69802A8085C2C54BADD0597FC83E6870F1E36FD';
var ke = '010001';
var rsa = new RSAKey();
rsa.setPublic(kn, ke);
function onSubmitCtrl() {
//开始赋值
var pwd = $("#kuainiao_config_old_pwd").val();
var encrypted_pwd = rsa.encrypt(md5(pwd));
$("#kuainiao_config_pwd").val(encrypted_pwd.toUpperCase());
$("#kuainiao_device_sign").val(device_sign);
//防止变为更新操作
$("#kuainiao_update_check").val(0);
showLoading(9);
document.form.submit();
setTimeout("conf2obj()", 8000);
}
function pass_checked(obj){
switchType(obj, document.form.show_pass.checked, true);
}
function conf2obj() {
$.ajax({
type: "get",
url: "dbconf?p=kuainiao_",
dataType: "script",
success: function(xhr) {
var p = "kuainiao_";
var params = ["warning","can_upgrade", "run_status", "run_warnning"];
for (var i = 0; i < params.length; i++) {
if (typeof db_kuainiao_[p + params[i]] !== "undefined") {
$("#kuainiao_"+params[i]).val(db_kuainiao_[p + params[i]]);
}
}
update_visibility();
check_selected("kuainiao_start", db_kuainiao_.kuainiao_start);
check_selected("kuainiao_time", db_kuainiao_.kuainiao_time);
check_downstream(parseInt(db_kuainiao_.kuainiao_config_downstream), parseInt(db_kuainiao_.kuainiao_config_max_downstream), db_kuainiao_.kuainiao_run_status);
}
});
}
function buildswitch(){
$("#switch").click(
function(){
if(document.getElementById('switch').checked){
document.form.kuainiao_enable.value = 1;
document.getElementById('Kuainiao_detail_table').style.display = "";
}else{
document.form.kuainiao_enable.value = 0;
document.getElementById('Kuainiao_detail_table').style.display = "none";
}
});
}
function update_visibility() {
//不满足快鸟条件的显示异常信息
if ($("#kuainiao_can_upgrade").val() == "0") {
$("#warn").html($("#kuainiao_warning").val());
showhide("warn", ($("#kuainiao_can_upgrade").val() == "0"));
}
$("#warn").html($("#kuainiao_warning").val());
showhide("warn", ($("#kuainiao_can_upgrade").val() == "0"));
//给出快鸟运行状态
$("#kn_state2").html($("#kuainiao_run_warnning").val());
}
function check_selected(obj, m) {
var o = document.getElementById(obj);
for (var c = 0; c < o.length; c++) {
if (o.options[c].value == m) {
o.options[c].selected = true;
break;
}
}
}
function check_downstream(old, max, state) {
if (max > 0 && max > old && state == "1") {
$("#kn_upgreade_state").html("宽带已从"+old+"M提速到"+max+"M");
} else {
if (+old) {
$("#kn_upgreade_state").html("当前默认宽带为:"+old+"M,快鸟可以提速到:"+max+"M");
} else {
$("#kn_upgreade_state").html("");
}
}
}
function write_kuainiao_install_status(){
$.ajax({
type: "get",
url: "dbconf?p=kuainiao_",
dataType: "script",
success: function() {
//尝试合并函数
var p = "kuainiao_";
var params = ["warning","can_upgrade", "run_status", "run_warnning"];
for (var i = 0; i < params.length; i++) {
if (typeof db_kuainiao_[p + params[i]] !== "undefined") {
$("#kuainiao_"+params[i]).val(db_kuainiao_[p + params[i]]);
}
}
update_visibility();
//check_selected("kuainiao_start", db_kuainiao_.kuainiao_start);
//check_selected("kuainiao_time", db_kuainiao_.kuainiao_time);
check_downstream(parseInt(db_kuainiao_.kuainiao_config_downstream), parseInt(db_kuainiao_.kuainiao_config_max_downstream), db_kuainiao_.kuainiao_run_status);
setTimeout("write_kuainiao_install_status()", 10000);
}
});
}
function version_show(){
$("#kuainiao_version_status").html("<i>当前版本:" + db_kuainiao_['kuainiao_version']);
$.ajax({
url: 'https://raw.githubusercontent.com/paldier/softcenter/master/kuainiao/config.json.js',
type: 'GET',
success: function(res) {
var txt = $(res.responseText).text();
if(typeof(txt) != "undefined" && txt.length > 0) {
//console.log(txt);
var obj = $.parseJSON(txt.replace("'", "\""));
$("#kuainiao_version_status").html("<i>当前版本:" + obj.version);
if(obj.version != db_adm_["adm_version"]) {
$("#kuainiao_version_status").html("<i>有新版本:" + obj.version);
}
}
}
});
}
function done_validating(action) {
return true;
}
function reload_Soft_Center() {
location.href = "/Main_Soft_center.asp";
}
function menu_hook(title, tab) {
tabtitle[tabtitle.length -1] = new Array("", "迅雷快鸟");
tablink[tablink.length -1] = new Array("", "Module_kuainiao.asp");
}
</script>
</head>
<body onload="init();">
<div id="TopBanner"></div>
<div id="Loading" class="popup_bg"></div>
<iframe name="hidden_frame" id="hidden_frame" src="" width="0" height="0" frameborder="0"></iframe>
<form method="post" name="form" action="/applydb.cgi?p=kuainiao_" target="hidden_frame">
<input type="hidden" name="current_page" value="Module_kuainiao.asp"/>
<input type="hidden" name="next_page" value="Module_kuainiao.asp"/>
<input type="hidden" name="group_id" value=""/>
<input type="hidden" name="modified" value="0"/>
<input type="hidden" name="action_mode" value=" Refresh "/>
<input type="hidden" name="action_script" value="kuainiao_config.sh"/>
<input type="hidden" name="action_wait" value="5"/>
<input type="hidden" name="first_time" value=""/>
<input type="hidden" name="preferred_lang" id="preferred_lang" value="<% nvram_get("preferred_lang"); %>"/>
<input type="hidden" name="firmver" value="<% nvram_get("firmver"); %>"/>
<input type="hidden" id="kuainiao_config_pwd" name="kuainiao_config_pwd" value='<% dbus_get_def("kuainiao_config_pwd", ""); %>'/>
<input type="hidden" id="kuainiao_warning" name="kuainiao_warning" value='<% dbus_get_def("kuainiao_warning", ""); %>'/>
<input type="hidden" id="kuainiao_enable" name="kuainiao_enable" value='<% dbus_get_def("kuainiao_enable", "0"); %>'/>
<input type="hidden" id="kuainiao_can_upgrade" name="kuainiao_can_upgrade" value='<% dbus_get_def("kuainiao_can_upgrade", "0"); %>'/>
<input type="hidden" id="kuainiao_run_status" name="kuainiao_run_status" value='<% dbus_get_def("kuainiao_run_status", "0"); %>'/>
<input type="hidden" id="kuainiao_run_warnning" name="kuainiao_run_warnning" value='<% dbus_get_def("kuainiao_run_warnning", ""); %>'/>
<input type="hidden" id="kuainiao_device_sign" name="kuainiao_device_sign" value='<% dbus_get_def("kuainiao_device_sign", ""); %>'/>
<table class="content" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="17">&nbsp;</td>
<td valign="top" width="202">
<div id="mainMenu"></div>
<div id="subMenu"></div>
</td>
<td valign="top">
<div id="tabMenu" class="submenuBlock"></div>
<table width="98%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
<td align="left" valign="top">
<table width="760px" border="0" cellpadding="5" cellspacing="0" bordercolor="#6b8fa3" class="FormTitle" id="FormTitle">
<tr>
<td bgcolor="#4D595D" colspan="3" valign="top">
<div>&nbsp;</div>
<div style="float:left;" class="formfonttitle">迅雷快鸟</div>
<div style="float:right; width:15px; height:25px;margin-top:10px"><img id="return_btn" onclick="reload_Soft_Center();" align="right" style="cursor:pointer;position:absolute;margin-left:-30px;margin-top:-25px;" title="返回软件中心" src="/images/backprev.png" onMouseOver="this.src='/images/backprevclick.png'" onMouseOut="this.src='/images/backprev.png'"></img></div>
<div style="margin-left:5px;margin-top:10px;margin-bottom:10px"><img src="/images/New_ui/export/line_export.png"></div>
<div class="formfontdesc" style="padding-top:5px;margin-top:0px;float: left;" id="cmdDesc">迅雷快鸟加速服务带宽平均提升5倍最高可达100M</div>
<div class="formfontdesc" id="cmdDesc"></div>
<table style="margin:10px 0px 0px 0px;" width="100%" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#6b8fa3" class="FormTable" id="routing_table">
<thead>
<tr>
<td colspan="2">开关设置</td>
</tr>
</thead>
<tr>
<th>开启快鸟加速</th>
<td colspan="2">
<div class="switch_field" style="display:table-cell;float: left;">
<label for="switch">
<input id="switch" class="switch" type="checkbox" style="display: none;">
<div class="switch_container" >
<div class="switch_bar"></div>
<div class="switch_circle transition_style">
<div></div>
</div>
</div>
</label>
</div>
<div id="kuainiao_version_status" style="padding-top:5px;margin-left:230px;margin-top:0px;">
<i>当前版本:<% dbus_get_def("kuainiao_version", "未知"); %></i>
</div>
</td>
</tr>
</table>
<table style="margin:10px 0px 0px 0px;" width="100%" border="1" align="center" cellpadding="4" cellspacing="0" bordercolor="#6b8fa3" class="FormTable" id="Kuainiao_detail_table">
<thead>
<tr>
<td colspan="2">基本设置</td>
</tr>
</thead>
<tr>
<th width="35%">迅雷用户名</th>
<td>
<input type="text" class="input_ss_table" style="width:auto;" size="30" id="kuainiao_config_uname" name="kuainiao_config_uname" maxlength="20" placeholder="迅雷用户名" value='<% dbus_get_def("kuainiao_config_uname", ""); %>' >
</td>
</tr>
<tr>
<th width="35%">密码</th>
<td>
<input type="password" class="input_ss_table" style="width:auto;" size="20" id="kuainiao_config_old_pwd" name="kuainiao_config_old_pwd" maxlength="30" placeholder="迅雷密码" value='<% dbus_get_def("kuainiao_config_old_pwd", ""); %>' />
<div style="margin-left:170px;margin-top:-20px;margin-bottom:0px"><input type="checkbox" name="show_pass" onclick="pass_checked(document.form.kuainiao_config_old_pwd);">显示密码</div>
</td>
</tr>
<thead>
<tr>
<td colspan="3">运行状态</td>
</tr>
</thead>
<tr>
<th width="35%">快鸟状态</th>
<td>
<a>
<span style="display: none" id="kn_state1">尚未启用! </span>
<span id="kn_state2"></span>
</a>
</td>
</tr>
<tr>
<th width="35%">提速状态</th>
<td>
<a>
<span id="kn_upgreade_state"></span>
</a>
</td>
</tr>
<thead>
<tr>
<td colspan="4">启动设置</td>
</tr>
</thead>
<tr>
<th width="35%">开机自启</th>
<td>
<select id="kuainiao_start" name="kuainiao_start" class="input_option" >
<option value="1">是</option>
<option value="0">否</option>
</select>
</td>
</tr>
<tr>
<th width="35%">启动延时</th>
<td>
<select id="kuainiao_time" name="kuainiao_time" class="input_option" >
<option value="1">1S</option>
<option value="5">5S</option>
<option value="10">10S</option>
</select>
</td>
</tr>
<thead id="double_wan_set">
<tr>
<td colspan="4">双WAN设置</td>
</tr>
</thead>
<tr id="select_wan">
<th width="35%">加速WAN口</th>
<td>
<select id="kuainiao_config_wan" name="kuainiao_config_wan" class="input_option" >
<option value="1">WAN1</option>
<option value="2">WAN2</option>
</select>
</td>
</tr>
</table>
<div id="warn" style="display: none;margin-top: 20px;text-align: center;font-size: 20px;margin-bottom: 20px;"class="formfontdesc" ></div>
<div class="apply_gen">
<button id="cmdBtn" class="button_gen" onclick="onSubmitCtrl()">提交</button>
</div>
<div style="margin-left:5px;margin-top:10px;margin-bottom:10px"><img src="/images/New_ui/export/line_export.png"></div>
<div class="KoolshareBottom">
<br/>论坛技术支持: <a href="http://www.koolshare.cn" target="_blank"> <i><u>www.koolshare.cn</u></i> </a> <br/>
后台技术支持: <i>Xiaobao</i> <br/>
Shell, Web by <i>wangchll</i><br/>
<br/>修改版 by <i>paldier</i>
</div>
</td>
</tr>
</table>
</td>
<td width="10" align="center" valign="top"></td>
</tr>
</table>
</td>
</tr>
</table>
</form>
<div id="footer"></div>
</body>
</html>

2
kuainiao/version Normal file
View File

@ -0,0 +1,2 @@
0.3.6
915e63000cbf3a98887930b04aa874ec

View File

@ -21,15 +21,35 @@
"version": "2.2" "version": "2.2"
}, },
{ {
"build_date": "2019-01-13_00:10:53", "build_date": "2019-01-13_02:08:34",
"description": "去广告,没烦恼", "description": "去广告,没烦恼",
"home_url": "Module_koolproxy.asp", "home_url": "Module_koolproxy.asp",
"md5": "42c61e110449a52a19b76931d432df7a", "md5": "1ad5b05d424832237b00028327e9a90e",
"name": "koolproxy", "name": "koolproxy",
"tar_url": "koolproxy/koolproxy.tar.gz", "tar_url": "koolproxy/koolproxy.tar.gz",
"title": "koolproxy", "title": "koolproxy",
"version": "3.8.4" "version": "3.8.4"
}, },
{
"build_date": "2019-01-13_14:01:15",
"description": "迅雷快鸟,为上网加速而生~",
"home_url": "Module_kuainiao.asp",
"md5": "915e63000cbf3a98887930b04aa874ec",
"name": "kuainiao",
"tar_url": "kuainiao/kuainiao.tar.gz",
"title": "讯雷快鸟",
"version": "0.3.6"
},
{
"build_date": "2019-01-13_14:31:33",
"description": "linux下载利器",
"home_url": "Module_aria2.asp",
"md5": "cdd0a74446c977528b6c0bd39f6d85bb",
"name": "aria2",
"tar_url": "aria2/aria2.tar.gz",
"title": "Aria2",
"version": "2.4"
},
{ {
"build_date": "2018-12-06_13:29:29", "build_date": "2018-12-06_13:29:29",
"description": "kms", "description": "kms",
@ -52,7 +72,7 @@
} }
], ],
"home_url": "https://raw.githubusercontent.com/paldier/softcenter/master", "home_url": "https://raw.githubusercontent.com/paldier/softcenter/master",
"md5": "51b7d9cc5d6af10bc8979ca078c1a8fd", "md5": "ad166b845c7885b7c5a18f2ce6514886",
"tar_url": "softcenter/softcenter.tar.gz", "tar_url": "softcenter/softcenter.tar.gz",
"version": "1.1.6" "version": "1.1.6"
} }

View File

@ -1,4 +1,4 @@
{ {
"version":"1.1.6", "version":"1.1.6",
"md5":"51b7d9cc5d6af10bc8979ca078c1a8fd" "md5":"ad166b845c7885b7c5a18f2ce6514886"
} }

View File

@ -31,7 +31,7 @@ def work_paths_by_walk():
print os.path.join(root,sub) print os.path.join(root,sub)
def work_parent(): def work_parent():
ignore_paths = frozenset(["maintain_files", "softcenter", "v2ray", "adbyby", "ddnspod", "gdddns", "kuainiao", "shadowsocks"]) ignore_paths = frozenset(["maintain_files", "softcenter", "v2ray", "adbyby", "ddnspod", "gdddns", "shadowsocks"])
for fname in os.listdir(parent_path): for fname in os.listdir(parent_path):
if fname[0] == "." or fname in ignore_paths: if fname[0] == "." or fname in ignore_paths:

View File

@ -1,5 +1,5 @@
{ {
"title":"<em>梅林改版固件&nbsp;-&nbsp;软件中心</em>", "title":"<em>梅林固件&nbsp;-&nbsp;软件中心</em>",
"content1":"<b>软件中心测试版2018年12月6日</b>", "content1":"<b>软件中心测试版2018年12月6日</b>",
"content2":"原软件中心暂时保留且用法不变;", "content2":"原软件中心暂时保留且用法不变;",
"content3":"新软件中心暂时不要启用和原软件中心冲突的插件", "content3":"新软件中心暂时不要启用和原软件中心冲突的插件",

Binary file not shown.

View File

@ -0,0 +1,77 @@
#!/bin/sh
# By Koolshare
ACTION=$1
kservice() {
local ssd
local exec
local name
local start
ssd="${SERVICE_DEBUG:+echo }start-stop-daemon${SERVICE_QUIET:+ -q}"
case "$1" in
-C)
ssd="$ssd -K -t"
;;
-S)
ssd="$ssd -S${SERVICE_DAEMONIZE:+ -b}${SERVICE_WRITE_PID:+ -m}"
start=1
;;
-K)
ssd="$ssd -K${SERVICE_SIG:+ -s $SERVICE_SIG}"
;;
*)
echo "kservice: unknown ACTION '$1'" 1>&2
return 1
esac
shift
exec="$1"
[ -n "$exec" ] || {
echo "kservice: missing argument" 1>&2
return 1
}
[ -x "$exec" ] || {
echo "kservice: file '$exec' is not executable" 1>&2
return 1
}
name="${SERVICE_NAME:-${exec##*/}}"
[ -z "$SERVICE_USE_PID$SERVICE_WRITE_PID$SERVICE_PID_FILE" ] \
|| ssd="$ssd -p ${SERVICE_PID_FILE:-/var/run/$name.pid}"
[ -z "$SERVICE_MATCH_NAME" ] || ssd="$ssd -n $name"
ssd="$ssd${SERVICE_UID:+ -c $SERVICE_UID${SERVICE_GID:+:$SERVICE_GID}}"
[ -z "$SERVICE_MATCH_EXEC$start" ] || ssd="$ssd -x $exec"
shift
$ssd${1:+ -- "$@"}
}
kservice_check() {
kservice -C "$@"
}
kservice_signal() {
SERVICE_SIG="${SERVICE_SIG:-USR1}" kservice -K "$@"
}
kservice_start() {
kservice -S "$@"
}
kservice_stop() {
local try
SERVICE_SIG="${SERVICE_SIG:-$SERVICE_SIG_STOP}" kservice -K "$@" || return 1
while [ $((try++)) -lt $SERVICE_STOP_TIME ]; do
kservice -C "$@" || return 0
sleep 1
done
SERVICE_SIG="KILL" kservice -K "$@"
sleep 1
! kservice -C "$@"
}
kservice_reload() {
SERVICE_SIG="${SERVICE_SIG:-$SERVICE_SIG_RELOAD}" kservice -K "$@"
}
export PATH=$PATH:/jffs/softcenter/bin:/jffs/softcenter/scripts:/bin:/usr/bin:/sbin:/usr/sbin:/home/admin:/opt/sbin:/opt/bin:/opt/usr/sbin:/opt/usr/bin
#logger "Leaving ${0##*/}."

View File

@ -0,0 +1,24 @@
#!/bin/sh
case $ACTION in
start)
service_start $PROCS $ARGS
;;
stop | kill )
service_stop $PROCS
;;
restart)
service_stop $PROCS
service_start $PROCS $ARGS
;;
check)
service_check $PROCS
;;
reconfigure)
service_reload $PROCS $ARGS
;;
*)
echo "Usage: $0 (start|stop|restart|check|kill|reconfigure)"
exit 1
;;
esac

View File

@ -1,2 +1,2 @@
1.1.6 1.1.6
51b7d9cc5d6af10bc8979ca078c1a8fd ad166b845c7885b7c5a18f2ce6514886

View File

@ -233,7 +233,7 @@
</style> </style>
<script type="text/javascript"> <script type="text/javascript">
function init() { function init() {
show_menu(); show_menu(menu_hook);
var testStatus = <% dbus_get_def("speedtest_status", "0"); %>; var testStatus = <% dbus_get_def("speedtest_status", "0"); %>;
if (+testStatus === 1) { if (+testStatus === 1) {
$("#cmdBtn").attr("disabled", true); $("#cmdBtn").attr("disabled", true);
@ -384,6 +384,10 @@
function done_validating(action) { function done_validating(action) {
return true; return true;
} }
function menu_hook(title, tab) {
tabtitle[tabtitle.length -1] = new Array("", "speedtest");
tablink[tablink.length -1] = new Array("", "Module_speedtest.asp");
}
</script> </script>
</head> </head>
<body onload="init();"> <body onload="init();">

View File

@ -48,7 +48,7 @@
</style> </style>
<script> <script>
function init() { function init() {
show_menu(); show_menu(menu_hook);
write_usb_status(); write_usb_status();
check_usb(); check_usb();
setTimeout("write_usb_status()", 200); setTimeout("write_usb_status()", 200);
@ -217,6 +217,10 @@ function hideSSLoadingBar(){
function reload_Soft_Center(){ function reload_Soft_Center(){
location.href = "/Main_Soft_center.asp"; location.href = "/Main_Soft_center.asp";
} }
function menu_hook(title, tab) {
tabtitle[tabtitle.length -1] = new Array("", "speedtest");
tablink[tablink.length -1] = new Array("", "Module_speedtest.asp");
}
</script> </script>
</head> </head>
<body onload="init();"> <body onload="init();">