threatvec/portx
GitHub: threatvec/portx
一个基于Go实现的轻量级异步TCP端口扫描器,支持服务识别和横幅抓取。
Stars: 0 | Forks: 0
# PortX
[](https://go.dev)
[](https://github.com/threatvec/portx)
[](LICENSE)
[](https://github.com/threatvec/portx)
[](https://github.com/threatvec)
**快速、轻量级端口扫描器** -- 支持服务检测和横幅抓取的异步 TCP 端口扫描。
```
_____ _ __ __
| __ \ | | \ \ / /
| |__) |__ _ __| |_ \ V /
| ___/ _ \| '__| __| > <
| | | (_) | | | |_ / . \
|_| \___/|_| \__/_/ \_\
```
## 功能特性
| 功能 | 描述 |
|---------|-------------|
| 异步扫描 | 使用 Goroutine 工作池进行快速并发扫描 |
| 常用端口 | 前 100 个知名端口及服务名称 |
| 自定义端口 | 扫描指定端口或端口范围 |
| 服务检测 | 自动识别已知端口的服务名称 |
| 横幅抓取 | 读取开放端口的初始响应 |
| 可配置 | 超时时间、线程数、端口选择 |
| 彩色输出 | 开放端口显示绿色,表格格式整洁 |
| JSON 输出 | 机器可读的 JSON 格式,便于脚本处理 |
| 进度条 | 实时进度指示器 |
| 零配置 | 开箱即用,默认配置合理 |
## 安装
### 从源码安装
```
git clone https://github.com/threatvec/portx.git
cd portx
go build -o portx.exe .
```
### Go 安装
```
go install github.com/threatvec/portx@latest
```
## 使用方法
```
# 扫描常用端口(前100个)
portx google.com
# 扫描特定端口范围
portx 192.168.1.1 -p 1-1000
# 扫描特定端口
portx 10.0.0.1 -p 80,443,8080
# 扫描所有65535个端口
portx google.com --all
# JSON 输出(管道友好)
portx google.com --json
# 自定义超时时间(500毫秒)
portx google.com -t 500
# 自定义线程数(200并发)
portx google.com --threads 200
# 禁用横幅抓取以提升速度
portx google.com --no-banner
# 组合选项
portx 10.0.0.1 -p 1-10000 --threads 200 -t 500 --json
```
## 输出示例
```
[TARGET]
--------
Host: google.com
IP Address: 142.250.187.206
Ports Scanned: 100
Scan Duration: 1.23s
[OPEN PORTS] (3 found)
-------------------------
PORT STATE SERVICE BANNER
-------- ------ ------------------ ----------------------------------------
80/tcp open HTTP HTTP/1.0 200 OK...
443/tcp open HTTPS
8080/tcp open HTTP-Proxy
```
## 命令行参数
| 参数 | 简写 | 默认值 | 描述 |
|------|-----|---------|-------------|
| `--ports` | `-p` | common | 要扫描的端口(例如 `80,443` 或 `1-1000`) |
| `--all` | | false | 扫描所有 65535 个端口 |
| `--json` | | false | 以 JSON 格式输出结果 |
| `--timeout` | `-t` | 1000 | 连接超时时间(毫秒) |
| `--threads` | | 100 | 并发扫描线程数 |
| `--no-banner` | | false | 禁用横幅抓取 |
## 项目结构
```
portx/
├── main.go # Entry point
├── go.mod # Go module definition
├── cmd/
│ └── root.go # Cobra CLI root command
├── internal/
│ ├── scanner/
│ │ ├── scanner.go # Port scanning engine with goroutines
│ │ ├── ports.go # Common ports map (port -> service name)
│ │ └── banner.go # Banner grabbing
│ ├── report/
│ │ ├── terminal.go # Colored table output
│ │ └── json.go # JSON output
│ └── signature/
│ └── signature.go # Author credits & verification
├── LICENSE # Proprietary license
└── README.md # This file
```
## 工作原理
1. **端口解析** -- 确定要扫描的端口(常用、范围、特定或全部)
2. **工作池** -- 生成 Goroutine(默认 100 个),从通道中消费端口任务
3. **TCP 连接** -- 每个工作线程尝试使用 `net.DialTimeout` 连接目标端口
4. **横幅抓取** -- 对于开放端口,读取最多 1024 字节的初始响应
5. **结果收集** -- 通过通道收集结果,按端口排序后显示
## 运行环境要求
- Go 1.21 或更高版本
- 能够访问目标主机的网络
## 作者
**talkdedsec** 和 **threatvec**
- GitHub: [@threatvec](https://github.com/threatvec)
## 许可证
专有软件。详见 [LICENSE](LICENSE)。
版权所有 (c) 2026 talkdedsec & threatvec。保留所有权利。
标签:Banner抓取, EVTX分析, Go, Golang, Maven构建, network scanner, pentest, port scanner, Ruby工具, TCP扫描, 安全编程, 密码管理, 异步扫描, 插件系统, 数据统计, 日志审计, 服务检测, 端口扫描, 网络发现, 网络安全, 网络工具, 隐私保护