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
20 changes: 17 additions & 3 deletions MSOLSpray.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
function Invoke-MSOLSpray{
function Invoke-MSOLSpray{

<#
.SYNOPSIS
Expand All @@ -17,6 +17,10 @@

UserList file filled with usernames one-per-line in the format "user@domain.com"

.PARAMETER UserName

UserName to test against a given password. Format "user@domain.com"

.PARAMETER Password

A single password that will be used to perform the password spray.
Expand Down Expand Up @@ -58,6 +62,10 @@
[string]
$UserList = "",

[Parameter(Position = 1, Mandatory = $False)]
[string]
$UserName = "",

[Parameter(Position = 2, Mandatory = $False)]
[string]
$Password = "",
Expand All @@ -73,7 +81,13 @@
)

$ErrorActionPreference= 'silentlycontinue'
$Usernames = Get-Content $UserList
$Usernames = @()
if ($PSBoundParameters.ContainsKey('userList')) {
$Usernames += Get-Content $UserList
} else {
$Usernames = $UserName
}

$count = $Usernames.count
$curr_user = 0
$lockout_count = 0
Expand Down Expand Up @@ -202,4 +216,4 @@
Write-Output "Results have been written to $OutFile."
}
}
}
}