From eec3941fba137da1dad20e7b852afc235da22ebe Mon Sep 17 00:00:00 2001 From: ZacharyZcR Date: Tue, 20 Jan 2026 12:46:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E5=87=AD=E6=8D=AE?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E6=9C=AA=E5=8F=91=E7=8E=B0=E5=BC=B1=E5=AF=86?= =?UTF-8?q?=E7=A0=81=E7=9A=84=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - credential_tester.go: 失败时设置 Type=ResultTypeCredential - scanner.go: 根据结果类型在 error 级别输出'未发现弱密码'提示 - 新增 i18n 翻译 brute_no_weak_pass 使用 -log all 或 -log error 可看到此提示 --- common/i18n/locales/en.yaml | 2 ++ common/i18n/locales/zh.yaml | 2 ++ core/scanner.go | 10 +++++++--- plugins/services/credential_tester.go | 1 + 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/common/i18n/locales/en.yaml b/common/i18n/locales/en.yaml index bee433c..fbd3d1b 100644 --- a/common/i18n/locales/en.yaml +++ b/common/i18n/locales/en.yaml @@ -309,6 +309,8 @@ plugin_panic: other: "Plugin {{.Arg1}} panic while scanning {{.Arg2}}:{{.Arg3}}: {{.Arg4}}" plugin_scan_error: other: "Plugin scan error {{.Arg1}}:{{.Arg2}} - {{.Arg3}}" +brute_no_weak_pass: + other: "{{.Arg1}}:{{.Arg2}} {{.Arg3}} no weak password found" # ========================= Port Scan Messages ========================= invalid_port: diff --git a/common/i18n/locales/zh.yaml b/common/i18n/locales/zh.yaml index e3f4a64..46ed5be 100644 --- a/common/i18n/locales/zh.yaml +++ b/common/i18n/locales/zh.yaml @@ -309,6 +309,8 @@ plugin_panic: other: "插件 {{.Arg1}} 扫描 {{.Arg2}}:{{.Arg3}} 时panic: {{.Arg4}}" plugin_scan_error: other: "插件扫描错误 {{.Arg1}}:{{.Arg2}} - {{.Arg3}}" +brute_no_weak_pass: + other: "{{.Arg1}}:{{.Arg2}} {{.Arg3}} 未发现弱密码" # ========================= 端口扫描消息 ========================= invalid_port: diff --git a/core/scanner.go b/core/scanner.go index e2459f7..f1f73cb 100644 --- a/core/scanner.go +++ b/core/scanner.go @@ -212,11 +212,15 @@ func executeScanTask(config *common.Config, state *common.State, pluginName stri if plugin != nil { result := plugin.Scan(context.Background(), &target, config, state) if result != nil { - if result.Error != nil { - common.LogError(i18n.Tr("plugin_scan_error", target.Host, target.Port, result.Error)) - } else if result.Success { + if result.Success { // 保存成功的扫描结果到文件 savePluginResult(&target, pluginName, result) + } else if result.Type == plugins.ResultTypeCredential { + // 凭据测试完成但未发现弱密码,在error级别输出提示 + common.LogError(i18n.Tr("brute_no_weak_pass", target.Host, target.Port, pluginName)) + } else if result.Error != nil { + // 其他类型的错误 + common.LogError(i18n.Tr("plugin_scan_error", target.Host, target.Port, result.Error)) } } } diff --git a/plugins/services/credential_tester.go b/plugins/services/credential_tester.go index b0cc8a3..9a1f210 100644 --- a/plugins/services/credential_tester.go +++ b/plugins/services/credential_tester.go @@ -188,6 +188,7 @@ func TestCredentialsConcurrently( } return &ScanResult{ + Type: plugins.ResultTypeCredential, // 标记这是凭据测试结果 Success: false, Service: serviceName, Error: fmt.Errorf("未发现弱密码"),