From 9ed6cc95b61446cb0ecb8c7bc6f243ab5f9fc076 Mon Sep 17 00:00:00 2001 From: ZacharyZcR <2903735704@qq.com> Date: Sat, 23 May 2026 07:53:28 +0800 Subject: [PATCH] replace string builder sprintf with fprintf --- plugins/local/forwardshell.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/local/forwardshell.go b/plugins/local/forwardshell.go index 9a571bd..9c1c05f 100644 --- a/plugins/local/forwardshell.go +++ b/plugins/local/forwardshell.go @@ -49,13 +49,13 @@ func (p *ForwardShellPlugin) Scan(ctx context.Context, info *common.HostInfo, se } output.WriteString("=== 正向Shell服务器 ===\n") - output.WriteString(fmt.Sprintf("监听端口: %d\n", port)) - output.WriteString(fmt.Sprintf("平台: %s\n\n", runtime.GOOS)) + fmt.Fprintf(&output, "监听端口: %d\n", port) + fmt.Fprintf(&output, "平台: %s\n\n", runtime.GOOS) // 启动正向Shell服务器 err := p.startForwardShellServer(ctx, port, state) if err != nil { - output.WriteString(fmt.Sprintf("正向Shell服务器错误: %v\n", err)) + fmt.Fprintf(&output, "正向Shell服务器错误: %v\n", err) return &plugins.Result{ Success: false, Output: output.String(),