From 2db87aa6c5325e1a9e16957bf4654fa296823b13 Mon Sep 17 00:00:00 2001 From: fukusuket <41001169+fukusuket@users.noreply.github.com> Date: Sat, 15 Mar 2025 11:15:57 +0900 Subject: [PATCH] update --- WELA.ps1 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/WELA.ps1 b/WELA.ps1 index 80f4c12f..355ffc69 100644 --- a/WELA.ps1 +++ b/WELA.ps1 @@ -54,9 +54,16 @@ function CalculateUsableRate { function ShowRulesCountsByLevel { param ($usableRate, $msg) Write-Output $msg - $levelOrder = @("critical", "high", "medium", "low", "informational") - $usableRate | Sort-Object { $levelOrder.IndexOf($_.Level) } | ForEach-Object { - Write-Output "$($_.Level) rules: $($_.UsableCount) / $($_.TotalCount) ($($_.Percentage)%)" + $levelColorMap = [ordered]@{ + "critical" = "ff0000" + "high" = "ffc100" + "medium" = "ffff00" + "low" = "00ff00" + "informational" = "ffffff" # Assuming a default color for informational + } + $usableRate | Sort-Object { $levelColorMap.Keys.IndexOf($_.Level) } | ForEach-Object { + $color = $levelColorMap[$_.Level] + Write-Host "$($_.Level) rules: $($_.UsableCount) / $($_.TotalCount) ($($_.Percentage)%)" -ForegroundColor $color } Write-Output "" }