diff --git a/Common/config/ScanOptions.go b/Common/config/ScanOptions.go index cfd5163..316fef1 100644 --- a/Common/config/ScanOptions.go +++ b/Common/config/ScanOptions.go @@ -3,6 +3,8 @@ package config import ( "sync" "time" + + "github.com/shadow1ng/fscan/Common/i18n" ) // ScanOptionsManager 扫描选项管理器 @@ -177,7 +179,7 @@ func (som *ScanOptionsManager) ValidateConfig() []string { // 验证超时配置 if som.options.ScanControl.Timeout > som.options.WebScan.WebTimeout { - warnings = append(warnings, "Web超时时间大于普通超时时间,可能导致不期望的行为") + warnings = append(warnings, i18n.GetText("config_web_timeout_warning")) } // 验证超时配置合理性 diff --git a/Common/i18n/messages.go b/Common/i18n/messages.go index 1a0566a..99e71d0 100644 --- a/Common/i18n/messages.go +++ b/Common/i18n/messages.go @@ -463,6 +463,42 @@ var coreMessages = map[string]map[string]string{ LangEN: "Invalid scan mode: %s", }, + // ========================= 扫描流程消息 ========================= + "scan_mode_service_selected": { + LangZH: "已选择服务扫描模式", + LangEN: "Service scan mode selected", + }, + "scan_info_start": { + LangZH: "开始信息扫描", + LangEN: "Starting information scan", + }, + "scan_host_start": { + LangZH: "开始主机扫描", + LangEN: "Starting host scan", + }, + "scan_no_service_plugins": { + LangZH: "未找到可用的服务插件", + LangEN: "No available service plugins found", + }, + "scan_complete_ports_found": { + LangZH: "扫描完成, 发现 %d 个开放端口", + LangEN: "Scan completed, found %d open ports", + }, + "scan_alive_ports_count": { + LangZH: "存活端口数量: %d", + LangEN: "Alive ports count: %d", + }, + "scan_task_complete": { + LangZH: "扫描已完成: %d/%d", + LangEN: "Scan completed: %d/%d", + }, + + // ========================= 配置验证消息 ========================= + "config_web_timeout_warning": { + LangZH: "Web超时时间大于普通超时时间,可能导致不期望的行为", + LangEN: "Web timeout is larger than normal timeout, may cause unexpected behavior", + }, + // ========================= Flag参数帮助消息 ========================= "flag_host": { LangZH: "目标主机: IP, IP段, IP段文件, 域名", diff --git a/Common/parsers/NetworkParser.go b/Common/parsers/NetworkParser.go index 2d721fe..c2b4cd8 100644 --- a/Common/parsers/NetworkParser.go +++ b/Common/parsers/NetworkParser.go @@ -8,6 +8,8 @@ import ( "strings" "sync" "time" + + "github.com/shadow1ng/fscan/Common/i18n" ) // NetworkParser 网络配置解析器 @@ -207,7 +209,7 @@ func (np *NetworkParser) parseTimeouts(timeout, webTimeout int64) (time.Duration // 验证超时配置合理性 if finalWebTimeout > finalTimeout { - warnings = append(warnings, "Web超时时间大于普通超时时间,可能导致不期望的行为") + warnings = append(warnings, i18n.GetText("config_web_timeout_warning")) } return finalTimeout, finalWebTimeout, errors, warnings diff --git a/Core/PortScan.go b/Core/PortScan.go index df51be1..5ef8108 100644 --- a/Core/PortScan.go +++ b/Core/PortScan.go @@ -146,6 +146,6 @@ func EnhancedPortScan(hosts []string, ports string, timeout int64) []string { return true }) - Common.LogBase(fmt.Sprintf("扫描完成, 发现 %d 个开放端口", count)) + Common.LogBase(Common.GetText("scan_complete_ports_found", count)) return aliveAddrs } diff --git a/Core/Scanner.go b/Core/Scanner.go index eedcd8d..63c6f90 100644 --- a/Core/Scanner.go +++ b/Core/Scanner.go @@ -59,13 +59,13 @@ func (s *Scanner) selectStrategy(info Common.HostInfo) { Common.LogBase("已选择Web扫描模式") default: s.strategy = NewServiceScanStrategy() - Common.LogBase("已选择服务扫描模式") + Common.LogBase(Common.GetText("scan_mode_service_selected")) } } // Scan 执行整体扫描流程 func (s *Scanner) Scan(info Common.HostInfo) { - Common.LogBase("开始信息扫描") + Common.LogBase(Common.GetText("scan_info_start")) lib.Inithttp() // 并发控制初始化 @@ -86,7 +86,7 @@ func (s *Scanner) finishScan() { Common.ProgressBar.Finish() fmt.Println() } - Common.LogBase(fmt.Sprintf("扫描已完成: %v/%v", Common.End, Common.Num)) + Common.LogBase(Common.GetText("scan_task_complete", Common.End, Common.Num)) } // 任务执行通用框架 diff --git a/Core/ServiceScanner.go b/Core/ServiceScanner.go index a45a844..e474033 100644 --- a/Core/ServiceScanner.go +++ b/Core/ServiceScanner.go @@ -47,7 +47,7 @@ func (s *ServiceScanStrategy) Execute(info Common.HostInfo, ch *chan struct{}, w return } - Common.LogBase("开始主机扫描") + Common.LogBase(Common.GetText("scan_host_start")) // 输出插件信息 s.LogPluginInfo() @@ -94,7 +94,7 @@ func (s *ServiceScanStrategy) discoverAlivePorts(hosts []string) []string { // 根据扫描模式选择端口扫描方式 if len(hosts) > 0 { alivePorts = EnhancedPortScan(hosts, Common.Ports, Common.Timeout) - Common.LogBase(fmt.Sprintf("存活端口数量: %d", len(alivePorts))) + Common.LogBase(Common.GetText("scan_alive_ports_count", len(alivePorts))) } // 合并额外指定的端口 @@ -102,7 +102,7 @@ func (s *ServiceScanStrategy) discoverAlivePorts(hosts []string) []string { alivePorts = append(alivePorts, Common.HostPort...) alivePorts = Common.RemoveDuplicate(alivePorts) Common.HostPort = nil - Common.LogBase(fmt.Sprintf("存活端口数量: %d", len(alivePorts))) + Common.LogBase(Common.GetText("scan_alive_ports_count", len(alivePorts))) } return alivePorts @@ -193,7 +193,7 @@ func (s *ServiceScanStrategy) LogPluginInfo() { if len(applicablePlugins) > 0 { Common.LogBase(fmt.Sprintf("使用服务插件: %s", strings.Join(applicablePlugins, ", "))) } else { - Common.LogBase("未找到可用的服务插件") + Common.LogBase(Common.GetText("scan_no_service_plugins")) } }