blob: 6e18378710b07b1a9b05417d571df546e628a35f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
package exec
import (
"context"
"github.com/bryanmcnulty/adauth"
)
type ExecutionConfig struct {
ExecutableName string // ExecutableName represents the name of the executable; i.e. "notepad.exe", "calc"
ExecutablePath string // ExecutablePath represents the full path to the executable; i.e. `C:\Windows\explorer.exe`
ExecutableArgs string // ExecutableArgs represents the arguments to be passed to the executable during execution; i.e. "/C whoami"
ExecutionMethod string // ExecutionMethod represents the specific execution strategy used by the module.
ExecutionMethodConfig interface{}
ExecutionOutput string // not implemented
ExecutionOutputConfig interface{} // not implemented
}
type ShellConfig struct {
ShellName string // ShellName specifies the name of the shell executable; i.e. "cmd.exe", "powershell"
ShellPath string // ShellPath is the full Windows path to the shell executable; i.e. `C:\Windows\System32\cmd.exe`
}
type Executor interface {
// Exec performs a single execution task without the need to call Init.
Exec(ctx context.Context, creds *adauth.Credential, target *adauth.Target, config *ExecutionConfig)
// Init assigns the provided TODO
//Init(ctx context.Context, creds *adauth.Credential, target *adauth.Target)
//Shell(ctx context.Context, input chan *ExecutionConfig, output chan []byte)
}
func (cfg *ExecutionConfig) GetRawCommand() string {
if cfg.ExecutableArgs != "" {
return cfg.ExecutablePath + " " + cfg.ExecutableArgs
}
return cfg.ExecutablePath
}
|