Skip to content

Commit

Permalink
v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
everstu committed Jun 17, 2023
0 parents commit 12c42d6
Show file tree
Hide file tree
Showing 15 changed files with 1,278 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
*.tar.gz
10 changes: 10 additions & 0 deletions Changelog.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
KoolCenter RustDesk Server Changelog
===========================================

1.0
- add rustdesk_server二进v1.1.7版本(armv7版本,采用upx --lzma --best压缩)
- add 使用perp实时启动进程并守护
- add 新增了帮助界面,鼠标移动到左侧栏文字即可见
- add 可设置强制使用加密方式
- add 可配置hbbs服务器端口

54 changes: 54 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# RustDesk 远程控制

## 是什么?
`RustDesk是一款优秀的免费开源的远程控制软件,适合所有人的虚拟/远程桌面基础设施! 开源 TeamViewer / Citrix 替代品。`


## 项目地址
https://github.com/rustdesk/rustdesk

## 官方信息

官网地址:https://rustdesk.com/

官方Github:https://github.com/rustdesk/rustdesk

官网文档 https://rustdesk.com/docs/zh-cn/

---

## 机型支持

在asuswrt为基础的固件上,Rustdesk Server插件目前仅支持如下架构的路由器:

- 部分及其未列出,请根据CPU型号和支持软件中心与否自行判断
- 使用Rustdesk Server建议配置1G及以上的虚拟内存,特别是小内存的路由器

| 机型 | 内存 | CPU/SOC | 架构 | 核心 | 频率 | 支持alist插件 |
| ---------------- | ----- | ------- | ----- | ---- | ------- | ------------- |
| RT-AC86U | 512MB | BCM4906 | armv8 | 2 | 1.8 GHz | ✔️ |
| GT-AC2900 | 512MB | BCM4906 | armv8 | 2 | 1.8 GHz | ✔️ |
| RT-AX92U | 512MB | BCM4906 | armv8 | 2 | 1.8 GHz | ✔️ |
| GT-AC5300 | 1GB | BCM4908 | armv8 | 4 | 1.8 GHz | ✔️ |
| RT-AX88U | 1GB | BCM4908 | armv8 | 4 | 1.8 GHz | ✔️ |
| GT-AX11000 | 1GB | BCM4908 | armv8 | 4 | 1.8 GHz | ✔️ |
| NetGear RAX80 | 1GB | BCM4908 | armv8 | 4 | 1.8 GHz | ✔️ |
| RT-AX68U | 512MB | BCM4906 | armv8 | 2 | 1.8 GHz | ✔️ |
| RT-AX86U | 1GB | BCM4908 | armv8 | 4 | 1.8 GHz | ✔️ |
| GT-AXE11000 | 1GB | BCM4908 | armv8 | 4 | 1.8 GHz | ✔️ |
| ZenWiFi_Pro_XT12 | 1GB | BCM4912 | armv8 | 4 | 2.0GHz | ✔️ |
| GT-AX6000 | 1GB | BCM4912 | armv8 | 4 | 2.0GHz | ✔️ |
| GT-AX11000_PRO | 1GB | BCM4912 | armv8 | 4 | 2.0GHz | ✔️ |
| RT-AX86U_PRO | 1GB | BCM4912 | armv8 | 4 | 2.0GHz | ✔️ |
| RAX50 | 512MB | BCM6750 | armv7 | 3 | 1.5 GHz | ✔️ |
| RAX70 | 512MB | BCM6755 | armv7 | 4 | 1.5 GHz | ✔️ |
| RT-AX56U | 512MB | BCM6755 | armv7 | 4 | 1.5 GHz | ✔️ |
| RT-AX56U_V2 | 256MB | BCM6755 | armv7 | 4 | 1.5 GHz | ✔️ |
| RT-AX58U | 512MB | BCM6750 | armv7 | 3 | 1.5 GHz | ✔️ |
| RT-AX82U | 512MB | BCM6750 | armv7 | 3 | 1.5 GHz | ✔️ |
| TUF-AX3000 | 512MB | BCM6750 | armv7 | 3 | 1.5 GHz | ✔️ |
| TUF-AX5400 | 512MB | BCM6750 | armv7 | 3 | 1.5 GHz | ✔️ |
| ZenWiFi_XT8 | 512MB | BCM6755 | armv7 | 4 | 1.5 GHz | ✔️ |
| ZenWiFi_XD4 | 256MB | BCM6755 | armv7 | 4 | 1.5 GHz | ✔️ |
| TUF-AX3000_V2 | 512MB | BCM6756 | armv7 | 4 | 1.7GHz | ✔️ |
| RT-AX57 | 256MB | BCM6756 | armv7 | 4 | 1.7GHz | ✔️ |
65 changes: 65 additions & 0 deletions build.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#!/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 not found,build.py is root path. auto write 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 file format is incorrect"
traceback.print_exc()
if "module" not in conf:
print u" module is not in config.json.js"
return
module_path = os.path.join(parent_path, conf["module"])
if not os.path.isdir(module_path):
print u"not found %s dir,check config.json.js is module ?" % module_path
return
install_path = os.path.join(parent_path, conf["module"], "install.sh")
if not os.path.isfile(install_path):
print u"not found %s file,check install.sh file"
return
print u"build..."

open(parent_path + "/" + conf["module"] + "/" +"version", "w").write(conf["version"])

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"build done", 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()

11 changes: 11 additions & 0 deletions config.json.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"author": "fiswonder",
"description": "RustDesk是一款优秀的免费开源的远程控制软件,此插件提供RustDesk自建服务器功能。",
"home_url": "Module_rustdesk.asp",
"link": "https://github.com/everstu/Koolcenter_rustdesk",
"md5": "88d9bd9e93f31fe0ea4a90ee992a8d77",
"module": "rustdesk",
"tags": "穿透",
"title": "RustDesk Server",
"version": "1.0"
}
2 changes: 2 additions & 0 deletions rustdesk/.valid
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
hnd
mtk
Binary file added rustdesk/bin/hbbr
Binary file not shown.
Binary file added rustdesk/bin/hbbs
Binary file not shown.
Binary file added rustdesk/bin/rustdesk-utils
Binary file not shown.
186 changes: 186 additions & 0 deletions rustdesk/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
#!/bin/sh
source /koolshare/scripts/base.sh
alias echo_date='echo 【$(TZ=UTC-8 date -R +%Y年%m月%d日\ %X)】:'
MODEL=
FW_TYPE_CODE=
FW_TYPE_NAME=
DIR=$(cd $(dirname $0); pwd)
module=${DIR##*/}

get_model(){
local ODMPID=$(nvram get odmpid)
local PRODUCTID=$(nvram get productid)
if [ -n "${ODMPID}" ];then
MODEL="${ODMPID}"
else
MODEL="${PRODUCTID}"
fi
}

get_fw_type() {
local KS_TAG=$(nvram get extendno|grep -Eo "kool.+")
if [ -d "/koolshare" ];then
if [ -n "${KS_TAG}" ];then
FW_TYPE_CODE="2"
FW_TYPE_NAME="${KS_TAG}官改固件"
else
FW_TYPE_CODE="4"
FW_TYPE_NAME="koolshare梅林改版固件"
fi
else
if [ "$(uname -o|grep Merlin)" ];then
FW_TYPE_CODE="3"
FW_TYPE_NAME="梅林原版固件"
else
FW_TYPE_CODE="1"
FW_TYPE_NAME="华硕官方固件"
fi
fi
}

platform_test(){
local LINUX_VER=$(uname -r|awk -F"." '{print $1$2}')
local ARCH=$(uname -m)
if [ -d "/koolshare" -a -f "/usr/bin/skipd" -a "${LINUX_VER}" -ge "41" ];then
echo_date 机型:"${MODEL} ${FW_TYPE_NAME} 符合安装要求,开始安装插件!"
else
exit_install 1
fi
}

set_skin(){
local UI_TYPE=ASUSWRT
local SC_SKIN=$(nvram get sc_skin)
local ROG_FLAG=$(grep -o "680516" /www/form_style.css|head -n1)
local TUF_FLAG=$(grep -o "D0982C" /www/form_style.css|head -n1)
if [ -n "${ROG_FLAG}" ];then
UI_TYPE="ROG"
fi
if [ -n "${TUF_FLAG}" ];then
UI_TYPE="TUF"
fi

if [ -z "${SC_SKIN}" -o "${SC_SKIN}" != "${UI_TYPE}" ];then
echo_date "安装${UI_TYPE}皮肤!"
nvram set sc_skin="${UI_TYPE}"
nvram commit
fi
}

exit_install(){
local state=$1
case $state in
1)
echo_date "本插件适用于【koolshare 梅林改/官改 hnd/axhnd/axhnd.675x】固件平台!"
echo_date "你的固件平台不能安装!!!"
echo_date "本插件支持机型/平台:https://github.com/koolshare/rogsoft#rogsoft"
echo_date "退出安装!"
rm -rf /tmp/rustdesk* >/dev/null 2>&1
exit 1
;;
0|*)
rm -rf /tmp/rustdesk* >/dev/null 2>&1
exit 0
;;
esac
}

dbus_nset(){
# set key when value not exist
local ret=$(dbus get $1)
if [ -z "${ret}" ];then
dbus set $1=$2
fi
}


install_now() {
# default value
local TITLE="RustDesk Server"
local DESCR="RustDesk是一款优秀的免费开源的远程控制软件,此插件提供RustDesk自建服务器功能。"
local PLVER=$(cat ${DIR}/version)

# 生成默认目录
if [ ! -d /koolshare/configs/rustdesk ];then
mkdir -p /koolshare/configs/rustdesk
fi

# stop signdog first
enable=$(dbus get rustdesk_enable)
if [ "${enable}" == "1" ];then
echo_date "先关闭RustDesk插件!以保证更新成功!"
sh /koolshare/scripts/rustdesk_config.sh stop
fi

# remove some files first
find /koolshare/init.d/ -name "*rustdesk*" | xargs rm -rf

# isntall file
echo_date "安装插件相关文件..."
cp -rf /tmp/${module}/bin/* /koolshare/bin/
cp -rf /tmp/${module}/res/* /koolshare/res/
cp -rf /tmp/${module}/scripts/* /koolshare/scripts/
cp -rf /tmp/${module}/webs/* /koolshare/webs/
cp -rf /tmp/${module}/uninstall.sh /koolshare/scripts/uninstall_${module}.sh
mkdir -p /koolshare/configs/rustdesk

#创建开机自启任务
[ ! -L "/koolshare/init.d/S99rustdesk.sh" ] && ln -sf /koolshare/scripts/rustdesk_config.sh /koolshare/init.d/S99rustdesk.sh
[ ! -L "/koolshare/init.d/N99rustdesk.sh" ] && ln -sf /koolshare/scripts/rustdesk_config.sh /koolshare/init.d/N99rustdesk.sh

# Permissions
chmod +x /koolshare/scripts/* >/dev/null 2>&1
chmod +x /koolshare/bin/hbbr >/dev/null 2>&1
chmod +x /koolshare/bin/hbbs >/dev/null 2>&1
chmod +x /koolshare/bin/rustdesk-utils >/dev/null 2>&1

# dbus value
echo_date "设置插件默认参数..."
dbus set ${module}_version="${PLVER}"
dbus set softcenter_module_${module}_version="${PLVER}"
dbus set softcenter_module_${module}_install="1"
dbus set softcenter_module_${module}_name="${module}"
dbus set softcenter_module_${module}_title="${TITLE}"
dbus set softcenter_module_${module}_description="${DESCR}"

# 获取安装包二进制
local rustdesk_hbbr_version=$(echo $(/koolshare/bin/hbbr --version) |awk '{print $2}');
local rustdesk_hbbs_version=$(echo $(/koolshare/bin/hbbs --version) |awk '{print $2}');

# 检查插件默认dbus值
dbus_nset rustdesk_hbbs_port "21116"
dbus_nset rustdesk_hbbr_port "21117"
dbus_nset rustdesk_is_encrypted "0"
dbus_nset rustdesk_hbbr_version "$rustdesk_hbbr_version"
dbus_nset rustdesk_hbbs_version "$rustdesk_hbbs_version"

# 设置证书信息
/koolshare/bin/rustdesk-utils genkeypair |awk '{print $3}' > /tmp/upload/rustdesk_key_cert.tmp
local rustdesk_key_pub=$(cat /tmp/upload/rustdesk_key_cert.tmp |awk 'FNR == 1')
local rustdesk_key_priv=$(cat /tmp/upload/rustdesk_key_cert.tmp |awk 'FNR == 2')
# 写入证书
echo $rustdesk_key_pub > /koolshare/configs/rustdesk/id_ed25519.pub
echo $rustdesk_key_priv > /koolshare/configs/rustdesk/id_ed25519
# 设置证书
dbus_nset rustdesk_key_pub "$rustdesk_key_pub"
dbus_nset rustdesk_key_priv "$rustdesk_key_priv"

# reenable
if [ "${enable}" == "1" ];then
echo_date "重新启动RustDesk插件!"
sh /koolshare/scripts/rustdesk_config.sh boot_up
fi

# finish
echo_date "${TITLE}插件安装完毕!"
exit_install
}

install() {
get_model
get_fw_type
platform_test
install_now
}

install
Binary file added rustdesk/res/icon-rustdesk.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 12c42d6

Please sign in to comment.