■ ■ ■ ■ ■ ■
internal/server/handlers/session.go
skipped 1 lines 2 2 3 3 import ( 4 4 "fmt" 5 + "io" 5 6 6 7 "github.com/NHAS/reverse_ssh/internal" 8 + "github.com/NHAS/reverse_ssh/internal/server/clients" 7 9 "github.com/NHAS/reverse_ssh/internal/server/commands" 10 + "github.com/NHAS/reverse_ssh/internal/server/webserver" 8 11 "github.com/NHAS/reverse_ssh/internal/terminal" 12 + "github.com/NHAS/reverse_ssh/internal/terminal/autocomplete" 9 13 "github.com/NHAS/reverse_ssh/pkg/logger" 10 14 "golang.org/x/crypto/ssh" 11 15 ) skipped 52 lines 64 68 // (i.e. no command in the Payload) 65 69 req.Reply(len(req.Payload) == 0, nil) 66 70 67 - //This blocks so will keep the channel from defer closing 68 - shell(user, connection, log) 71 + term := terminal.NewAdvancedTerminal(connection, user, "catcher$ ") 72 + 73 + term.SetSize(int(user.Pty.Columns), int(user.Pty.Rows)) 74 + 75 + term.AddValueAutoComplete(autocomplete.RemoteId, clients.Autocomplete) 76 + term.AddValueAutoComplete(autocomplete.WebServerFileIds, webserver.Autocomplete) 77 + 78 + term.AddCommands(commands.CreateCommands(user, log)) 79 + 80 + err := term.Run() 81 + if err != nil && err != io.EOF { 82 + log.Error("Error: %s", err) 83 + } 69 84 70 85 return 71 86 //Yes, this is here for a reason future me. Despite the RFC saying "Only one of shell,subsystem, exec can occur per channel" pty-req actuall proceeds all of them skipped 21 lines