aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan McNulty <bryanmcnulty@protonmail.com>2025-04-27 18:47:36 -0500
committerBryan McNulty <bryanmcnulty@protonmail.com>2025-04-27 18:47:36 -0500
commit10e2872f379335e38b9c8731555639f08126a5a6 (patch)
tree382c4b4bd466405da96da9fc86eda21f8457fb72
parent9638104bf79f6d706a17f0cf7b684660ef0cdec2 (diff)
downloadgoexec-10e2872f379335e38b9c8731555639f08126a5a6.tar.gz
goexec-10e2872f379335e38b9c8731555639f08126a5a6.zip
Negotiate (not force) highest SMB dialect
-rw-r--r--pkg/goexec/smb/options.go28
1 files changed, 6 insertions, 22 deletions
diff --git a/pkg/goexec/smb/options.go b/pkg/goexec/smb/options.go
index 4112abf..ce99bc7 100644
--- a/pkg/goexec/smb/options.go
+++ b/pkg/goexec/smb/options.go
@@ -8,7 +8,6 @@ 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{
@@ -47,29 +46,14 @@ func (c *Client) Parse(ctx context.Context) (err error) {
var do []msrpcSMB2.DialerOption
- if c.Port == 0 {
- c.Port = DefaultPort
- }
- if c.Dialect == 0 {
- c.Dialect = DefaultDialect
- }
-
- // Validate SMB dialect/version
- if d, ok := supportedDialects[c.Dialect]; ok {
- do = append(do, msrpcSMB2.WithDialect(d))
-
- } else {
- return errors.New("unsupported SMB version")
- }
+ if c.Dialect != 0 { // Use specific dialect
- if c.Proxy == "" {
- c.netDialer = &net.Dialer{} // FUTURE: additional dial c
+ // Validate SMB dialect/version
+ if d, ok := supportedDialects[c.Dialect]; ok {
+ do = append(do, msrpcSMB2.WithDialect(d))
- } else {
- // Parse proxy URL
- c.netDialer, err = goexec.ParseProxyURI(c.Proxy)
- if err != nil {
- return err
+ } else {
+ return errors.New("unsupported SMB version")
}
}