Easily add targets into GoPhish for internal simulated threat training, based on pre existing groups in your Active Directory environment.
- Download DirectoryPhish.ps1 or clone this repo.
- Make sure you have the AD-DS PowerShell cmdlets installed.
- Set your execution policy appropriately.
- Select your target group and run the script (see Examples below).
- Take the output CSV and login to your GoPhish management panel
https://10.0.0.2:3333/
and selectUsers & Groups
. - Select
New Group
and give it a name. - Click
+ Bulk Import Users
select your CSV and wait for the table to populate.Save changes
. - Catch some phish :)
--Group (required)
--ExcludeIfIn (optional)
--Domain (optional)
Get your Domain Users:
.\DirectoryPhish.ps1 --Group "Domain Users"
Get your Domain Users that are not in ManagementGroup:
.\DirectoryPhish.ps1 --Group "Domain Users" --ExcludeIfIn "ManagementGroup"
Get your Domain Users that only have *@contoso.com email addresses:
.\DirectoryPhish.ps1 --Group "Domain Users" --Domain contoso.com"
This script will only return results if the user has an email address in AD under the EmailAddress
property and will only return this email address.