From 90576b122ce024fd47ca53e08a0336b4f07d5f00 Mon Sep 17 00:00:00 2001 From: ZacharyZcR Date: Fri, 8 Aug 2025 09:45:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=8C=E5=85=A8=E7=A7=BB=E9=99=A4SSH?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E7=9A=84=E8=87=AA=E5=8A=A8=E5=88=A9=E7=94=A8?= =?UTF-8?q?=E8=B0=83=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 删除SSH插件中的autoExploit方法调用 - 移除autoExploit方法定义 - SSH插件现在只进行弱密码扫描,不再尝试任何利用功能 - -sshkey参数仅用于私钥文件认证,不涉及利用功能 修复后SSH插件不再显示"利用失败"消息 --- Plugins/services/ssh/plugin.go | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/Plugins/services/ssh/plugin.go b/Plugins/services/ssh/plugin.go index 4e3b49b..1f97bd3 100644 --- a/Plugins/services/ssh/plugin.go +++ b/Plugins/services/ssh/plugin.go @@ -155,11 +155,6 @@ func (p *SSHPlugin) Scan(ctx context.Context, info *common.HostInfo) (*base.Scan target := fmt.Sprintf("%s:%s", info.Host, info.Ports) common.LogSuccess(i18n.GetText("ssh_key_auth_success", target, result.Credentials[0].Username)) - // 自动利用功能 - 同步执行以确保及时显示结果 - if !common.DisableExploit { - p.autoExploit(context.Background(), info, result.Credentials[0]) - } - return result, nil } } @@ -179,11 +174,6 @@ func (p *SSHPlugin) Scan(ctx context.Context, info *common.HostInfo) (*base.Scan cred := result.Credentials[0] common.LogSuccess(i18n.GetText("ssh_pwd_auth_success", target, cred.Username, cred.Password)) - // 自动利用功能(可通过-ne参数禁用)- 同步执行以确保及时显示结果 - if result.Success && len(result.Credentials) > 0 && !common.DisableExploit { - p.autoExploit(context.Background(), info, result.Credentials[0]) - } - return result, nil } @@ -229,24 +219,6 @@ func (p *SSHPlugin) generateCredentials() []*base.Credential { return base.GenerateCredentials(usernames, common.Passwords) } -// autoExploit 自动利用功能 -func (p *SSHPlugin) autoExploit(ctx context.Context, info *common.HostInfo, creds *base.Credential) { - target := fmt.Sprintf("%s:%s", info.Host, info.Ports) - common.LogDebug(i18n.GetText("plugin_exploit_start", "SSH", target)) - - // 执行利用操作 - result, err := p.exploiter.Exploit(ctx, info, creds) - if err != nil { - common.LogError(i18n.GetText("plugin_exploit_failed", "SSH", err)) - return - } - - // 处理利用结果 - if result != nil && result.Success { - // SaveExploitResult会自动使用LogSuccess显示红色利用成功消息 - base.SaveExploitResult(info, result, "SSH") - } -} // Exploit 使用exploiter执行利用 func (p *SSHPlugin) Exploit(ctx context.Context, info *common.HostInfo, creds *base.Credential) (*base.ExploitResult, error) {