From bbb0d2154f4ca6ef121081ff06de52fa9f006ae5 Mon Sep 17 00:00:00 2001 From: dwertent Date: Sun, 30 Jan 2022 08:06:50 +0200 Subject: [PATCH 1/2] fixed version print --- cautils/versioncheck.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cautils/versioncheck.go b/cautils/versioncheck.go index 22f88c83..55f6417e 100644 --- a/cautils/versioncheck.go +++ b/cautils/versioncheck.go @@ -96,7 +96,7 @@ func (v *VersionCheckHandler) CheckLatestVersion(versionData *VersionCheckReques if latestVersion.ClientUpdate != "" { if BuildNumber != "" && BuildNumber < latestVersion.ClientUpdate { - WarningDisplay(os.Stderr, warningMessage(latestVersion.Client, latestVersion.ClientUpdate), "\n") + WarningDisplay(os.Stderr, warningMessage(latestVersion.Client, latestVersion.ClientUpdate)+"\n") } } @@ -106,7 +106,7 @@ func (v *VersionCheckHandler) CheckLatestVersion(versionData *VersionCheckReques // } if latestVersion.Message != "" { - InfoDisplay(os.Stderr, latestVersion.Message, "\n") + InfoDisplay(os.Stderr, latestVersion.Message+"\n") } return nil From db84380844842491f7c01b50cb3425b9cc6c0054 Mon Sep 17 00:00:00 2001 From: dwertent Date: Sun, 30 Jan 2022 08:14:10 +0200 Subject: [PATCH 2/2] print summary and scoe --- .gitignore | 3 ++- resultshandling/printer/v2/controlmapping/prettyprinter.go | 5 +---- resultshandling/results.go | 5 ++++- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 3c3ed147..a52b4539 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ *debug* *vender* *.pyc* -.idea \ No newline at end of file +.idea +ca.srl \ No newline at end of file diff --git a/resultshandling/printer/v2/controlmapping/prettyprinter.go b/resultshandling/printer/v2/controlmapping/prettyprinter.go index bbb3a7e2..dec73734 100644 --- a/resultshandling/printer/v2/controlmapping/prettyprinter.go +++ b/resultshandling/printer/v2/controlmapping/prettyprinter.go @@ -49,10 +49,7 @@ func (prettyPrinter *PrettyPrinter) printResults(controls *reportsummary.Control controlSummary := controls.GetControl(reportsummary.EControlCriteriaName, prettyPrinter.sortedControlNames[i]) // summaryDetails.Controls ListControls().All() Controls.GetControl(ca) prettyPrinter.printTitle(controlSummary) prettyPrinter.printResources(controlSummary, allResources) - - if controlSummary.GetStatus().IsSkipped() { - prettyPrinter.printSummary(prettyPrinter.sortedControlNames[i], controlSummary) - } + prettyPrinter.printSummary(prettyPrinter.sortedControlNames[i], controlSummary) } } diff --git a/resultshandling/results.go b/resultshandling/results.go index 1c4ff560..b20d9bb2 100644 --- a/resultshandling/results.go +++ b/resultshandling/results.go @@ -33,7 +33,10 @@ func (resultsHandler *ResultsHandler) HandleResults(scanInfo *cautils.ScanInfo) fmt.Println(err) } - return opaSessionObj.Report.SummaryDetails.Score + score := opaSessionObj.Report.SummaryDetails.Score + resultsHandler.printerObj.Score(score) + + return score } // CalculatePostureScore calculate final score