Default string bindings for TSCH,SCMR

This commit is contained in:
Bryan McNulty
2025-08-11 09:11:23 -05:00
parent 18c417feb4
commit 420fbd90c6
5 changed files with 21 additions and 14 deletions
+10 -3
View File
@@ -22,7 +22,7 @@ func registerNetworkFlags(fs *pflag.FlagSet) {
fs.StringVarP(&proxy, "proxy", "x", "", "Proxy `URI`")
fs.StringVarP(&rpcClient.Filter, "epm-filter", "F", "", "String binding to filter endpoints returned by the RPC endpoint mapper (EPM)")
fs.StringVar(&rpcClient.Endpoint, "endpoint", "", "Explicit RPC endpoint definition")
fs.BoolVar(&rpcClient.NoEpm, "no-epm", false, "Do not use EPM to automatically detect RPC endpoints")
fs.BoolVar(&rpcClient.NoEpm, "no-epm", false, "Don't use EPM to discover RPC endpoints")
fs.BoolVar(&rpcClient.NoSign, "no-sign", false, "Disable signing on DCERPC messages")
fs.BoolVar(&rpcClient.NoSeal, "no-seal", false, "Disable packet stub encryption on DCERPC messages")
@@ -118,12 +118,19 @@ func argsSmbClient() func(cmd *cobra.Command, args []string) error {
)
}
func argsRpcClient(proto string) func(cmd *cobra.Command, args []string) error {
func argsRpcClient(proto string, endpoint string) func(cmd *cobra.Command, args []string) error {
return args(
argsTarget(proto),
func(cmd *cobra.Command, args []string) (err error) {
if rpcClient.Endpoint == "" {
if endpoint != "" {
rpcClient.Endpoint = endpoint
rpcClient.NoEpm = true
} else {
rpcClient.NoEpm = false
}
}
rpcClient.Target = target
rpcClient.Credential = credential
rpcClient.Proxy = proxy
+3 -3
View File
@@ -108,7 +108,7 @@ var (
The mmc method uses the exposed MMC20.Application object to call Document.ActiveView.ShellExec,
and ultimately spawn a process on the remote host.`,
Args: args(
argsRpcClient("host"),
argsRpcClient("host", ""),
argsOutput("smb"),
argsAcceptValues("window", &dcomMmc.WindowState, "Minimized", "Maximized", "Restored"),
),
@@ -135,7 +135,7 @@ var (
The shellwindows method uses the exposed ShellWindows DCOM object on older Windows installations
to call Item().Document.Application.ShellExecute, and spawn the provided process.`,
Args: args(
argsRpcClient("host"),
argsRpcClient("host", ""),
argsOutput("smb"),
argsAcceptValues("app-window", &dcomShellWindows.WindowState, "0", "1", "2", "3", "4", "5", "7", "10"),
),
@@ -162,7 +162,7 @@ var (
The shellbrowserwindow method uses the exposed ShellBrowserWindow DCOM object on older Windows installations
to call Document.Application.ShellExecute, and spawn the provided process.`,
Args: args(
argsRpcClient("host"),
argsRpcClient("host", ""),
argsOutput("smb"),
argsAcceptValues("app-window", &dcomShellBrowserWindow.WindowState, "0", "1", "2", "3", "4", "5", "7", "10"),
),
+3 -3
View File
@@ -139,7 +139,7 @@ var (
The create method calls RCreateServiceW to create a new Windows service on the
remote target with the provided executable & arguments as the lpBinaryPathName`,
Args: args(
argsRpcClient("cifs"),
argsRpcClient("cifs", "ncacn_np:[svcctl]"),
argsSmbClient(),
),
@@ -183,7 +183,7 @@ var (
using the RChangeServiceConfigW method rather than calling RCreateServiceW
like scmr create. The modified service is restored to its original state
after execution`,
Args: argsRpcClient("cifs"),
Args: argsRpcClient("cifs", "ncacn_np:[svcctl]"),
Run: func(cmd *cobra.Command, args []string) {
scmrChange.Client = &rpcClient
@@ -205,7 +205,7 @@ var (
Long: `Description:
The delete method will simply delete the provided service.`,
Args: argsRpcClient("cifs"),
Args: argsRpcClient("cifs", "ncacn_np:[svcctl]"),
Run: func(cmd *cobra.Command, args []string) {
scmrDelete.Client = &rpcClient
+3 -3
View File
@@ -152,7 +152,7 @@ var (
But rather than setting a defined time when the task will start, it will
additionally call SchRpcRun to forcefully start the task.`,
Args: args(
argsRpcClient("cifs"),
argsRpcClient("cifs", "ncacn_np:[atsvc]"),
argsOutput("smb"),
argsTask,
),
@@ -181,7 +181,7 @@ var (
and can even avoid calling SchRpcDelete by populating the DeleteExpiredTaskAfter
Setting.`,
Args: args(
argsRpcClient("cifs"),
argsRpcClient("cifs", "ncacn_np:[atsvc]"),
argsOutput("smb"),
argsTask,
),
@@ -208,7 +208,7 @@ var (
The change method calls SchRpcRetrieveTask to fetch the definition of an existing
task (-t), then modifies the task definition to spawn a process`,
Args: args(
argsRpcClient("cifs"),
argsRpcClient("cifs", "ncacn_np:[atsvc]"),
argsOutput("smb"),
func(*cobra.Command, []string) error {
+2 -2
View File
@@ -90,7 +90,7 @@ var (
The call method creates an instance of the specified WMI class (-c),
then calls the provided method (-m) with the provided arguments (-A).`,
Args: args(
argsRpcClient("cifs"),
argsRpcClient("cifs", ""),
func(cmd *cobra.Command, args []string) error {
return json.Unmarshal([]byte(wmiArguments), &wmiCall.Args)
}),
@@ -118,7 +118,7 @@ var (
calls the Win32_Process.Create method with the provided command (-c),
and optional working directory (-d).`,
Args: args(
argsRpcClient("cifs"),
argsRpcClient("cifs", ""),
argsOutput("smb"),
),