aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorBryan McNulty <bryanmcnulty@protonmail.com>2025-03-12 08:23:41 -0500
committerBryan McNulty <bryanmcnulty@protonmail.com>2025-03-12 08:23:41 -0500
commitf0282781781bc9426f6c692226a01f54418c5923 (patch)
treecd9e0f3b241132cdc4e90e817a4aa465a6ae3717 /cmd
parent776253d266e674b37eceb9d9f2c6feccaa3a9a5c (diff)
downloadgoexec-f0282781781bc9426f6c692226a01f54418c5923.tar.gz
goexec-f0282781781bc9426f6c692226a01f54418c5923.zip
Small optimizations
Diffstat (limited to 'cmd')
-rw-r--r--cmd/root.go10
-rw-r--r--cmd/rpc.go8
-rw-r--r--cmd/tsch.go2
3 files changed, 17 insertions, 3 deletions
diff --git a/cmd/root.go b/cmd/root.go
index 116ed21..f596c75 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -17,7 +17,12 @@ var (
ctx context.Context
authOpts *adauth.Options
- debug bool
+ hostname string
+
+ // Root flags
+ debug bool
+
+ // Generic flags
command string
executable string
executablePath string
@@ -62,6 +67,9 @@ func needsTarget(proto string) func(cmd *cobra.Command, args []string) error {
if target == nil {
return fmt.Errorf("no target supplied")
}
+ if hostname, err = target.Hostname(ctx); err != nil {
+ log.Debug().Err(err).Msg("Could not get target hostname")
+ }
return
}
}
diff --git a/cmd/rpc.go b/cmd/rpc.go
index 816e17f..d67609b 100644
--- a/cmd/rpc.go
+++ b/cmd/rpc.go
@@ -12,6 +12,9 @@ import (
func needsRpcTarget(proto string) func(cmd *cobra.Command, args []string) error {
return func(cmd *cobra.Command, args []string) (err error) {
+ if err = needsTarget(proto)(cmd, args); err != nil {
+ return err
+ }
if argDceStringBinding != "" {
dceConfig.Endpoint, err = dcerpc.ParseStringBinding(argDceStringBinding)
if err != nil {
@@ -29,6 +32,9 @@ func needsRpcTarget(proto string) func(cmd *cobra.Command, args []string) error
return fmt.Errorf("failed to parse EPM filter: %w", err)
}
}
+ if hostname != "" {
+ dceConfig.DceOptions = append(dceConfig.DceOptions, dcerpc.WithTargetName(fmt.Sprintf("%s/%s", proto, hostname)))
+ }
if !argDceNoSign {
dceConfig.DceOptions = append(dceConfig.DceOptions, dcerpc.WithSign())
dceConfig.EpmOptions = append(dceConfig.EpmOptions, dcerpc.WithSign())
@@ -39,7 +45,7 @@ func needsRpcTarget(proto string) func(cmd *cobra.Command, args []string) error
dceConfig.DceOptions = append(dceConfig.DceOptions, dcerpc.WithSeal(), dcerpc.WithSecurityLevel(dcerpc.AuthLevelPktPrivacy))
dceConfig.EpmOptions = append(dceConfig.EpmOptions, dcerpc.WithSeal(), dcerpc.WithSecurityLevel(dcerpc.AuthLevelPktPrivacy))
}
- return needsTarget(proto)(cmd, args)
+ return nil
}
}
diff --git a/cmd/tsch.go b/cmd/tsch.go
index c7ab3a3..9abb3eb 100644
--- a/cmd/tsch.go
+++ b/cmd/tsch.go
@@ -87,7 +87,7 @@ var (
tschCmd = &cobra.Command{
Use: "tsch",
- Short: "Establish execution via TSCH (ITaskSchedulerService)",
+ Short: "Establish execution via TSCH",
Args: cobra.NoArgs,
}
tschRegisterCmd = &cobra.Command{