mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
new: centralized logging and implemented DELETE /api/events route, closes #5
This commit is contained in:
parent
269d7d845b
commit
f1f146d3d7
21 changed files with 144 additions and 184 deletions
|
@ -1,23 +1,20 @@
|
|||
package core
|
||||
|
||||
import (
|
||||
"github.com/op/go-logging"
|
||||
"fmt"
|
||||
"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)
|
||||
fmt.Printf("ERROR: path=%s args=%s err=%s out='%s'\n", path, args, 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