Legacy-AzureHound.ps1
Legacy-AzureHound.ps1 copied to clipboard
Divide by zero error when processing admins.
A divide by zero error occurs in line 1129 of AzureHound.ps1
[...]
Processing user account admin role
User account admins to process:
Es wurde versucht, durch 0 (null) zu teilen.
In C:\Users\user\Downloads\AzureHound-master\AzureHound-master\AzureHound.ps1:1129 Zeichen:13
+ $ProgressPercentage = (($Progress / $TotalCount) * 100) - ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], RuntimeException
+ FullyQualifiedErrorId : RuntimeException
Processing user account admins: [1/][100%] Current user account admin: john.doe
Done processing user account admin role
[...]
I verified, that the value of $TotalCount is indeed 0 by re-executing the Invoke-AzureHound command with the following addition:
[...]
If ([Int]$TotalCount -eq 0) {
Write-Info "*************** Warning *************** TotalCount equals 0"
} else {
$ProgressPercentage = (($Progress / $TotalCount) * 100) -As [Int]
}
[...]
Output:
[...]
Processing user account admin role
User account admins to process:
*************** Warning *************** TotalCount equals 0
Processing user account admins: [1/][100%] Current user account admin: john.doe
Done processing user account admin role
[...]