-
-
Notifications
You must be signed in to change notification settings - Fork 150
/
Copy pathwho.go
42 lines (31 loc) · 739 Bytes
/
who.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
30
31
32
33
34
35
36
37
38
39
40
41
42
package commands
import (
"fmt"
"io"
"github.com/NHAS/reverse_ssh/internal/server/users"
"github.com/NHAS/reverse_ssh/internal/terminal"
)
type who struct {
}
func (w *who) ValidArgs() map[string]string {
return map[string]string{}
}
func (w *who) Run(user *users.User, tty io.ReadWriter, line terminal.ParsedLine) error {
allUsers := users.ListUsers()
for _, user := range allUsers {
fmt.Fprintf(tty, "%s\n", user)
}
return nil
}
func (w *who) Expect(line terminal.ParsedLine) []string {
return nil
}
func (w *who) Help(explain bool) string {
const description = "List users connected to the RSSH server"
if explain {
return description
}
return terminal.MakeHelpText(w.ValidArgs(),
"who",
description)
}