From 80644cd6f14e6d24685d543b4ee147d1e9560a0f Mon Sep 17 00:00:00 2001 From: ZacharyZcR Date: Tue, 2 Sep 2025 07:51:28 +0000 Subject: [PATCH] =?UTF-8?q?refactor:=20=E5=88=A0=E9=99=A4=E5=A4=9A?= =?UTF-8?q?=E4=BD=99=E7=9A=84-fp=E5=8F=82=E6=95=B0=EF=BC=8C=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E6=8C=87=E7=BA=B9=E8=AF=86=E5=88=AB=E9=BB=98=E8=AE=A4?= =?UTF-8?q?=E5=90=AF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 理由: - SmartPortInfoScanner已默认进行服务指纹识别 - -fp参数造成用户困惑,存在两种显示模式 - 详细服务信息对安全扫描很有价值,应该默认显示 删除内容: - 移除-fp命令行参数定义 - 删除EnableFingerprint变量和相关逻辑 - 清理国际化文件中的相关文本 - 移除配置结构体中的指纹识别字段 新行为: - 服务识别信息默认显示完整详情 - 包含版本、系统、产品、协议信息和Banner - 简化用户界面,消除参数选择的困惑 效果验证: - 原来: ./fscan -h IP -fp 显示详细信息 - 现在: ./fscan -h IP 默认显示详细信息 - 用户体验更简洁一致 --- common/config/types.go | 2 +- common/flag.go | 4 ++-- common/i18n/messages/flag.go | 5 +---- core/PortScan.go | 32 +++++++++++++++----------------- 4 files changed, 19 insertions(+), 24 deletions(-) diff --git a/common/config/types.go b/common/config/types.go index 8326802..359bb6a 100644 --- a/common/config/types.go +++ b/common/config/types.go @@ -54,7 +54,7 @@ type ScanControlConfig struct { GlobalTimeout int64 `json:"global_timeout"` // 整体扫描超时时间(秒) // LiveTop 已移除,改为智能控制 DisablePing bool `json:"disable_ping"` // 是否禁用主机存活性检测 - EnableFingerprint bool `json:"enable_fingerprint"` // 是否启用服务指纹识别 + // EnableFingerprint 已删除:服务指纹识别默认启用 LocalMode bool `json:"local_mode"` // 是否启用本地信息收集模式 } diff --git a/common/flag.go b/common/flag.go index e36c8ce..97a12af 100644 --- a/common/flag.go +++ b/common/flag.go @@ -21,7 +21,7 @@ var ( ModuleThreadNum int GlobalTimeout int64 - EnableFingerprint bool + // EnableFingerprint 已删除:服务指纹识别默认启用 AddUsers string AddPasswords string @@ -146,7 +146,7 @@ func Flag(Info *HostInfo) { flag.Int64Var(&GlobalTimeout, "gt", 180, i18n.GetText("flag_global_timeout")) // LiveTop 参数已移除,改为智能控制 flag.BoolVar(&DisablePing, "np", false, i18n.GetText("flag_disable_ping")) - flag.BoolVar(&EnableFingerprint, "fp", false, i18n.GetText("flag_enable_fingerprint")) + // 移除-fp参数:服务指纹识别已默认启用,无需额外参数控制 flag.StringVar(&LocalPlugin, "local", "", "指定本地插件名称 (如: cleaner, avdetect, keylogger 等)") flag.BoolVar(&AliveOnly, "ao", false, i18n.GetText("flag_alive_only")) diff --git a/common/i18n/messages/flag.go b/common/i18n/messages/flag.go index dd661ba..0e42ccc 100644 --- a/common/i18n/messages/flag.go +++ b/common/i18n/messages/flag.go @@ -62,10 +62,7 @@ var FlagMessages = map[string]map[string]string{ LangZH: "禁用ping探测", LangEN: "Disable ping detection", }, - "flag_enable_fingerprint": { - LangZH: "启用指纹识别", - LangEN: "Enable fingerprinting", - }, + // "flag_enable_fingerprint" 已删除:服务指纹识别默认启用 "flag_local_mode": { LangZH: "本地扫描模式", LangEN: "Local scan mode", diff --git a/core/PortScan.go b/core/PortScan.go index 0bb29e8..ebcbd79 100644 --- a/core/PortScan.go +++ b/core/PortScan.go @@ -146,25 +146,23 @@ func EnhancedPortScan(hosts []string, ports string, timeout int64) []string { sb.WriteString(" 版本:" + serviceInfo.Version) } - // 添加详细信息(在-fp启用时) - if common.EnableFingerprint { - for k, v := range serviceInfo.Extras { - if v == "" { - continue - } - switch k { - case "vendor_product": - sb.WriteString(" 产品:" + v) - case "os": - sb.WriteString(" 系统:" + v) - case "info": - sb.WriteString(" 信息:" + v) - } + // 添加详细服务信息(默认启用) + for k, v := range serviceInfo.Extras { + if v == "" { + continue } + switch k { + case "vendor_product": + sb.WriteString(" 产品:" + v) + case "os": + sb.WriteString(" 系统:" + v) + case "info": + sb.WriteString(" 信息:" + v) + } + } - if len(serviceInfo.Banner) > 0 && len(serviceInfo.Banner) < 100 { - sb.WriteString(" Banner:[" + strings.TrimSpace(serviceInfo.Banner) + "]") - } + if len(serviceInfo.Banner) > 0 && len(serviceInfo.Banner) < 100 { + sb.WriteString(" Banner:[" + strings.TrimSpace(serviceInfo.Banner) + "]") } // 统一输出端口和服务信息