Skip to content

Commit

Permalink
perf(evaluate): support two new formatted print func
Browse files Browse the repository at this point in the history
  • Loading branch information
neargle committed Sep 25, 2022
1 parent 950705e commit 8e5e40d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
7 changes: 5 additions & 2 deletions pkg/evaluate/evaluate.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ func CallBasics() {
util.PrintH2("Information Gathering - Sysctl Variables")
CheckRouteLocalNetworkValue()

util.PrintH2("Information Gathering - DNS-Based Service Discovery")
DNSBasedServiceDiscovery()

util.PrintH2("Discovery - K8s API Server")
CheckK8sAnonymousLogin()

Expand All @@ -53,8 +56,8 @@ func CallBasics() {
util.PrintH2("Discovery - Cloud Provider Metadata API")
CheckCloudMetadataAPI()

util.PrintH2("Information Gathering - DNS-Based Service Discovery")
DNSBasedServiceDiscovery()
util.PrintH2("Exploit Pre - Kernel Exploits")
kernelExploitSuggester()
}

func CallAddedFunc() {
Expand Down
8 changes: 7 additions & 1 deletion pkg/evaluate/evaluate_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
Copyright 2022 The Authors of https://github.com/CDK-TEAM/CDK .
Expand All @@ -20,6 +19,8 @@ package evaluate
import (
"fmt"
"testing"

"github.com/cdk-team/CDK/pkg/util"
)

func TestDumpCgroup(t *testing.T) {
Expand All @@ -31,3 +32,8 @@ func TestFindSidFiles(t *testing.T) {
fmt.Printf("\n[Information Gathering - SIDs]\n")
FindSidFiles()
}

func TestKernelExploitSuggester(t *testing.T) {
util.PrintH2("Exploit Pre - Kernel Exploits")
kernelExploitSuggester()
}
12 changes: 12 additions & 0 deletions pkg/util/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,15 @@ func PrintItemValue(value string, color bool) {
}
}

func PrintItemValueWithKeyOneLine(key, value string, color bool) {
if color {
log.Printf("%s: %s", key, GreenBold.Sprint(value))
} else {
log.Printf("%s: %s", key, value)
}
}

func PrintOrignal(out string) {
fmt.Printf("%s\n", out)
}

0 comments on commit 8e5e40d

Please sign in to comment.