Skip to content

Commit 486accb

Browse files
committed
feat(build): 添加多版本构建支持
- 添加 no_local build tag,支持排除本地插件编译 - goreleaser 配置新增三个版本:fscan/fscan-nolocal/fscan-web - 更新 README 添加 v2.1.0 完整更新日志 版本说明: - fscan: 标准版,包含全部插件 - fscan-nolocal: 精简版,不含本地模块(体积更小) - fscan-web: WebUI版,带Web管理界面 平台支持:Linux/Windows/macOS × x64/x32/arm64
1 parent 1be499b commit 486accb

24 files changed

Lines changed: 297 additions & 25 deletions

.github/conf/.goreleaser.yml

Lines changed: 86 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ before:
88
- bash .github/scripts/build-lite.sh {{ .Version }}
99

1010
builds:
11+
# 标准版 - 全部插件
1112
- id: fscan
1213
binary: fscan
1314
main: .
@@ -25,8 +26,46 @@ builds:
2526
ldflags: -s -w -X main.version={{ .Version }} -X main.commit={{ .ShortCommit }} -X main.date={{ .Date }} -X main.builtBy=goreleaser
2627
mod_timestamp: "{{ .CommitTimestamp }}"
2728

29+
# 无本地插件版 - 排除本地模块
30+
- id: fscan-nolocal
31+
binary: fscan
32+
main: .
33+
env:
34+
- CGO_ENABLED=0
35+
goos: [windows, linux, darwin]
36+
goarch: [amd64, arm64, "386"]
37+
goarm: ["7"]
38+
ignore:
39+
- goos: darwin
40+
goarch: "386"
41+
- goos: windows
42+
goarch: arm64
43+
flags: [-trimpath]
44+
tags: [no_local]
45+
ldflags: -s -w -X main.version={{ .Version }} -X main.commit={{ .ShortCommit }} -X main.date={{ .Date }} -X main.builtBy=goreleaser
46+
mod_timestamp: "{{ .CommitTimestamp }}"
47+
48+
# WebUI版 - 带Web管理界面
49+
- id: fscan-web
50+
binary: fscan
51+
main: .
52+
env:
53+
- CGO_ENABLED=0
54+
goos: [windows, linux, darwin]
55+
goarch: [amd64, arm64, "386"]
56+
goarm: ["7"]
57+
ignore:
58+
- goos: darwin
59+
goarch: "386"
60+
- goos: windows
61+
goarch: arm64
62+
flags: [-trimpath]
63+
tags: [web]
64+
ldflags: -s -w -X main.version={{ .Version }} -X main.commit={{ .ShortCommit }} -X main.date={{ .Date }} -X main.builtBy=goreleaser
65+
mod_timestamp: "{{ .CommitTimestamp }}"
66+
2867
upx:
29-
- ids: [fscan]
68+
- ids: [fscan, fscan-nolocal, fscan-web]
3069
enabled: true
3170
goos: [windows, linux]
3271
goarch: [amd64, "386"]
@@ -35,6 +74,7 @@ upx:
3574
lzma: false
3675

3776
archives:
77+
# 标准版归档
3878
- id: fscan
3979
builds: [fscan]
4080
format: binary
@@ -49,6 +89,36 @@ archives:
4989
{{- if .Arm }}v{{ .Arm }}{{ end }}
5090
{{- if eq .Os "windows" }}.exe{{ end }}
5191
92+
# 无本地插件版归档
93+
- id: fscan-nolocal
94+
builds: [fscan-nolocal]
95+
format: binary
96+
allow_different_binary_count: true
97+
name_template: >-
98+
fscan-nolocal_{{ .Version }}_
99+
{{- if eq .Os "darwin" }}mac
100+
{{- else }}{{ .Os }}{{ end }}_
101+
{{- if eq .Arch "amd64" }}x64
102+
{{- else if eq .Arch "386" }}x32
103+
{{- else }}{{ .Arch }}{{ end }}
104+
{{- if .Arm }}v{{ .Arm }}{{ end }}
105+
{{- if eq .Os "windows" }}.exe{{ end }}
106+
107+
# WebUI版归档
108+
- id: fscan-web
109+
builds: [fscan-web]
110+
format: binary
111+
allow_different_binary_count: true
112+
name_template: >-
113+
fscan-web_{{ .Version }}_
114+
{{- if eq .Os "darwin" }}mac
115+
{{- else }}{{ .Os }}{{ end }}_
116+
{{- if eq .Arch "amd64" }}x64
117+
{{- else if eq .Arch "386" }}x32
118+
{{- else }}{{ .Arch }}{{ end }}
119+
{{- if .Arm }}v{{ .Arm }}{{ end }}
120+
{{- if eq .Os "windows" }}.exe{{ end }}
121+
52122
checksum:
53123
name_template: 'checksums.txt'
54124
algorithm: sha256
@@ -82,9 +152,21 @@ release:
82152
83153
感谢使用 {{ .ProjectName }}!
84154
85-
本次发布包含:
86-
- **fscan** - Go 版本(全平台支持)
87-
- **fscan-lite** - C 版本(Linux/Windows 优化版)
155+
### 版本说明
156+
157+
| 版本 | 说明 |
158+
|------|------|
159+
| **fscan** | 标准版,包含全部插件(推荐) |
160+
| **fscan-nolocal** | 精简版,不含本地模块(体积更小) |
161+
| **fscan-web** | WebUI版,带Web管理界面 |
162+
163+
### 平台支持
164+
165+
| 平台 | 架构 |
166+
|------|------|
167+
| Linux | x64, x32, arm64 |
168+
| Windows | x64, x32 |
169+
| macOS | x64, arm64 |
88170
footer: |
89171
**完整更新日志**: https://github.com/{{ .Env.GITHUB_OWNER }}/{{ .Env.GITHUB_REPO }}/compare/{{ .PreviousTag }}...{{ .Tag }}
90172
extra_files:

README.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,101 @@
5858
- **多语言支持** - 中英文界面切换(-lang zh/en)
5959
- **性能统计** - JSON格式性能报告(-perf)
6060

61+
## v2.1.0 更新日志
62+
63+
> 本次更新包含 **262个提交**,涵盖30项新功能、120项修复、54项重构、14项性能优化、20项测试增强。
64+
65+
### 架构重构
66+
- **全局变量消除** - 迁移至Config/State对象,提升并发安全和可测试性
67+
- **SMB插件融合** - 整合smb/smb2/smbghost/smbinfo为统一插件,新增smb_protocol.go
68+
- **服务探测重构** - 实现Nmap风格fallback机制,优化端口指纹识别策略
69+
- **输出系统重构** - TXT实时刷盘+双写机制,解决结果丢失和乱序问题
70+
- **i18n框架升级** - 迁移至go-i18n,完整覆盖core/plugins/webscan模块
71+
- **HostInfo重构** - Ports字段从string改为int,类型安全
72+
- **函数复杂度优化** - clusterpoc(125→30)、EnhancedPortScan(111→20)
73+
- **代码审计** - 修复P0-P2级别问题,清理deadcode
74+
- **日志系统优化** - LogDebug调用清理(71→18),精简启动日志输出
75+
76+
### 性能优化
77+
- **正则预编译** - 全局正则表达式预编译,避免重复编译开销
78+
- **内存优化** - map[string]bool改为map[string]struct{}节省内存
79+
- **并发指纹匹配** - 多协程并行匹配,提升识别速度
80+
- **连接复用** - SOCKS5全局拨号器复用,避免重复握手
81+
- **滑动窗口调度** - 自适应线程池+流式迭代器,优化端口扫描
82+
- **CEL缓存优化** - POC扫描CEL环境缓存,减少重复初始化
83+
- **包级变量提取** - proxyFailurePatterns/resourceExhaustedPatterns/sslSecondProbes等
84+
- **预分配容量** - 简化转换链、单次字符串替换
85+
- **并发安全优化** - 优化锁粒度和内存分配
86+
87+
### 新功能
88+
- **Web管理界面** - 可视化扫描任务管理,响应式布局和进度显示
89+
- **多格式POC适配** - 支持xray和afrog格式POC
90+
- **智能扫描模式** - 布隆过滤器去重+代理优化
91+
- **增强指纹库** - 集成FingerprintHub(3139条指纹)
92+
- **Favicon指纹识别** - 支持mmh3和MD5双格式hash匹配
93+
- **通用版本提取器** - 自动提取服务版本信息
94+
- **指纹优先级排序** - 智能排序匹配结果
95+
- **智能协议检测** - 自动识别HTTP/HTTPS协议类型
96+
- **网卡指定功能** - 支持VPN场景(-iface参数)
97+
- **排除主机文件** - 支持从文件读取排除主机(-ehf参数)
98+
- **ICMP令牌桶限速** - 防止高速扫描导致路由器崩溃
99+
- **端口扫描重试** - 失败自动重扫机制
100+
- **RDP真实认证** - 集成grdp库实现系统指纹识别
101+
- **SMB/FTP文件列表** - 匿名访问时自动列出文件
102+
- **302跳转双重识别** - 同时识别原始响应和跳转后响应指纹
103+
- **TXT输出URL汇总** - 末尾添加Web服务URL列表便于批量测试
104+
- **nmap核心集成** - 三大改进:探测策略/匹配引擎/版本解析
105+
- **插件选择性编译** - Build Tags系统,支持服务/本地/Web插件独立编译
106+
- **默认端口扩展** - 从62个扩展到133个常用端口
107+
- **全端口扫描支持** - 扩大端口范围限制
108+
- **HTTP重定向控制** - 可配置的重定向次数限制
109+
- **性能分析支持** - 添加pprof性能分析和benchmark测试
110+
- **TCP包统计** - 服务插件支持TCP包发送统计
111+
- **fscan-lab靶场** - 内网渗透训练平台,覆盖全部漏洞场景(未完成)
112+
- **Redis利用增强** - 移植完整Redis利用功能(写公钥/计划任务/WebShell/主从RCE)
113+
- **rsync插件重构** - 使用go-rsync库重构认证逻辑
114+
115+
### Bug修复(120项,列出关键修复)
116+
- **RDP空指针panic** - 修复证书解析导致的崩溃(#551)
117+
- **批量扫描漏报** - 修复大规模扫描遗漏问题(#304)
118+
- **JSON输出格式** - 修复输出格式错误(#446)
119+
- **Redis弱密码检测** - 修复检测遗漏问题(#447)
120+
- **结果实时保存** - 修复扫描结果未及时保存(#469)
121+
- **Nmap解析溢出** - 修复八进制转义解析bug(#478)
122+
- **指纹识别竞态** - 修复webtitle/webpoc竞态问题(#474)
123+
- **MySQL连接验证** - 改用information_schema库验证
124+
- **代理端口误判** - 修复代理模式下端口状态判断错误
125+
- **Context超时** - 修复22处插件超时未响应问题
126+
- **ICMP竞态条件** - 修复并发扫描竞争问题
127+
- **IPv6地址格式** - 修复4处地址格式化问题
128+
- **POC高并发卡死** - 修复Context未传播问题
129+
- **Ctrl+C结果丢失** - 添加信号处理确保结果写入
130+
- **SOCKS5全回显** - 添加代理连接验证
131+
- **服务探测泄漏** - 修复连接未正确关闭问题
132+
- **webtitle响应丢弃** - 修复部分响应数据被丢弃导致识别失败
133+
- **TXT漏洞信息缺失** - 修复输出遗漏漏洞详情
134+
- **JSON指纹缺失** - 统一SERVICE结果Target格式
135+
- **扫描耗时显示** - 修复完成耗时显示为0的问题
136+
- **虚假漏洞记录** - 重构TXT输出系统消除误报
137+
- **Redis跨平台路径** - 修复利用功能的路径和超时问题
138+
- **Windows编译警告** - 修复fscan-lite平台兼容性
139+
- **Go 1.20兼容** - 降级依赖保持兼容性
140+
141+
### 测试增强(20项)
142+
- **单元测试** - 核心模块覆盖率74-100%
143+
- **并发安全测试** - State对象、指纹匹配引擎专项测试
144+
- **集成测试** - Web扫描/端口扫描/服务探测/SSH认证/ICMP探测
145+
- **CLI参数测试** - 命令行参数解析验证
146+
- **性能基准测试** - AdaptivePool、服务探测策略benchmark
147+
- **ResultBuffer测试** - 去重和完整度评分验证
148+
149+
### 工程化改进
150+
- **CI流程优化** - golangci-lint v2升级,简化构建步骤
151+
- **Issue自动化** - GitHub Issue模板优化,Project自动化工作流
152+
- **Lint全量修复** - revive/errcheck/shadow/staticcheck/gosimple全部通过
153+
- **README重写** - 中英文文档全面更新
154+
- **代码格式统一** - gofmt/goimports规范化
155+
61156
## 快速开始
62157

63158
```bash

README_EN.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,101 @@ Comprehensive intranet scanning tool for automated vulnerability assessment.
5858
- **Multi-language** - Chinese/English interface (-lang zh/en)
5959
- **Performance Stats** - JSON format performance report (-perf)
6060

61+
## v2.1.0 Changelog
62+
63+
> This update includes **262 commits**: 30 new features, 120 fixes, 54 refactors, 14 performance optimizations, 20 test enhancements.
64+
65+
### Architecture Refactoring
66+
- **Global Variable Elimination** - Migrated to Config/State objects for better concurrency safety and testability
67+
- **SMB Plugin Consolidation** - Merged smb/smb2/smbghost/smbinfo into unified plugin with new smb_protocol.go
68+
- **Service Probe Refactoring** - Implemented Nmap-style fallback mechanism, optimized port fingerprint strategy
69+
- **Output System Refactoring** - TXT real-time flush + dual-write mechanism, resolved result loss and ordering issues
70+
- **i18n Framework Upgrade** - Migrated to go-i18n, full coverage of core/plugins/webscan modules
71+
- **HostInfo Refactoring** - Ports field changed from string to int for type safety
72+
- **Function Complexity Optimization** - clusterpoc (125→30), EnhancedPortScan (111→20)
73+
- **Code Audit** - Fixed P0-P2 level issues, cleaned up deadcode
74+
- **Logging System Optimization** - LogDebug call cleanup (71→18), streamlined startup log output
75+
76+
### Performance Optimization
77+
- **Regex Precompilation** - Global regex precompilation to avoid repeated compilation overhead
78+
- **Memory Optimization** - Changed map[string]bool to map[string]struct{} for memory savings
79+
- **Concurrent Fingerprint Matching** - Multi-goroutine parallel matching for faster identification
80+
- **Connection Reuse** - SOCKS5 global dialer reuse to avoid repeated handshakes
81+
- **Sliding Window Scheduling** - Adaptive thread pool + streaming iterator for port scan optimization
82+
- **CEL Cache Optimization** - POC scan CEL environment caching to reduce repeated initialization
83+
- **Package-level Variable Extraction** - proxyFailurePatterns/resourceExhaustedPatterns/sslSecondProbes etc.
84+
- **Capacity Pre-allocation** - Simplified conversion chains, single-pass string replacement
85+
- **Concurrency Safety Optimization** - Optimized lock granularity and memory allocation
86+
87+
### New Features
88+
- **Web Management UI** - Visual scan task management with responsive layout and progress display
89+
- **Multi-format POC Adapter** - Support for xray and afrog format POCs
90+
- **Smart Scan Mode** - Bloom filter deduplication + proxy optimization
91+
- **Enhanced Fingerprint Library** - Integrated FingerprintHub (3139 fingerprints)
92+
- **Favicon Fingerprinting** - Support for mmh3 and MD5 dual-format hash matching
93+
- **Universal Version Extractor** - Auto-extract service version information
94+
- **Fingerprint Priority Sorting** - Smart sorting of match results
95+
- **Smart Protocol Detection** - Auto-detect HTTP/HTTPS protocol type
96+
- **Network Interface Binding** - Support for VPN scenarios (-iface parameter)
97+
- **Exclude Hosts File** - Read excluded hosts from file (-ehf parameter)
98+
- **ICMP Token Bucket Rate Limiting** - Prevent router crashes from high-speed scanning
99+
- **Port Scan Retry** - Automatic retry mechanism for failed scans
100+
- **RDP Real Authentication** - Integrated grdp library for system fingerprinting
101+
- **SMB/FTP File Listing** - Auto-list files on anonymous access
102+
- **302 Redirect Dual Detection** - Identify fingerprints from both original and redirected responses
103+
- **TXT Output URL Summary** - Append web service URL list for batch testing
104+
- **gonmap Core Integration** - Three improvements: probe strategy/matching engine/version parsing
105+
- **Selective Plugin Compilation** - Build Tags system for independent service/local/web plugin compilation
106+
- **Default Port Expansion** - Extended from 62 to 133 common ports
107+
- **Full Port Scan Support** - Expanded port range limits
108+
- **HTTP Redirect Control** - Configurable redirect count limit
109+
- **Performance Profiling Support** - Added pprof profiling and benchmark tests
110+
- **TCP Packet Statistics** - Service plugins support TCP packet send statistics
111+
- **fscan-lab Environment** - Intranet penetration training platform covering all vulnerability scenarios
112+
- **Redis Exploitation Enhancement** - Ported complete Redis exploitation (write pubkey/crontab/webshell/master-slave RCE)
113+
- **rsync Plugin Refactoring** - Restructured authentication logic using go-rsync library
114+
115+
### Bug Fixes (120 items, key fixes listed)
116+
- **RDP Null Pointer Panic** - Fixed certificate parsing crash (#551)
117+
- **Batch Scan Missing Results** - Fixed large-scale scan omissions (#304)
118+
- **JSON Output Format** - Fixed output format errors (#446)
119+
- **Redis Weak Password Detection** - Fixed detection omissions (#447)
120+
- **Real-time Result Saving** - Fixed scan results not saved timely (#469)
121+
- **Nmap Parse Overflow** - Fixed octal escape parsing bug (#478)
122+
- **Fingerprint Race Condition** - Fixed webtitle/webpoc race issues (#474)
123+
- **MySQL Connection Validation** - Changed to information_schema for validation
124+
- **Proxy Port Misjudgment** - Fixed port status judgment in proxy mode
125+
- **Context Timeout** - Fixed 22 plugin timeout unresponsive issues
126+
- **ICMP Race Condition** - Fixed concurrent scan race issues
127+
- **IPv6 Address Format** - Fixed 4 address formatting issues
128+
- **POC High Concurrency Hang** - Fixed Context propagation issues
129+
- **Ctrl+C Result Loss** - Added signal handling for proper result saving
130+
- **SOCKS5 Echo Issue** - Added proxy connection validation
131+
- **Service Probe Leak** - Fixed connection not properly closed
132+
- **webtitle Response Discard** - Fixed partial response data being discarded causing identification failure
133+
- **TXT Vulnerability Info Missing** - Fixed output missing vulnerability details
134+
- **JSON Fingerprint Missing** - Unified SERVICE result Target format
135+
- **Scan Duration Display** - Fixed completion time showing as 0
136+
- **False Vulnerability Records** - Refactored TXT output system to eliminate false positives
137+
- **Redis Cross-platform Path** - Fixed exploitation path and timeout issues
138+
- **Windows Compilation Warnings** - Fixed fscan-lite platform compatibility
139+
- **Go 1.20 Compatibility** - Downgraded dependencies for compatibility
140+
141+
### Test Enhancements (20 items)
142+
- **Unit Tests** - Core module coverage at 74-100%
143+
- **Concurrency Safety Tests** - Dedicated tests for State object and fingerprint matching engine
144+
- **Integration Tests** - Web scan/port scan/service probe/SSH auth/ICMP probe
145+
- **CLI Parameter Tests** - Command-line argument parsing verification
146+
- **Performance Benchmarks** - AdaptivePool and service probe strategy benchmarks
147+
- **ResultBuffer Tests** - Deduplication and completeness scoring verification
148+
149+
### Engineering Improvements
150+
- **CI Pipeline Optimization** - Upgraded to golangci-lint v2, simplified build steps
151+
- **Issue Automation** - GitHub Issue template optimization, Project automation workflow
152+
- **Full Lint Fixes** - revive/errcheck/shadow/staticcheck/gosimple all passing
153+
- **README Rewrite** - Comprehensive Chinese and English documentation update
154+
- **Code Format Unification** - gofmt/goimports standardization
155+
61156
## Quick Start
62157

63158
```bash

plugins/local/avdetect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build plugin_avdetect || !plugin_selective
1+
//go:build (plugin_avdetect || !plugin_selective) && !no_local
22

33
package local
44

plugins/local/cleaner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build plugin_cleaner || !plugin_selective
1+
//go:build (plugin_cleaner || !plugin_selective) && !no_local
22

33
package local
44

plugins/local/crontask.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build (plugin_crontask || !plugin_selective) && linux
1+
//go:build (plugin_crontask || !plugin_selective) && linux && !no_local
22

33
package local
44

plugins/local/dcinfo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build (plugin_dcinfo || !plugin_selective) && windows
1+
//go:build (plugin_dcinfo || !plugin_selective) && windows && !no_local
22

33
package local
44

plugins/local/downloader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build plugin_downloader || !plugin_selective
1+
//go:build (plugin_downloader || !plugin_selective) && !no_local
22

33
package local
44

plugins/local/envinfo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build plugin_envinfo || !plugin_selective
1+
//go:build (plugin_envinfo || !plugin_selective) && !no_local
22

33
package local
44

plugins/local/fileinfo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build plugin_fileinfo || !plugin_selective
1+
//go:build (plugin_fileinfo || !plugin_selective) && !no_local
22

33
package local
44

0 commit comments

Comments
 (0)