mirror of
https://github.com/Yamato-Security/WELA.git
synced 2025-12-07 01:32:50 +01:00
chg: Output horizontally
This commit is contained in:
23
WELA.ps1
23
WELA.ps1
@@ -59,23 +59,24 @@ function Set-Applicable {
|
|||||||
function Get-RuleCounts {
|
function Get-RuleCounts {
|
||||||
param ($rules)
|
param ($rules)
|
||||||
$levels = @("critical", "high", "medium", "low", "informational")
|
$levels = @("critical", "high", "medium", "low", "informational")
|
||||||
$counts = $rules | Group-Object -Property level | ForEach-Object {
|
$counts = @{}
|
||||||
[PSCustomObject]@{
|
|
||||||
Level = $_.Name
|
$rules | Group-Object -Property level | ForEach-Object {
|
||||||
Count = $_.Count
|
$counts[$_.Name] = $_.Count
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($level in $levels) {
|
foreach ($level in $levels) {
|
||||||
if (-not ($counts | Where-Object { $_.Level -eq $level })) {
|
if (-not $counts.ContainsKey($level)) {
|
||||||
$counts += [PSCustomObject]@{
|
$counts[$level] = 0
|
||||||
Level = $level
|
|
||||||
Count = 0
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $counts
|
return $counts.GetEnumerator() | ForEach-Object {
|
||||||
|
[PSCustomObject]@{
|
||||||
|
Level = $_.Key
|
||||||
|
Count = $_.Value
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function CalculateUsableRate {
|
function CalculateUsableRate {
|
||||||
|
|||||||
Reference in New Issue
Block a user