mirror of
https://github.com/shadow1ng/fscan.git
synced 2025-09-14 14:06:44 +08:00

移除了36个静态分析工具识别的未使用函数,减少代码体积534行: 核心模块: - core/PluginAdapter.go: 移除7个未使用的插件适配器方法 - core/Registry.go: 移除5个未使用的注册器方法 - core/Scanner.go: 移除1个未使用的扫描方法 - core/WebDetection.go: 移除4个未使用的Web检测方法 通用模块: - common/ConcurrencyMonitor.go: 移除3个未使用的并发监控方法 - common/common.go: 移除1个未使用的插件注册方法 - common/base/Plugin.go: 移除4个未使用的插件管理方法 - common/parsers/Simple.go: 移除1个未使用的端口解析方法 - common/utils/memmonitor.go: 移除9个未使用的内存监控方法 - common/utils/slicepool.go: 移除1个未使用的切片去重方法 插件模块: - plugins/services/vnc/plugin.go: 移除1个未使用的服务识别方法 所有移除的函数均替换为中文注释标记,保持代码可读性。
58 lines
1.4 KiB
Go
58 lines
1.4 KiB
Go
package core
|
||
|
||
import (
|
||
"time"
|
||
)
|
||
|
||
// WebPortDetector Web端口检测器
|
||
type WebPortDetector struct {
|
||
// 常见Web端口列表
|
||
commonWebPorts map[int]bool
|
||
// HTTP检测超时时间
|
||
httpTimeout time.Duration
|
||
}
|
||
|
||
// NewWebPortDetector 创建Web端口检测器
|
||
func NewWebPortDetector() *WebPortDetector {
|
||
// 定义常见Web端口
|
||
commonPorts := map[int]bool{
|
||
80: true, // HTTP
|
||
443: true, // HTTPS
|
||
8080: true, // HTTP alternate
|
||
8443: true, // HTTPS alternate
|
||
8000: true, // Development server
|
||
8888: true, // Common dev port
|
||
9000: true, // Common dev port
|
||
9090: true, // Common dev port
|
||
3000: true, // Node.js dev server
|
||
4000: true, // Ruby dev server
|
||
5000: true, // Python dev server
|
||
8081: true, // HTTP alternate
|
||
8082: true, // HTTP alternate
|
||
8083: true, // HTTP alternate
|
||
8084: true, // HTTP alternate
|
||
8085: true, // HTTP alternate
|
||
8086: true, // HTTP alternate
|
||
8087: true, // HTTP alternate
|
||
8088: true, // HTTP alternate
|
||
8089: true, // HTTP alternate
|
||
}
|
||
|
||
return &WebPortDetector{
|
||
commonWebPorts: commonPorts,
|
||
httpTimeout: 2 * time.Second, // 2秒超时,快速检测
|
||
}
|
||
}
|
||
|
||
// 已移除未使用的 IsWebService 方法
|
||
|
||
// IsCommonWebPort 检查是否为常见Web端口
|
||
func (w *WebPortDetector) IsCommonWebPort(port int) bool {
|
||
return w.commonWebPorts[port]
|
||
}
|
||
|
||
// 已移除未使用的 detectHTTPService 方法
|
||
|
||
// 已移除未使用的 tryHTTPConnection 方法
|
||
|
||
// 已移除未使用的 GetCommonWebPorts 方法
|