# remote-command-system **Repository Path**: tecnnt/remote-command-system ## Basic Information - **Project Name**: remote-command-system - **Description**: 用于openclaw等AI智能管家执行远程电脑 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-04-02 - **Last Updated**: 2026-04-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 远程命令执行系统 一套安全、可靠的远程命令执行解决方案,支持权限控制、状态检测和虚拟组网。 ## 系统架构 ``` ┌─────────────────┐ ZeroTier 虚拟网络 ┌─────────────────┐ │ 服务端 │ ◄───────────────────────────────── │ 客户端 │ │ (公网/内网) │ WebSocket 长连接(客户端主动) │ (内网 only) │ │ 开放端口 │ │ 不开放端口 │ └─────────────────┘ └─────────────────┘ ``` ## 核心特性 | 特性 | 说明 | |------|------| | **连接方向** | 客户端主动连接服务端,解决客户端无公网IP问题 | | **权限控制** | 客户端本地维护白名单,服务端只发指令,不控制权限 | | **状态检测** | WebSocket 连接状态即在线状态,配合心跳机制 | | **安全性** | 即使服务端被攻破,也无法执行客户端禁止的指令 | ## 安全性设计 ### 为什么权限控制在客户端更安全? 1. **零信任架构**:服务端只负责转发指令,不决定指令是否可以执行 2. **纵深防御**:即使服务端被攻破,攻击者也无法执行客户端禁止的命令 3. **最小权限**:客户端只开放必要的命令执行权限 4. **本地决策**:权限判断在客户端本地完成,不依赖网络传输 ### 安全建议 1. **使用虚拟组网**:通过 ZeroTier/Tailscale 等工具建立私有网络 2. **强 Token 认证**:使用随机生成的强密码作为认证令牌 3. **限制命令范围**:只开放必要的只读命令,避免危险操作 4. **定期审计**:定期检查权限规则和命令执行日志 ## 快速开始 ### 服务端部署 ```bash cd server pip install -r requirements.txt python server.py --ws-port 8765 --http-port 8781 ``` 启动后会显示认证 Token,请妥善保存。 ### Windows 客户端部署(最简单) ```batch cd client :: 1. 复制配置文件 copy config.ini.example config.ini :: 2. 编辑配置文件(填写服务端地址和 Token) notepad config.ini :: 3. 双击运行 start-windows.bat ``` 首次运行会自动创建虚拟环境并安装依赖。 ### Linux/macOS 客户端部署 ```bash cd client pip install -r requirements.txt python client.py --server ws://服务端IP:8765 --token YOUR_TOKEN ``` ### 使用 Web 管理界面 打开浏览器访问 `http://服务端IP:8781/static/index.html` ## 详细文档 - [服务端部署指南](docs/server-deployment.md) - [客户端部署指南](docs/client-deployment.md) - [权限配置说明](docs/permissions.md) - [ZeroTier 组网指南](docs/zerotier-setup.md) - [API 文档](docs/api.md) ## 目录结构 ``` remote-command-system/ ├── server/ │ ├── server.py # 服务端主程序 │ ├── requirements.txt # Python 依赖 │ └── static/ │ └── index.html # Web 管理界面 ├── client/ │ ├── client.py # 客户端主程序 │ ├── requirements.txt # Python 依赖 │ ├── config.ini.example # 配置文件示例 │ ├── start-windows.bat # Windows 一键启动 │ ├── setup-autostart-windows.bat # Windows 开机自启配置 │ └── build-exe-windows.bat # Windows EXE 打包 ├── docs/ # 文档目录 └── README.md # 本文件 ``` ## 许可证 MIT License