/
structs.go
90 lines (81 loc) 路 2.02 KB
/
structs.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
79
80
81
82
83
84
85
86
87
88
89
90
package cmd
import (
"time"
)
// metaConfig is the overarching context used by most functions in aeacus.
type metaConfig struct {
DirPath string
TeamID string
Config scoringChecks
Image imageData
Conn connData
Connection bool
ShellActive bool
}
// imageData is the current scoring data for the image. It is able to be
// wiped, removed, etc, on each run without affecting anything else.
type imageData struct {
RunningTime time.Time
Contribs int
Detracts int
Score int
ScoredVulns int
TotalPoints int
Penalties []scoreItem
Points []scoreItem
}
// connData represents the current connectivity state of the image to the
// internet and the scoring server.
type connData struct {
OverallColor string
OverallStatus string
NetColor string
NetStatus string
ServerColor string
ServerStatus string
}
// scoreItem is the scoring report representation of a check, containing only
// the message and points associated with it.
type scoreItem struct {
Message string
Points int
}
// scoringChecks is a representation of the TOML configuration typically
// specific in scoring.conf.
type scoringChecks struct {
DisableShell bool
Local bool
NoDestroy bool
EndDate string
Name string
OS string
Password string
Remote string
Title string
User string
Version string
Check []check
}
// check is the smallest unit that can show up on a scoring report. It holds
// all the conditions for a check, and its message and points (autogenerated or
// otherwise).
type check struct {
Message string
Points int
Fail []condition
Pass []condition
PassOverride []condition
}
// condition is a single pass/fail condition inside of a check. It supports up
// to four arguments.
type condition struct {
Type string
Arg1 string
Arg2 string
Arg3 string
Arg4 string
}
// statusRes is to parse a JSON response from the remote server
type statusRes struct {
Status string `json:"status"`
}