feat: 添加凭据测试未发现弱密码的提示

- credential_tester.go: 失败时设置 Type=ResultTypeCredential
- scanner.go: 根据结果类型在 error 级别输出'未发现弱密码'提示
- 新增 i18n 翻译 brute_no_weak_pass

使用 -log all 或 -log error 可看到此提示
This commit is contained in:
ZacharyZcR
2026-01-20 12:46:56 +08:00
parent 4ef21f3841
commit eec3941fba
4 changed files with 12 additions and 3 deletions

View File

@@ -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:

View File

@@ -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:

View File

@@ -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))
}
}
}

View File

@@ -188,6 +188,7 @@ func TestCredentialsConcurrently(
}
return &ScanResult{
Type: plugins.ResultTypeCredential, // 标记这是凭据测试结果
Success: false,
Service: serviceName,
Error: fmt.Errorf("未发现弱密码"),