forked from iamacarpet/go-win64api
-
Notifications
You must be signed in to change notification settings - Fork 1
/
session.go
executable file
·52 lines (46 loc) · 1.28 KB
/
session.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
43
44
45
46
47
48
49
50
51
52
package shared
import (
"fmt"
"time"
)
const (
SESS_INTERACTIVE_LOGON = 2
SESS_REMOTE_INTERACTIVE_LOGON = 10
SESS_CACHED_INTERACTIVE_LOGON = 11
)
type SessionDetails struct {
Username string `json:"username"`
Domain string `json:"domain"`
LogonId string `json:"logonId"`
LocalUser bool `json:"isLocal"`
LocalAdmin bool `json:"isAdmin"`
LogonType uint32 `json:"logonType"`
LogonTime time.Time `json:"logonTime"`
DnsDomainName string `json:"dnsDomainName"`
AuthenticationPackage string `json:"authenticationPackage"`
LogonServer string `json:"logonServer"`
}
type NetworkSession struct {
Clientname string
Username string
NumOpens uint32
Time time.Duration
IdleTime time.Duration
UserFlags uint32
ClientType string
}
func (s *SessionDetails) FullUser() string {
return fmt.Sprintf("%s\\%s", s.Domain, s.Username)
}
func (s *SessionDetails) GetLogonType() string {
switch s.LogonType {
case SESS_INTERACTIVE_LOGON:
return "INTERACTIVE_LOGON"
case SESS_REMOTE_INTERACTIVE_LOGON:
return "REMOTE_INTERACTIVE_LOGON"
case SESS_CACHED_INTERACTIVE_LOGON:
return "CACHED_INTERACTIVE_LOGON"
default:
return "UNKNOWN"
}
}