mirror of
https://github.com/alvierahman90/gohookr.git
synced 2026-01-26 16:34:00 +00:00
Move config to separate package
This commit is contained in:
19
config/command.go
Normal file
19
config/command.go
Normal file
@@ -0,0 +1,19 @@
|
||||
package config
|
||||
|
||||
import "os/exec"
|
||||
|
||||
type Command struct {
|
||||
Program string
|
||||
Arguments []string
|
||||
AppendPayload bool
|
||||
}
|
||||
|
||||
func (c Command) Execute(payload string) ([]byte, error) {
|
||||
arguments := make([]string, 0)
|
||||
copy(c.Arguments, arguments)
|
||||
if c.AppendPayload {
|
||||
arguments = append(arguments, payload)
|
||||
}
|
||||
|
||||
return exec.Command(c.Program, arguments...).Output()
|
||||
}
|
||||
Reference in New Issue
Block a user