diff options
author | HarmJ0y <will@harmj0y.net> | 2016-07-15 14:07:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-15 14:07:42 -0700 |
commit | 28d118f98765e19ed05abc358be5522898c4925a (patch) | |
tree | 7bb9f58b2df2ae7161ebc5ed7b8bbf09f9e53b19 /Recon | |
parent | 81ac124f2211799207711fcd1b5fadb0091510f6 (diff) | |
parent | 325cc849d7fae993b5c7309e08c59c4b11c7da8e (diff) | |
download | PowerSploit-28d118f98765e19ed05abc358be5522898c4925a.tar.gz PowerSploit-28d118f98765e19ed05abc358be5522898c4925a.zip |
Merge pull request #158 from joncave/groupsxml
PowerView: Fix Groups.xml parsing for multiple <Group>s
Diffstat (limited to 'Recon')
-rwxr-xr-x | Recon/PowerView.ps1 | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/Recon/PowerView.ps1 b/Recon/PowerView.ps1 index a636bf1..a54cc6d 100755 --- a/Recon/PowerView.ps1 +++ b/Recon/PowerView.ps1 @@ -6141,13 +6141,13 @@ filter Get-GroupsXML { [XML]$GroupsXMLcontent = Get-Content $TargetGroupsXMLPath -ErrorAction Stop # process all group properties in the XML - $GroupsXMLcontent | Select-Xml "//Groups" | Select-Object -ExpandProperty node | ForEach-Object { + $GroupsXMLcontent | Select-Xml "/Groups/Group" | Select-Object -ExpandProperty node | ForEach-Object { - $Groupname = $_.Group.Properties.groupName + $Groupname = $_.Properties.groupName # extract the localgroup sid for memberof - $GroupSID = $_.Group.Properties.GroupSid - if(-not $LocalSid) { + $GroupSID = $_.Properties.groupSid + if(-not $GroupSID) { if($Groupname -match 'Administrators') { $GroupSID = 'S-1-5-32-544' } @@ -6163,7 +6163,7 @@ filter Get-GroupsXML { } # extract out members added to this group - $Members = $_.Group.Properties.members | Select-Object -ExpandProperty Member | Where-Object { $_.action -match 'ADD' } | ForEach-Object { + $Members = $_.Properties.members | Select-Object -ExpandProperty Member | Where-Object { $_.action -match 'ADD' } | ForEach-Object { if($_.sid) { $_.sid } else { $_.name } } @@ -6171,8 +6171,8 @@ filter Get-GroupsXML { if ($Members) { # extract out any/all filters...I hate you GPP - if($_.Group.filters) { - $Filters = $_.Group.filters.GetEnumerator() | ForEach-Object { + if($_.filters) { + $Filters = $_.filters.GetEnumerator() | ForEach-Object { New-Object -TypeName PSObject -Property @{'Type' = $_.LocalName;'Value' = $_.name} } } |