# scan-port **Repository Path**: andnnl/scan-port ## Basic Information - **Project Name**: scan-port - **Description**: 高性能端口扫描工具,基于 Rust 和 tokio 异步运行时实现。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-01-20 - **Last Updated**: 2026-01-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: Rust ## README # scan-port 高性能端口扫描工具,基于 Rust 和 tokio 异步运行时实现。 ## 特性 - 🚀 **高性能**:使用 tokio 异步运行时,支持高并发扫描 - ⚡ **快速扫描**:可在 4.5 秒内完成全端口(1-65535)扫描 - 🎯 **灵活配置**:支持自定义 IP 地址、端口范围、并发数和超时时间 - 💾 **内存优化**:使用 Arc 智能指针,避免不必要的内存拷贝 - 🔧 **命令行友好**:使用 clap 提供详细的帮助信息和参数说明 ## 性能 | 端口范围 | 并发数 | 超时 | 耗时 | |---------|--------|------|------| | 1-100 | 400 | 10ms | ~0.5s | | 1-1024 | 400 | 10ms | ~1.5s | | 1-65535 | 400 | 10ms | ~4.5s | ## 安装 ### 从源码编译 ```bash git clone https://gitee.com/andnnl/scan-port.git cd scan-port cargo build --release ``` 编译后的可执行文件位于 `target/release/scan-port.exe`。 ## 使用方法 ### 基本用法 ```bash # 扫描本地全端口(默认配置) scan-port.exe # 扫描指定 IP 的全端口 scan-port.exe --ip 192.168.1.1 # 扫描特定端口范围 scan-port.exe --start 80 --end 443 # 自定义并发数和超时时间 scan-port.exe --ip 192.168.1.1 --concurrency 500 --timeout 10 ``` ### 参数说明 | 参数 | 短选项 | 说明 | 默认值 | |------|--------|------|--------| | `--ip` | `-i` | 目标 IP 地址 | 127.0.0.1 | | `--start` | `-s` | 起始端口 | 1 | | `--end` | `-e` | 结束端口 | 65535 | | `--concurrency` | `-c` | 并发连接数 | 400 | | `--timeout` | `-t` | 连接超时时间(毫秒) | 10 | | `--help` | `-h` | 显示帮助信息 | - | | `--version` | `-V` | 显示版本信息 | - | ### 示例 ```bash # 查看帮助信息 scan-port.exe --help # 扫描本地常用端口 scan-port.exe --start 1 --end 1024 # 扫描远程服务器,提高并发数 scan-port.exe --ip 192.168.1.100 --concurrency 1000 --timeout 5 # 快速扫描(降低超时时间) scan-port.exe --ip 192.168.1.1 --timeout 5 ``` ## 技术实现 - **异步运行时**:使用 tokio 提供高效的异步 I/O - **并发控制**:使用 Semaphore 控制并发连接数 - **内存优化**:使用 Arc 包装 IP 地址,避免字符串克隆 - **命令行解析**:使用 clap 提供友好的命令行界面 ## 依赖 - tokio 1.42+ - 异步运行时 - clap 4.5+ - 命令行参数解析 - futures 0.3+ - 异步工具库 ## 许可证 本项目采用 MIT 许可证。 ## 作者 iFlow CLI