Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions DomainPasswordSpray.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -464,6 +464,8 @@ function Get-DomainUserList
}
catch
{
if($badcount -eq "null")
$UserListArray += $samaccountname
continue
}
$currenttime = Get-Date
Expand Down Expand Up @@ -530,7 +532,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

Expand Down Expand Up @@ -566,6 +568,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
Expand Down