Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Steffen Winternheimer committed Feb 28, 2023
2 parents 7acd3b1 + 44d47c6 commit bc3ba56
Show file tree
Hide file tree
Showing 125 changed files with 59,856 additions and 15,908 deletions.
2 changes: 1 addition & 1 deletion ATAPAuditor/ATAPAuditor.psd1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@{
RootModule = 'ATAPAuditor.psm1'
ModuleVersion = '5.3'
ModuleVersion = '5.4'
GUID = '1662a599-4e3a-4f72-a844-9582077b589e'
Author = 'Benedikt Böhme, Patrick Helbach, Steffen Winternheimer'
CompanyName = 'FB Pro GmbH'
Expand Down
74 changes: 46 additions & 28 deletions ATAPAuditor/ATAPAuditor.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,16 @@ function Test-ArrayEqual {
# 4 {"Backup Domain Controller"}
# 5 {"Primary Domain Controller"}
function Get-DomainRole {
[DomainRole](Get-CimInstance -Class Win32_ComputerSystem).DomainRole
$domainRole = (Get-CimInstance -Class Win32_ComputerSystem).DomainRole
switch ($domainRole) {
0 { $result = "Standalone Workstation" }
1 { $result = "Member Workstation"}
2 { $result = "Standalone Server" }
3 { $result = "Member Server"}
4 { $result = "Backup Domain Controller" }
5 { $result = "Primary Domain Controller"}
}
return $result
}

### begin Foundation functions ###
Expand Down Expand Up @@ -301,8 +310,8 @@ function Test-AuditGroup {
Write-Output ([AuditInfo]@{
Id = $test.Id
Task = $test.Task
Message = 'Not applicable. This audit applies only to {0}.' -f ($DomainRoleConstraint.Values -join ' and ')
Status = [AuditInfoStatus]::None
Message = $message
Status = $status
})
continue
}
Expand Down Expand Up @@ -453,18 +462,23 @@ function Invoke-ATAPReport {
$script:loadedResources = @{}
# Load the module manifest

#Windows OS
if([System.Environment]::OSVersion.Platform -ne 'Unix'){
$moduleInfo = Import-PowerShellDataFile -Path "$RootPath\ATAPAuditor.psd1"
[Report]$report = (& "$RootPath\Reports\$ReportName.ps1")
$report.RSReport = Get-RSFullReport
$report.FoundationReport = Get-FoundationReport
}
#Linux OS
else{
$moduleInfo = Import-PowerShellDataFile -Path "$RootPath/ATAPAuditor.psd1"
[Report]$report = (& "$RootPath/Reports/$ReportName.ps1")
}
try {
#Windows OS
if([System.Environment]::OSVersion.Platform -ne 'Unix'){
$moduleInfo = Import-PowerShellDataFile -Path "$RootPath\ATAPAuditor.psd1"
[Report]$report = (& "$RootPath\Reports\$ReportName.ps1")
$report.RSReport = Get-RSFullReport
$report.FoundationReport = Get-FoundationReport
}
#Linux OS
else{
$moduleInfo = Import-PowerShellDataFile -Path "$RootPath/ATAPAuditor.psd1"
[Report]$report = (& "$RootPath/Reports/$ReportName.ps1")
}
} catch [System.Management.Automation.CommandNotFoundException] {
Write-Host "Input for -Reportname is faulty, please make sure to put the correct input. Stopping script."
break
}
$report.AuditorVersion = $moduleInfo.ModuleVersion
return $report
}
Expand Down Expand Up @@ -520,31 +534,35 @@ function Save-ATAPHtmlReport {
[switch]
$RiskScore,

[switch]
$DarkMode,
# [switch]
# $DarkMode,

[Parameter()]
[switch]
$Force
)

$parent = $path
if ($Path -match ".html") {
$parent = Split-Path -Path $Path
}

$pathOnly = Split-Path -Path $Path
#if input path is not default one
if($pathOnly -ne $script:atapReportsPath){
$pathCheck = Test-Path -Path $Path -PathType Container
if($parent -ne $script:atapReportsPath){
$pathCheck = Test-Path -Path $parent -PathType Container
#if path doesn't exist
if($pathCheck -eq $False){
Write-Warning "Could not find Path. Report will be created inside default path: $($script:atapReportsPath)"
$Path = $script:atapReportsPath
if (-not [string]::IsNullOrEmpty($parent) -and -not (Test-Path $parent)) {
New-Item -ItemType Directory -Path $parent -Force | Out-Null
Write-Warning "Could not find Path. Path will be created: $parent"
} else {
Write-Warning "Could not find Path. Report will be created inside default path: $($script:atapReportsPath)"
$Path = $($script:atapReportsPath)
}
}
}

$parent = Split-Path $Path
if (-not [string]::IsNullOrEmpty($parent) -and -not (Test-Path $parent)) {
New-Item -ItemType Directory -Path $parent -Force | Out-Null
}
Invoke-ATAPReport -ReportName $ReportName | Get-ATAPHtmlReport -Path $Path -RiskScore:$RiskScore -DarkMode:$DarkMode

Invoke-ATAPReport -ReportName $ReportName | Get-ATAPHtmlReport -Path $Path -RiskScore:$RiskScore #-DarkMode:$DarkMode
}

New-Alias -Name 'shr' -Value Save-ATAPHtmlReport
Expand Down
4 changes: 2 additions & 2 deletions ATAPAuditor/AuditGroups/Application Control.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function isWindows10Enterprise {
}

[AuditTest] @{
Id = "SBD-040"
Id = "SBD-070"
Task = "Ensure Windows Defender Application Control (WDAC) is available."
Test = {
if(isWindows10Enterprise -eq $true){
Expand All @@ -43,7 +43,7 @@ function isWindows10Enterprise {
}
}
[AuditTest] @{
Id = "SBD-041"
Id = "SBD-071"
Task = "Ensure Windows Defender Application ID Service is running."
Test = {
if((Get-Service -Name APPIDSvc).Status -eq "Running"){
Expand Down
Loading

0 comments on commit bc3ba56

Please sign in to comment.