diff options
author | Bryan McNulty <bryanmcnulty@protonmail.com> | 2025-04-17 23:42:45 -0500 |
---|---|---|
committer | Bryan McNulty <bryanmcnulty@protonmail.com> | 2025-04-17 23:42:45 -0500 |
commit | 5d2734e51b62f7048dc8be25cca05fb71da4f521 (patch) | |
tree | 6e25fb1259a689e11b626807ed6815813e66a5b6 /cmd/root.go | |
parent | 91ca789d8b190692876f76758bf41fad66edbdb9 (diff) | |
download | goexec-5d2734e51b62f7048dc8be25cca05fb71da4f521.tar.gz goexec-5d2734e51b62f7048dc8be25cca05fb71da4f521.zip |
Separate adauth flags
Diffstat (limited to 'cmd/root.go')
-rw-r--r-- | cmd/root.go | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/cmd/root.go b/cmd/root.go index 46e8595..300588d 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -40,7 +40,7 @@ var ( Output: new(goexec.ExecutionOutput), } - authOpts *adauth.Options + adAuthOpts *adauth.Options credential *adauth.Credential target *adauth.Target @@ -103,6 +103,13 @@ var ( ) func init() { + // Auth init + { + gssapi.AddMechanism(ssp.SPNEGO) + gssapi.AddMechanism(ssp.NTLM) + gssapi.AddMechanism(ssp.KRB5) + } + // Cobra init { cobra.EnableCommandSorting = false @@ -127,24 +134,27 @@ func init() { rootCmd.PersistentFlags().AddFlagSet(netOpts) } - dcomCmdInit() - rootCmd.AddCommand(dcomCmd) - wmiCmdInit() - rootCmd.AddCommand(wmiCmd) - scmrCmdInit() - rootCmd.AddCommand(scmrCmd) - tschCmdInit() - rootCmd.AddCommand(tschCmd) - } - - // Auth init - { - gssapi.AddMechanism(ssp.SPNEGO) - gssapi.AddMechanism(ssp.NTLM) - gssapi.AddMechanism(ssp.KRB5) + // Authentication flags + { + adAuthOpts = &adauth.Options{ + Debug: log.Debug().Msgf, + } + authOpts := pflag.NewFlagSet("Authentication", pflag.ExitOnError) + adAuthOpts.RegisterFlags(authOpts) + rootCmd.PersistentFlags().AddFlagSet(authOpts) + } - authOpts = &adauth.Options{Debug: log.Debug().Msgf} - authOpts.RegisterFlags(rootCmd.PersistentFlags()) + // Modules init + { + dcomCmdInit() + rootCmd.AddCommand(dcomCmd) + wmiCmdInit() + rootCmd.AddCommand(wmiCmd) + scmrCmdInit() + rootCmd.AddCommand(scmrCmd) + tschCmdInit() + rootCmd.AddCommand(tschCmd) + } } } |