From 840b8ea65630c83e3d9d2e55b6a7d143fdac476a Mon Sep 17 00:00:00 2001 From: Bryan McNulty Date: Mon, 28 Apr 2025 00:38:49 -0500 Subject: Fixed some issues with SMB client --- pkg/goexec/smb/client.go | 2 +- pkg/goexec/smb/options.go | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pkg/goexec/smb/client.go b/pkg/goexec/smb/client.go index d95481c..a9e0e11 100644 --- a/pkg/goexec/smb/client.go +++ b/pkg/goexec/smb/client.go @@ -58,7 +58,7 @@ func (c *Client) Connect(ctx context.Context) (err error) { } // Establish TCP connection - c.conn, err = c.netDialer.Dial("tcp", net.JoinHostPort(c.Host, fmt.Sprintf("%d", c.Port))) + c.conn, err = c.netDialer.Dial("tcp", net.JoinHostPort(c.Host, "445")) if err != nil { return err diff --git a/pkg/goexec/smb/options.go b/pkg/goexec/smb/options.go index ce99bc7..413129f 100644 --- a/pkg/goexec/smb/options.go +++ b/pkg/goexec/smb/options.go @@ -8,6 +8,7 @@ import ( "github.com/RedTeamPentesting/adauth/smbauth" msrpcSMB2 "github.com/oiweiwei/go-msrpc/smb2" "github.com/oiweiwei/go-smb2.fork" + "net" ) var supportedDialects = map[msrpcSMB2.Dialect]msrpcSMB2.Dialect{ @@ -57,6 +58,17 @@ func (c *Client) Parse(ctx context.Context) (err error) { } } + if c.Proxy == "" { + c.netDialer = &net.Dialer{} + + } else { + // Parse proxy URL + c.netDialer, err = goexec.ParseProxyURI(c.Proxy) + if err != nil { + return err + } + } + if !c.NoSeal { // Enable encryption do = append(do, msrpcSMB2.WithSeal()) -- cgit v1.2.3