mirror of
https://github.com/Yamato-Security/WELA.git
synced 2025-12-06 09:12:46 +01:00
fix: update WELA.ps1 to handle empty Baseline parameter and provide usage examples for configure command
This commit is contained in:
16
WELA.ps1
16
WELA.ps1
@@ -1,7 +1,6 @@
|
||||
param (
|
||||
[string]$Cmd,
|
||||
[string]$OutType = "std",
|
||||
[string]$Baseline = "YamatoSecurity",
|
||||
[bool]$Debug = $false,
|
||||
[switch]$Auto
|
||||
)
|
||||
@@ -5436,6 +5435,8 @@ function ConfigureAuditSettings {
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
|
||||
$autidpolTxt = "./auditpol.txt"
|
||||
if (-not $debug) {
|
||||
Start-Process -FilePath "cmd.exe" -ArgumentList "/c chcp 437 & auditpol /get /category:* /r" -NoNewWindow -Wait -RedirectStandardOutput $autidpolTxt
|
||||
@@ -5811,6 +5812,9 @@ Write-Host $logo -ForegroundColor Green
|
||||
|
||||
switch ($Cmd.ToLower()) {
|
||||
"audit-settings" {
|
||||
if ([string]::IsNullOrEmpty($Baseline)) {
|
||||
$Baseline = "YamatoSecurity"
|
||||
}
|
||||
$validGuides = @("YamatoSecurity", "ASD", "Microsoft_Client", "Microsoft_Server")
|
||||
if (-not ($validGuides -contains $Baseline.ToLower())) {
|
||||
Write-Host "Invalid Guide specified. Valid options are: YamatoSecurity, ASD, Microsoft_Client, Microsoft_Server."
|
||||
@@ -5823,9 +5827,13 @@ switch ($Cmd.ToLower()) {
|
||||
}
|
||||
|
||||
"configure" {
|
||||
$validGuides = @("YamatoSecurity", "ASD", "Microsoft_Client", "Microsoft_Server")
|
||||
if (-not ($validGuides -contains $Baseline.ToLower())) {
|
||||
Write-Host "Invalid Guide specified. Valid options are: YamatoSecurity, ASD, Microsoft_Client, Microsoft_Server."
|
||||
if ([string]::IsNullOrEmpty($Baseline)) {
|
||||
Write-Host "You need to specify a baseline. The following baselines are available:"
|
||||
Write-Host " * YamatoSecurity"
|
||||
Write-Host ""
|
||||
Write-Host "Examples: "
|
||||
Write-Host "./WELA.ps1 configure -Baseline YamatoSecurity"
|
||||
Write-Host "./WELA.ps1 configure -Baseline YamatoSecurity -Auto"
|
||||
break
|
||||
}
|
||||
ConfigureAuditSettings -Baseline $Baseline -Auto:$Auto
|
||||
|
||||
Reference in New Issue
Block a user