fsckyn3o2/port-scanner
GitHub: fsckyn3o2/port-scanner
一款用 C 语言实现的高性能多线程端口扫描器,支持 TCP/SYN/UDP 多种扫描方式和主机发现功能,用于网络安全分析与服务发现。
Stars: 2 | Forks: 0
# 端口扫描器
一个使用 C 语言编写的高性能端口扫描器,用于网络安全分析和服务发现。
## 🚀 主要特性
### 扫描能力
- TCP Connect 扫描(默认)
- SYN 扫描(需要 root 权限)
- UDP 扫描(需要 root 权限)
- 可自定义的超时和重试
### 发现功能
- 通过 ping 扫描进行网络枚举
- 使用 ARP 进行本地网络发现
- 多种发现模式
- 可配置的超时设置
### 性能
- 多线程扫描
- 可调整的线程数量
- 进度跟踪
- 速率限制支持
### 目标支持
- 单主机扫描
- 多主机(以逗号分隔)
- CIDR 表示法
- 目标文件输入
### 端口选择
- 单个端口
- 端口范围(例如,1-1000)
- 自定义列表(例如,22,80,443)
- 模式支持(偶数、奇数、*/N)
- 端口排除
### 输出选项
- 纯文本(默认)
- JSON 格式
- CSV 格式
- 文件输出
- 可选的关闭端口显示
## 📋 前置条件
- C 编译器(推荐使用 gcc)
- CMake (3.31+)
- Make(可选)
## 🛠️ 构建
### 使用 CMake(推荐)
```
mkdir build
cd build
cmake ..
cmake --build .
```
### 使用 Make
```
make
```
## 📖 用法
### 基本语法
```
./portscanner [options]
```
### 目标指定
- 单主机:`./portscanner example.com 80`
- 多主机:`./portscanner "host1.com,host2.com" 80`
- CIDR 表示法:`./portscanner 192.168.1.0/24 80`
### 端口指定
- 单个端口:`80`
- 端口范围:`1-1000`
- 端口列表:`22,80,443`
- 混合格式:`22,80-90,443`
### 常用选项
```
--output-format # Output format
--output-file # Save to file
--show-closed # Show closed ports
--threads # Thread count
--no-dns # Disable DNS resolution
--reverse-dns # Enable reverse DNS
```
### 高级选项
```
--scan-type # Scanning method
--timeout # Connection timeout
--retries <1-5> # Retry attempts
--discovery-mode # Host discovery method
```
## 📝 示例
### 基础扫描
```
# 基础 TCP 扫描
./portscanner example.com 80,443
# 带 threads 的范围扫描
./portscanner example.com 1-1000 --threads 4
# 多 host 及 JSON 输出
./portscanner "host1.com,host2.com" 80,443 --output-format json
```
### 高级扫描
```
# 带自定义 timeout 的 SYN 扫描
sudo ./portscanner example.com 1-1000 \
--scan-type syn \
--timeout 1500 \
--threads 8
# 带 discovery 的网络范围
./portscanner 192.168.1.0/24 22 \
--discovery-mode both \
--output-format json \
--output-file results.json
```
## 🔍 输出格式
### 纯文本
```
Scanning example.com (ports 80-443)
PORT STATUS SERVICE
80 open http
443 open https
```
### JSON
```
{
"host": "example.com",
"ports": [
{"port": 80, "status": "open", "service": "http"},
{"port": 443, "status": "open", "service": "https"}
]
}
```
### CSV
```
Host,Port,Status,Service
example.com,80,open,http
example.com,443,open,https
```
## 📚 文档
有关详细文档,请参阅 `man portscanner`。
## 🤝 贡献
欢迎贡献!请随时提交 pull request。
## 📄 许可证
MIT License - 可根据需要自由使用和修改。
标签:API安全, ARP扫描, Bash脚本, CIDR, CMake, CSV输出, Groq, JSON输出, Nmap替代, Ping扫描, SYN扫描, TCP扫描, 事件追踪, 内核驱动, 域名解析, 套接字编程, 客户端加密, 开源安全工具, 插件系统, 攻击路径可视化, 数据统计, 无线安全, 服务发现, 漏洞赏金平台, 端口扫描, 系统分析, 网络分析, 网络协议, 网络安全, 网络工具, 网络枚举, 自然语言处理, 逆向工程平台, 防御绕过, 隐私保护, 黑客工具