■ ■ ■ ■ ■ ■
internal/client/handlers/session.go
| skipped 15 lines |
16 | 16 | | "github.com/NHAS/reverse_ssh/internal/client/handlers/subsystems" |
17 | 17 | | "github.com/NHAS/reverse_ssh/pkg/logger" |
18 | 18 | | "github.com/NHAS/reverse_ssh/pkg/storage" |
| 19 | + | |
19 | 20 | | "golang.org/x/crypto/ssh" |
20 | 21 | | ) |
| 22 | + | |
| 23 | + | func ServerConsoleSession(ServerConn ssh.Conn) internal.ChannelHandler { |
| 24 | + | |
| 25 | + | user, err := internal.CreateUser(ServerConn) |
| 26 | + | |
| 27 | + | return func(_ *internal.User, newChannel ssh.NewChannel, log logger.Logger) { |
| 28 | + | if err != nil { |
| 29 | + | log.Error("Unable to add user %s\n", err) |
| 30 | + | newChannel.Reject(ssh.ConnectionFailed, err.Error()) |
| 31 | + | return |
| 32 | + | } |
| 33 | + | |
| 34 | + | Session(user, newChannel, log) |
| 35 | + | } |
| 36 | + | |
| 37 | + | } |
21 | 38 | | |
22 | 39 | | // Session has a lot of 'function' in ssh. It can be used for shell, exec, subsystem, pty-req and more. |
23 | 40 | | // However these calls are done through requests, rather than opening a new channel |
| skipped 209 lines |