-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconst.go
78 lines (72 loc) · 2.03 KB
/
const.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package tclientlib
import (
"regexp"
)
var CodeTOASCII = map[byte]string{
IAC: "IAC",
WILL: "WILL",
WONT: "WONT",
DO: "DO",
DONT: "DONT",
SE: "SE",
SB: "SB",
BINARY: "BINARY",
ECHO: "ECHO",
RCP: "RCP",
SGA: "SGA",
NAMS: "NAMS",
STATUS: "STATUS ",
TM: "TM",
RCTE: "RCTE",
NAOL: "NAOL",
NAOP: "NAOP",
NAOCRD: "NAOCRD",
NAOHTS: "NAOHTS",
NAOHTD: "NAOHTD",
NAOFFD: "NAOFFD",
NAOVTS: "NAOVTS",
NAOVTD: "NAOVTD",
NAOLFD: "NAOLFD",
XASCII: "XASCII",
LOGOUT: "LOGOUT",
BM: "BM",
DET: "DET",
SUPDUP: "SUPDUP",
SUPDUPOUTPUT: "SUPDUPOUTPUT",
SNDLOC: "SNDLOC",
TTYPE: "TTYPE",
EOR: "EOR",
TUID: "TUID",
OUTMRK: "OUTMRK",
TTYLOC: "TTYLOC",
VT3270REGIME: "VT3270REGIME",
X3PAD: "X3PAD",
NAWS: "NAWS",
TSPEED: "TSPEED",
LFLOW: "LFLOW",
LINEMODE: "LINEMODE",
XDISPLOC: "XDISPLOC",
OLD_ENVIRON: "OLD_ENVIRON",
AUTHENTICATION: "AUTHENTICATION",
ENCRYPT: "ENCRYPT",
NEW_ENVIRON: "NEW_ENVIRON",
}
const (
usernameRegs = "(?i)login:?\\s*$|username:?\\s*$|name:?\\s*$|用户名:?\\s*$|账\\s*号:?\\s*$|user:?\\s*$"
passwordRegs = "(?i)Password:?\\s*$|ssword:?\\s*$|passwd:?\\s*$|密\\s*码:?\\s*$"
loginFailedRegs = "(?i)incorrect|failed|username\\s*or\\s*password\\s*error|失败|错误"
loginSuccessRegs = "(?i)Last\\s*login|login\\s*time|success|成功|#|>|\\$"
)
var (
DefaultUsernamePattern = regexp.MustCompile(usernameRegs)
DefaultPasswordPattern = regexp.MustCompile(passwordRegs)
DefaultLoginFailedPattern = regexp.MustCompile(loginFailedRegs)
DefaultLoginSuccessPattern = regexp.MustCompile(loginSuccessRegs)
)
type AuthStatus int
const (
AuthSuccess AuthStatus = iota
AuthPartial
AuthFailed
AUTHUnknown
)