func HandleTerminalReading(channel ssh.Channel, term *terminal.Terminal) { defer channel.Close() for { line, err := term.ReadLine() if err != nil { break } cmd_log := Command{Cmd: string(line)} if strings.Contains(string(line), "exit") { logfile.Println("[exit requested]") channel.Close() } if line == "passwd" { line, _ := term.ReadPassword("Enter new UNIX password: "******"[password changed]: " + line) line, _ = term.ReadPassword("Retype new UNIX password: "******"[password changed confirmation]: " + line) term.Write([]byte("passwd: password updated successfully\r\n")) cmd_log.Cmd += " " + line } else { term.Write(RunCommand(line)) } cmd_log.Save() logfile.Println(line) } }