Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Domain Parameter was ignored, current domain was always used #33

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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