mirror of
https://github.com/Yamato-Security/WELA.git
synced 2025-12-07 09:42:48 +01:00
update
This commit is contained in:
33
WELA.ps1
33
WELA.ps1
@@ -24,6 +24,16 @@
|
|||||||
return $jsonContent
|
return $jsonContent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Get-RuleCounts {
|
||||||
|
param ($rules)
|
||||||
|
$rules | Group-Object -Property level | ForEach-Object {
|
||||||
|
[PSCustomObject]@{
|
||||||
|
Level = $_.Name
|
||||||
|
Count = $_.Count
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Set the console encoding to UTF-8
|
# Set the console encoding to UTF-8
|
||||||
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
[Console]::OutputEncoding = [System.Text.Encoding]::UTF8
|
||||||
|
|
||||||
@@ -52,26 +62,9 @@ $usableSecRules = $rules | Where-Object { $_.applicable -eq $true -and $_.channe
|
|||||||
$usablePwshRules = $rules | Where-Object { $_.channel -eq "pwsh" }
|
$usablePwshRules = $rules | Where-Object { $_.channel -eq "pwsh" }
|
||||||
$unusableRules = $rules | Where-Object { $_.applicable -eq $false -and $_.channel -eq "sec" }
|
$unusableRules = $rules | Where-Object { $_.applicable -eq $false -and $_.channel -eq "sec" }
|
||||||
|
|
||||||
$totalCounts = $rules | Group-Object -Property level | ForEach-Object {
|
$totalCounts = Get-RuleCounts -rules $rules
|
||||||
[PSCustomObject]@{
|
$usableSecCounts = Get-RuleCounts -rules $usableSecRules
|
||||||
Level = $_.Name
|
$usablePwshCounts = Get-RuleCounts -rules $usablePwshRules
|
||||||
Count = $_.Count
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$usableSecCounts = $usableSecRules | Group-Object -Property level | ForEach-Object {
|
|
||||||
[PSCustomObject]@{
|
|
||||||
Level = $_.Name
|
|
||||||
Count = $_.Count
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$usablePwshCounts = $usablePwshRules | Group-Object -Property level | ForEach-Object {
|
|
||||||
[PSCustomObject]@{
|
|
||||||
Level = $_.Name
|
|
||||||
Count = $_.Count
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# Step 5: Calculate the percentages
|
# Step 5: Calculate the percentages
|
||||||
$usableSecPercentages = $usableSecCounts | ForEach-Object {
|
$usableSecPercentages = $usableSecCounts | ForEach-Object {
|
||||||
|
|||||||
Reference in New Issue
Block a user