Skip to content

Commit

Permalink
Merge pull request #551 from fbprogmbh/approve
Browse files Browse the repository at this point in the history
Update AuditTAP to version 5.9.0
  • Loading branch information
svenschrader committed Apr 11, 2024
2 parents 398b113 + 394dd38 commit 842e7ca
Show file tree
Hide file tree
Showing 63 changed files with 2,882 additions and 1,887 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.8.0'
ModuleVersion = '5.9.0'
GUID = '1662a599-4e3a-4f72-a844-9582077b589e'
Author = 'Benedikt Böhme, Patrick Helbach, Steffen Winternheimer, Phan Quang Nguyen, Daniel Ströher'
CompanyName = 'FB Pro GmbH'
Expand Down
43 changes: 40 additions & 3 deletions ATAPAuditor/ATAPAuditor.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,29 @@ class ResultTable {
#endregion

#region helpers
function GetLicenseStatus{
param(
$SkipLicenseCheck
)
if($SkipLicenseCheck -eq $false){
Write-Host "Checking operating system activation status. This may take a while..."
$licenseStatus = (Get-CimInstance SoftwareLicensingProduct -Filter "Name like 'Windows%'" | where { $_.PartialProductKey } | select Description, LicenseStatus -ExpandProperty LicenseStatus)
switch ($licenseStatus) {
"0" { $lcStatus = "Unlicensed" }
"1" { $lcStatus = "Licensed" }
"2" { $lcStatus = "OOBGrace" }
"3" { $lcStatus = "OOTGrace" }
"4" { $lcStatus = "NonGenuineGrace" }
"5" { $lcStatus = "Notification" }
"6" { $lcStatus = "ExtendedGrace" }
}
return $lcStatus
}
else{
return "License check has been skipped."
}
}

function Test-ArrayEqual {
[OutputType([bool])]
[CmdletBinding()]
Expand Down Expand Up @@ -795,6 +818,9 @@ function Save-ATAPHtmlReport {
[switch]
$RiskScore,

[Parameter(Mandatory = $false)]
[switch]
$SkipLicenseCheck,
# [Parameter(Mandatory = $false)]
# [switch]
# $MITRE,
Expand All @@ -804,6 +830,11 @@ function Save-ATAPHtmlReport {
$Force
)

if([Environment]::Is64BitProcess -eq $false){
Write-Host "Please use 64-bit version of PowerShell in order to use AuditTAP. Closing..." -ForegroundColor red
return;
}

$parent = $path
if ($Path -match ".html") {
$parent = Split-Path -Path $Path
Expand All @@ -830,24 +861,30 @@ function Save-ATAPHtmlReport {
}
else {
[SystemInformation] $SystemInformation = (& "$PSScriptRoot\Helpers\ReportWindowsOS.ps1")
$SystemInformation.SoftwareInformation.LicenseStatus = GetLicenseStatus $SkipLicenseCheck
Write-Verbose "PS-Check"
$psVersion = $PSVersionTable.PSVersion
if ($psVersion.Major -ne 5) {
Write-Warning "ATAPAuditor is only compatible with PowerShell Version 5. Your version is $psVersion. Do you want to open a Powershell 5? Y/N"
#PowerShell Major version not 5.*
if (($psVersion.Major -ne 5)) {
Write-Warning "ATAPAuditor is only compatible with PowerShell Version 5.1. Your version is $psVersion. Do you want to open a Powershell 5? Y/N"
$in = Read-Host
switch ($in) {
Y { Start Powershell; return }
N { Write-Warning "Stopping Script..."; return }
default { Write-Warning "You did not choose Y nor N. Stopping Script..."; return }
}
}
#PowerShell version not 5.1
if (($psVersion.Major -eq 5) -and ($psVersion.Minor -eq 0)) {
Write-Warning "ATAPAuditor is only compatible with PowerShell Version 5.1. Your version is $psVersion. You need to upgrade to a higher Windows version!"
return;
}
}
$report = Invoke-ATAPReport -ReportName $ReportName
#hashes for each recommendation
$hashtable_sha256 = GenerateHashTable $report

$report | Get-ATAPHtmlReport -Path $Path -RiskScore:$RiskScore -MITRE:$MITRE -hashtable_sha256:$hashtable_sha256 -LicenseStatus:$LicenseStatus -SystemInformation:$SystemInformation

}

New-Alias -Name 'shr' -Value Save-ATAPHtmlReport
Expand Down
Loading

0 comments on commit 842e7ca

Please sign in to comment.