MCPcopy
hub / github.com/bettercap/bettercap / Exec

Function Exec

core/core.go:37–52  ·  view source on GitHub ↗
(executable string, args []string)

Source from the content-addressed store, hash-verified

35}
36
37func Exec(executable string, args []string) (string, error) {
38 path, err := exec.LookPath(executable)
39 if err != nil {
40 log.Warning("executable %s not found in $PATH", executable)
41 return "", err
42 }
43
44 raw, err := exec.Command(path, args...).CombinedOutput()
45
46 log.Debug("exec=%s args=%v ret_err=%v ret_out=%s", path, args, err, string(raw))
47 if err != nil {
48 return str.Trim(string(raw)), err
49 } else {
50 return str.Trim(string(raw)), nil
51 }
52}

Callers 15

runRuleMethod · 0.92
setMacMethod · 0.92
wifiBruteforceFunction · 0.92
ForceMonitorModeFunction · 0.92
SetInterfaceChannelFunction · 0.92
iwSupportedFrequenciesFunction · 0.92
ArpUpdateFunction · 0.92
SetWiFiRegionFunction · 0.92
ActivateInterfaceFunction · 0.92
SetInterfaceTxPowerFunction · 0.92
FindGatewayFunction · 0.92

Calls 2

WarningFunction · 0.92
DebugFunction · 0.92

Tested by 2

TestExecFunction · 0.68
TestExecWithOutputFunction · 0.68