forked from aquasecurity/avd-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
95 lines (77 loc) · 2.54 KB
/
main.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
91
92
93
94
95
package main
import (
"fmt"
"os"
"strconv"
"time"
"github.com/aquasecurity/avd-generator/menu"
)
var (
Years []string
misConfigurationMenu = menu.New("misconfig", "content/misconfig")
complianceMenu = menu.New("compliance", "content/compliance")
runTimeSecurityMenu = menu.New("runsec", "content/tracee")
)
type Clock interface {
Now(format ...string) string
}
type realClock struct{}
func (realClock) Now(format ...string) string {
formatString := time.RFC3339
if len(format) > 0 {
formatString = format[0]
}
return time.Now().Format(formatString)
}
func main() {
firstYear := 1999
for y := firstYear; y <= time.Now().Year(); y++ {
Years = append(Years, strconv.Itoa(y))
}
generateChainBenchPages("../avd-repo/chain-bench-repo/internal/checks", "../avd-repo/content/compliance")
generateKubeBenchPages("../avd-repo/kube-bench-repo/cfg", "../avd-repo/content/compliance")
generateDefsecComplianceSpecPages("../avd-repo/trivy-policies-repo/rules/specs/compliance", "../avd-repo/content/compliance")
generateKubeHunterPages("../avd-repo/kube-hunter-repo/docs/_kb", "../avd-repo/content/misconfig/kubernetes")
generateCloudSploitPages("../avd-repo/cloudsploit-repo/plugins", "../avd-repo/content/misconfig", "../avd-repo/remediations-repo/en")
generateTraceePages("../avd-repo/tracee-repo/signatures", "../avd-repo/content/tracee", realClock{})
generateDefsecPages("../avd-repo/trivy-policies-repo/avd_docs", "../avd-repo/content/misconfig")
generateVulnPages()
for _, year := range Years {
generateReservedPages(year, realClock{}, "vuln-list-nvd", "content/nvd")
}
createTopLevelMenus()
}
func createTopLevelMenus() {
if err := menu.NewTopLevelMenu("Misconfiguration", "toplevel_page", "content/misconfig/_index.md").
WithHeading("Misconfiguration Categories").
WithIcon("aqua").
WithCategory("misconfig").Generate(); err != nil {
fail(err)
}
if err := menu.NewTopLevelMenu("Compliance", "toplevel_page", "content/compliance/_index.md").
WithHeading("Compliance").
WithIcon("aqua").
WithCategory("compliance").Generate(); err != nil {
fail(err)
}
if err := menu.NewTopLevelMenu("Tracee", "toplevel_page", "content/tracee/_index.md").
WithHeading("Runtime Security").
WithIcon("tracee").
WithCategory("runsec").
Generate(); err != nil {
fail(err)
}
if err := misConfigurationMenu.Generate(); err != nil {
fail(err)
}
if err := runTimeSecurityMenu.Generate(); err != nil {
fail(err)
}
if err := complianceMenu.Generate(); err != nil {
fail(err)
}
}
func fail(err error) {
fmt.Println(err)
os.Exit(1)
}