fix: clear handler caused issues on some terminals, fixed by using os specific clear command

This commit is contained in:
evilsocket 2019-03-22 21:28:57 +01:00
commit c7f28855ca
No known key found for this signature in database
GPG key ID: 1564D7F30393A456

View file

@ -4,7 +4,9 @@ import (
"bufio"
"fmt"
"os"
"os/exec"
"path/filepath"
"runtime"
"sort"
"strconv"
"strings"
@ -249,13 +251,14 @@ func (s *Session) readHandler(args []string, sess *Session) error {
}
func (s *Session) clsHandler(args []string, sess *Session) error {
// fixes a weird bug which causes the screen not to be fully
// cleared if a "clear; net.show" commands chain is executed
// in the interactive session.
for i := 0; i < 180; i++ {
fmt.Println()
cmd := "clear"
if runtime.GOOS == "windows" {
cmd = "cls"
}
readline.ClearScreen(s.Input.Stdout())
c := exec.Command(cmd)
c.Stdout = os.Stdout
c.Run()
return nil
}