fix: 修复反弹shell连接冲突导致的秒断问题

- 移除Connect方法中的连通性测试,避免抢占反弹shell连接通道
- 清理未使用的time包导入
- 提高反弹shell连接的稳定性和成功率
This commit is contained in:
ZacharyZcR 2025-08-10 06:06:46 +08:00
parent 551d36b998
commit fead006830

View File

@ -11,7 +11,6 @@ import (
"runtime" "runtime"
"strconv" "strconv"
"strings" "strings"
"time"
"github.com/shadow1ng/fscan/common" "github.com/shadow1ng/fscan/common"
"github.com/shadow1ng/fscan/plugins/base" "github.com/shadow1ng/fscan/plugins/base"
@ -106,12 +105,8 @@ func (c *ReverseShellConnector) Connect(ctx context.Context, info *common.HostIn
baseConn := localConn.(*local.LocalConnection) baseConn := localConn.(*local.LocalConnection)
// 测试目标地址连通性 // 跳过连通性测试避免抢占反弹shell连接通道
conn, err := net.DialTimeout("tcp", fmt.Sprintf("%s:%d", c.host, c.port), 5*time.Second) // 反弹shell会在实际使用时进行连接这里不需要预先测试
if err != nil {
return nil, fmt.Errorf("无法连接到目标地址 %s:%d: %v", c.host, c.port, err)
}
conn.Close()
reverseShellConn := &ReverseShellConnection{ reverseShellConn := &ReverseShellConnection{
LocalConnection: baseConn, LocalConnection: baseConn,