Skip to content

Commit

Permalink
[+][#11] Using different colored output to distinguish user input and…
Browse files Browse the repository at this point in the history
… victim output
  • Loading branch information
WangYihang committed Feb 29, 2020
1 parent 76a499d commit 2023768
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/cli/dispatcher/interact.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/WangYihang/Platypus/lib/context"
"github.com/WangYihang/Platypus/lib/util/log"
"github.com/WangYihang/Platypus/lib/util/timeout"
"github.com/fatih/color"
)

func (dispatcher Dispatcher) Interact(args []string) {
Expand Down Expand Up @@ -37,14 +38,16 @@ func (dispatcher Dispatcher) Interact(args []string) {
}()

// read from socket fd
printer := color.New(color.FgCyan)

go func() {
for {
if context.Ctx.Current == nil || !context.Ctx.Current.Interactive {
return
}

buffer, _ := context.Ctx.Current.Read(timeout.GenerateTimeout())
fmt.Print(buffer)
printer.Print(buffer)
}
}()

Expand All @@ -70,7 +73,6 @@ func (dispatcher Dispatcher) Interact(args []string) {
}
// Send command
inputChannel <- []byte(command + "\n")

}
}

Expand Down

0 comments on commit 2023768

Please sign in to comment.