mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
yeah i should have done this before, i know
This commit is contained in:
commit
0091ffdbb3
33 changed files with 25678 additions and 0 deletions
25
core/core.go
Normal file
25
core/core.go
Normal file
|
@ -0,0 +1,25 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"github.com/op/go-logging"
|
||||
"os/exec"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var log = logging.MustGetLogger("mitm")
|
||||
|
||||
func Exec(executable string, args []string) (string, error) {
|
||||
path, err := exec.LookPath(executable)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
log.Debugf(DIM+"Exec( '%s %s' )"+RESET+"\n", path, strings.Join(args, " "))
|
||||
raw, err := exec.Command(path, args...).CombinedOutput()
|
||||
if err != nil {
|
||||
log.Errorf(" err=%s out='%s'\n", err, raw)
|
||||
return "", err
|
||||
} else {
|
||||
return strings.Trim(string(raw), "\r\n\t "), nil
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue