mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 18:57:17 -07:00
fix: remove extra spaces after the first command (fixes #178)
This commit is contained in:
parent
b151e98289
commit
641ae0cd00
1 changed files with 8 additions and 0 deletions
|
@ -8,6 +8,7 @@ import (
|
|||
"net"
|
||||
"os"
|
||||
"os/signal"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"runtime/pprof"
|
||||
"sort"
|
||||
|
@ -32,6 +33,8 @@ var (
|
|||
|
||||
ErrAlreadyStarted = errors.New("Module is already running.")
|
||||
ErrAlreadyStopped = errors.New("Module is not running.")
|
||||
|
||||
reCmdSpaceCleaner = regexp.MustCompile(`^([^\s]+)\s+(.+)$`)
|
||||
)
|
||||
|
||||
type Session struct {
|
||||
|
@ -479,6 +482,11 @@ func (s *Session) RunCaplet(filename string) error {
|
|||
|
||||
func (s *Session) Run(line string) error {
|
||||
line = core.TrimRight(line)
|
||||
// remove extra spaces after the first command
|
||||
// so that 'arp.spoof on' is normalized
|
||||
// to 'arp.spoof on' (fixes #178)
|
||||
line = reCmdSpaceCleaner.ReplaceAllString(line, "$1 $2")
|
||||
|
||||
for _, h := range s.CoreHandlers {
|
||||
if parsed, args := h.Parse(line); parsed == true {
|
||||
return h.Exec(args, s)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue