From 47b8690a381244d5b13510d91203ece1eca04fae Mon Sep 17 00:00:00 2001 From: bluecurby <45951367+bluecurby@users.noreply.github.com> Date: Tue, 23 Aug 2022 16:14:59 +0200 Subject: [PATCH 1/2] Add files via upload Fixed: - Domain Parameter was ignored, current domain was always used - Corrected Issue #31 - Merged PR #22 --- DomainPasswordSpray.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/DomainPasswordSpray.ps1 b/DomainPasswordSpray.ps1 index 66d9698..75c1cb4 100644 --- a/DomainPasswordSpray.ps1 +++ b/DomainPasswordSpray.ps1 @@ -258,7 +258,7 @@ function Countdown-Timer ) if ($quiet) { - Write-Host "$Message: Waiting for $($Seconds/60) minutes. $($Seconds - $Count)" + Write-Host "$($Message): Waiting for $($Seconds/60) minutes. $($Seconds - $Count)" Start-Sleep -Seconds $Seconds } else { foreach ($Count in (1..$Seconds)) @@ -414,7 +414,7 @@ function Get-DomainUserList } $UserSearcher = New-Object System.DirectoryServices.DirectorySearcher([ADSI]$CurrentDomain) - $DirEntry = New-Object System.DirectoryServices.DirectoryEntry + $DirEntry = New-Object System.DirectoryServices.DirectoryEntry($CurrentDomain) $UserSearcher.SearchRoot = $DirEntry $UserSearcher.PropertiesToLoad.Add("samaccountname") > $Null @@ -530,7 +530,7 @@ function Invoke-SpraySinglePassword $curr_user = 0 if ($OutFile -ne ""-and -not $Quiet) { - Write-Host -ForegroundColor Yellow "[*] Writing successes to $OutFile" + Write-Host -ForegroundColor Yellow "[*] Writing successes to $OutFile" } $RandNo = New-Object System.Random @@ -566,6 +566,7 @@ function Get-ObservationWindow($DomainEntry) { # Get account lockout observation window to avoid running more than 1 # password spray per observation window. + $DomainEntry = [ADSI]$DomainEntry $lockObservationWindow_attr = $DomainEntry.Properties['lockoutObservationWindow'] $observation_window = $DomainEntry.ConvertLargeIntegerToInt64($lockObservationWindow_attr.Value) / -600000000 return $observation_window From cb9235baeb68c495a04e399f59a071b37f6bc770 Mon Sep 17 00:00:00 2001 From: bluecurby <45951367+bluecurby@users.noreply.github.com> Date: Tue, 23 Aug 2022 16:44:02 +0200 Subject: [PATCH 2/2] Addressing issue #27 badPwdCount = $null --- DomainPasswordSpray.ps1 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DomainPasswordSpray.ps1 b/DomainPasswordSpray.ps1 index 75c1cb4..d7f7e33 100644 --- a/DomainPasswordSpray.ps1 +++ b/DomainPasswordSpray.ps1 @@ -464,6 +464,8 @@ function Get-DomainUserList } catch { + if($badcount -eq "null") + $UserListArray += $samaccountname continue } $currenttime = Get-Date