-
-
Notifications
You must be signed in to change notification settings - Fork 214
/
pty.go
29 lines (24 loc) · 955 Bytes
/
pty.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package dispatcher
import (
"fmt"
"github.com/WangYihang/Platypus/internal/context"
"github.com/WangYihang/Platypus/internal/util/log"
)
func (dispatcher commandDispatcher) PTY(args []string) {
if context.Ctx.Current == nil {
log.Error("The current client is not set, please use `Jump` to set the current client")
return
}
if err := context.Ctx.Current.EstablishPTY(); err != nil {
log.Error("Establish PTY failed: %s", err)
}
}
func (dispatcher commandDispatcher) PTYHelp(args []string) {
fmt.Println("Usage of PTY")
fmt.Println("\tFirst use `Jump` to select a client, then type `PTY`, then type `Interact` to drop into a fully interactive shell.")
fmt.Println("\tYou can just simply type `exit` to exit pty mode")
}
func (dispatcher commandDispatcher) PTYDesc(args []string) {
fmt.Println("PTY")
fmt.Println("\tTry to Spawn '/bin/bash' via Python, then the shell is fully interactive (You can use vim / htop and other stuffs)")
}