aboutsummaryrefslogtreecommitdiff
path: root/cmd/root.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/root.go')
-rw-r--r--cmd/root.go46
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)
+ }
}
}