Slashas632/goPort
GitHub: Slashas632/goPort
一款基于 Go 的高并发 TCP/UDP 端口扫描器,支持 banner grabbing、UDP 协议探测与 Lua 插件扩展。
Stars: 2 | Forks: 0
# 🔍 goPort
一个使用 Go 编写的快速、并发端口扫描器。支持 TCP banner grabbing 以及带有特定协议探测的 UDP 服务检测。
## 功能
- **TCP 扫描** – 连接并获取服务 banner(SSH、HTTP、FTP、SMTP 等)
- **UDP 扫描** – 使用特定协议的探测进行精确的服务检测
- **并发** – 采用 worker pool 架构实现高速扫描
- **速率限制** – 内置速率限制器以避免网络泛洪
- **Banner grabbing** – 自动检测服务版本
- **插件系统** – 使用 Lua 脚本扩展功能
- **Json 导出** - 将结果导出为 .json 格式
## 安装
### Arch Linux (AUR)
```
yay -S goport
```
### 🐧 Linux / macOS(通过源码)
```
git clone https://github.com/Slashas632/goPort
cd goPort
go build -o goPort ./cmd/app
```
### 🪟 Windows(通过源码)
```
git clone https://github.com/Slashas632/goPort
cd goPort
go build -o goPort.exe ./cmd/app
```
## 用法
### 🐧 Linux / macOS
```
# 通过 AUR 安装或添加到 PATH
goPort [flags]
# 从源码构建
./goPort [flags]
```
### 🪟 Windows
```
# 从源码构建
.\goPort.exe [flags]
```
### 参数标志
| 参数标志 | 默认值 | 描述 |
|------|---------|-------------|
| `-tcp` | false | 启用 TCP 扫描 |
| `-udp` | false | 启用 UDP 扫描 |
| `-ip` | 127.0.0.1 | 目标 IP 地址 |
| `-p` | 65535 | 端口或端口范围(例如 `80` 或 `0-65535`) |
| `-w` | 500 | worker 数量 |
| `-install` | – | 安装 Lua 插件 |
| `-uninstall` | – | 卸载 Lua 插件 |
| `-json` | - | 将结果导出为 json |
### 示例
**🐧 Linux / macOS**
```
# 扫描 TCP 常用端口
goPort -tcp -ip 10.0.0.1 -p 0-1024
# 扫描所有 UDP 端口
goPort -udp -ip 10.0.0.1 -p 0-65535
# TCP + UDP 完整扫描
goPort -tcp -udp -ip 10.0.0.1 -p 0-65535
# 自定义 worker 数量
goPort -tcp -ip 10.0.0.1 -p 0-65535 -w 500
# 导出为 json
goPort -tcp -ip 10.0.0.1 -p 0-65535 -json output.json
```
**🪟 Windows**
```
# 扫描 TCP 常用端口
.\goPort.exe -tcp -ip 10.0.0.1 -p 0-1024
# 扫描所有 UDP 端口
.\goPort.exe -udp -ip 10.0.0.1 -p 0-65535
# TCP + UDP 完整扫描
.\goPort.exe -tcp -udp -ip 10.0.0.1 -p 0-65535
# 自定义 worker 数量
.\goPort.exe -tcp -ip 10.0.0.1 -p 0-65535 -w 500
# 导出为 json
.\goPort.exe -tcp -ip 10.0.0.1 -p 0-65535 -json output.json
```
### 示例输出
```
STATUS IP PORT BANNER
────────────────────────────────────────────────────────────────────────────────
[OPEN] 10.0.0.1 22 SSH-2.0-OpenSSH_9.2p1 Debian-2+deb12u3
[OPEN] 10.0.0.1 25 220 mail.example.com ESMTP Postfix
[OPEN] 10.0.0.1 53 DNS
[OPEN] 10.0.0.1 80 HTTP/1.1 200 OK
[OPEN] 10.0.0.1 110 +OK Dovecot ready
[OPEN] 10.0.0.1 143 * OK Dovecot ready
Work finished.
```
## 🔌 插件系统
插件是在每个端口扫描完成后运行的 Lua 脚本。它们接收 IP、端口和 banner 作为参数。
### 插件结构
```
function scan(ip, port, banner)
if string.find(banner, "SSH") then
print("[SSH] " .. ip .. ":" .. port .. " -> " .. banner)
end
end
```
### 安装插件
**🐧 Linux / macOS**
```
goPort -install /home/user/myplugin.lua
goPort -install ~/myplugin.lua
```
**🪟 Windows**
```
.\goPort.exe -install C:\Users\user\myplugin.lua
.\goPort.exe -install .\myplugin.lua
```
### 卸载插件
**🐧 Linux / macOS**
```
goPort -uninstall myplugin.lua
```
**🪟 Windows**
```
.\goPort.exe -uninstall myplugin.lua
```
### 插件存储位置
插件存储在:
- **Linux / macOS:** `~/.goPort/plugins/`
- **Windows:** `C:\Users\\.goPort\plugins\`
### 示例插件
```
-- Detects common services and prints alerts
function scan(ip, port, banner)
if string.find(banner, "SSH") then
print("[SSH] " .. ip .. ":" .. port .. " -> " .. banner)
end
if string.find(banner, "HTTP") then
print("[HTTP] " .. ip .. ":" .. port .. " -> " .. banner)
end
if string.find(banner, "220") then
print("[SMTP] " .. ip .. ":" .. port .. " -> " .. banner)
end
end
```
## UDP 探测
扫描器使用特定协议的 payload 进行精确的 UDP 检测:
| 端口 | 协议 |
|------|----------|
| 53 | DNS |
| 69 | TFTP |
| 111 | RPC |
| 123 | NTP |
| 137 | NetBIOS |
| 161 | SNMP |
| 443 | QUIC |
| 500 | IKE/VPN |
| 514 | Syslog |
| 1900 | SSDP/UPnP |
| 5353 | mDNS |
| 11211 | Memcached |
| 27015 | Steam |
| 51820 | WireGuard |
未知端口会回退到通用探测(NULL、CRLF、HELLO)。
## 项目结构
```
goPort/
├── cmd/
│ └── app/
│ └── main.go
└── internal/
├── output/
| └── json.go
├── cli/
│ └── args.go
├── display/
│ └── table.go
├── plugins/
│ ├── manager.go
│ └── runner.go
├── protocols/
│ ├── TCP/
│ │ └── TCP.go
│ └── UDP/
│ ├── UDP.go
│ └── udp_probes.go
├── ratelimit/
│ └── ratelimit.go
└── scanner/
└── engine.go
```
## ⚠️ 法律免责声明
本工具旨在用于您拥有或获得明确授权扫描的网络和系统。未经授权的端口扫描在您所在的司法管辖区可能是违法的。
## 许可证
MIT
标签:Banner抓取, EVTX分析, Go, Groq, Lua插件, rizin, Ruby工具, 并发扫描, 插件系统, 数据统计, 日志审计, 端口扫描, 网络安全, 隐私保护