forked from Velocidex/velociraptor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathusers.go
executable file
·39 lines (36 loc) · 905 Bytes
/
users.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
package velociraptor
import (
"github.com/shirou/gopsutil/host"
"github.com/shirou/gopsutil/net"
"www.velocidex.com/golang/vfilter"
)
func MakeUsersPlugin() vfilter.GenericListPlugin {
return vfilter.GenericListPlugin{
PluginName: "users",
Function: func(args vfilter.Dict) []vfilter.Row {
var result []vfilter.Row
if users, err := host.Users(); err == nil {
for _, item := range users {
result = append(result, item)
}
}
return result
},
RowType: host.UserStat{},
}
}
func MakeConnectionsPlugin() vfilter.GenericListPlugin {
return vfilter.GenericListPlugin{
PluginName: "connections",
Function: func(args vfilter.Dict) []vfilter.Row {
var result []vfilter.Row
if cons, err := net.Connections("all"); err == nil {
for _, item := range cons {
result = append(result, item)
}
}
return result
},
RowType: net.ConnectionStat{},
}
}