# SSH连接检测 **Repository Path**: liumou_site/ssh-connection-detection ## Basic Information - **Project Name**: SSH连接检测 - **Description**: 使用go语言实现的SSH服务连接批量检测工具,实现对范围内的主机使用统一的账号密码进行连接验证 - **Primary Language**: Go - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-05-21 - **Last Updated**: 2025-06-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # SSH连接检测工具 一个基于 Go 和 Vue3 开发的 SSH 连接检测工具,可以快速扫描指定网段内的 SSH 服务器,检测连接状态和 sudo 权限。 ## 功能特点 - 🚀 快速扫描:支持并发检测,提高扫描效率 - 🔍 网段扫描:支持 CIDR 格式的网段扫描 - 🔐 认证检测:支持 SSH 用户名密码认证 - ⚡ 实时进度:实时显示扫描进度和状态 - 📊 结果展示:清晰展示检测结果,支持状态筛选 - 📥 数据导出:支持将结果导出为 CSV 格式 - �� 响应式设计:支持移动端访问 ## 快速开始 ### 方式一:直接运行 1. 下载最新版本: ```bash ### Windows 平台 ```bash # 下载Windows版本(X86_64) curl -L -o ssh-detector.exe https://gitee.com/liumou_site/ssh-connection-detection/releases/download/v1.0.1/com.liumou.ssh-detector_windows-X86_64.exe # 运行程序 ssh-detector.exe -web ``` ### Linux 平台 (X86_64) ```bash # 下载Linux版本(X86_64) curl -L -o ssh-detector https://gitee.com/liumou_site/ssh-connection-detection/releases/download/v1.0.1/com.liumou.ssh-detector_linux-X86_64 chmod +x ssh-detector # 运行程序 ./ssh-detector -web ``` ### Linux 平台 (ARM64) ```bash # 下载Linux版本(ARM64) curl -L -o ssh-detector https://gitee.com/liumou_site/ssh-connection-detection/releases/download/v1.0.1/com.liumou.ssh-detector_linux-ARM64 chmod +x ssh-detector # 运行程序 ./ssh-detector -web ``` ### macOS 平台 (X86_64) ```bash # 下载macOS版本(X86_64) curl -L -o ssh-detector https://gitee.com/liumou_site/ssh-connection-detection/releases/download/v1.0.1/com.liumou.ssh-detector_darwin-X86_64 chmod +x ssh-detector # 运行程序 ./ssh-detector -web ``` ### macOS 平台 (ARM64) ```bash # 下载macOS版本(ARM64) curl -L -o ssh-detector https://gitee.com/liumou_site/ssh-connection-detection/releases/download/v1.0.1/com.liumou.ssh-detector_darwin-ARM64 chmod +x ssh-detector # 运行程序 ./ssh-detector -web ``` 2. 运行程序: ```bash # Windows ssh-detector.exe -web # Linux ./ssh-detector -web ``` 3. 访问 Web 界面: - 打开浏览器访问 `http://localhost:8080` - 输入要扫描的网段(CIDR 格式,如:192.168.1.0/24) - 设置 SSH 端口(默认 22) - 输入 SSH 用户名和密码 - 点击"开始检测"按钮 ### 方式二:Docker 部署 1. 拉取镜像: ```bash docker pull ccr.ccs.tencentyun.com/liumou/ssh-detector ``` 2. 运行容器: ```bash docker run -d -p 8084:8080 --name ssh-detector ccr.ccs.tencentyun.com/liumou/ssh-detector ``` 效果如下 ```shell root@Debian12:~# docker run -tid -p 8084:8080 ccr.ccs.tencentyun.com/liumou/ssh-detector Unable to find image 'ccr.ccs.tencentyun.com/liumou/ssh-detector:latest' locally latest: Pulling from liumou/ssh-detector f18232174bc9: Already exists 9a6ae1ef7514: Pull complete 8fc2005c0b65: Pull complete 726bc28ba4e6: Pull complete Digest: sha256:7b402f603d2ce6091f0fbce8b92d3d3c068b353e3e3fccf407d655da0ef2007f Status: Downloaded newer image for ccr.ccs.tencentyun.com/liumou/ssh-detector:latest 6f880a59640962fae56cc5e89d2583349005101fabbf996a7e8fe37ee37fe9ff root@Debian12:~# docker ps | grep ssh 6f880a596409 ccr.ccs.tencentyun.com/liumou/ssh-detector "/app/ssh-detector -…" 8 seconds ago Up 7 seconds 0.0.0.0:8084->8080/tcp, [::]:8084->8080/tcp gallant_goldwasser root@Debian12:~# ``` 3. 访问 Web 界面: - 打开浏览器访问 `http://localhost:8080`,如果指定的端口不是8080则使用对应的端口 - 使用方式与直接运行相同 # 效果 ## 扫描中 ![扫描中](./image/loading.png) ## 扫描完成 ![扫描完成](./image/res1.png) ![扫描完成](./image/res2.png) ## 配置说明 - 默认监听地址:`:8080` - 并发扫描数:10 - SSH 连接超时:5 秒 ## 注意事项 1. 请确保有足够的权限进行 SSH 连接检测 2. 建议在内部网络环境中使用 3. 注意保护 SSH 凭据的安全性 4. 大量 IP 扫描可能会触发防火墙规则 ## 开发者文档 ### 技术栈 #### 后端 - Go 1.21+ - Gin Web 框架 - SSH 客户端库 - SSE (Server-Sent Events) #### 前端 - Vue 3 - TypeScript - Vite - Bootstrap 5 ### 开发环境要求 - Go 1.21 或更高版本 - Node.js 16 或更高版本 - pnpm 包管理器 - Docker(可选) ### 本地开发 1. 克隆项目: ```bash git clone https://github.com/yourusername/ssh-connection-detection.git cd ssh-connection-detection ``` 2. 前端开发: ```bash cd WEB pnpm install pnpm dev ``` 3. 后端开发: ```bash go mod download go run main.go # 安装最新稳定版(需要 Go 1.16+) go install github.com/go-swagger/go-swagger/cmd/swagger@latest go install github.com/swaggo/swag/cmd/swag@latest # 验证安装 swagger version ``` ### 构建发布 1. 构建前端: ```bash cd WEB pnpm install pnpm build ``` 2. 构建二进制: ```bash # Windows go build -o ssh-detector-windows-amd64.exe # Linux GOOS=linux GOARCH=amd64 go build -o ssh-detector-linux-amd64 ``` 3. 构建 Docker 镜像: ```bash docker build -t ccr.ccs.tencentyun.com/liumou/ssh-detector . ``` ## 贡献指南 1. Fork 本仓库 2. 创建特性分支:`git checkout -b feature/your-feature` 3. 提交更改:`git commit -am 'Add some feature'` 4. 推送到分支:`git push origin feature/your-feature` 5. 提交 Pull Request ## 许可证 MIT License ## 作者 [坐公交也用券](https://liumou.site) ## 更新日志 ### v1.0.0 (2024-03-xx) - 初始版本发布 - 支持基本的 SSH 连接检测 - 实现实时进度显示 - 添加结果导出功能