aboutsummaryrefslogtreecommitdiff
path: root/Recon/PowerView.ps1
diff options
context:
space:
mode:
authorItamar <mizrahi.itamar@gmail.com>2017-05-07 11:21:56 +0300
committerGitHub <noreply@github.com>2017-05-07 11:21:56 +0300
commit6a71a6e52622c562a1e9c981052457da359ce6a9 (patch)
treea3906dffe750adc374c6aed7ed3145cdec377e26 /Recon/PowerView.ps1
parent2501e8e912764ef917be36fbe2f5792a6b88eeed (diff)
downloadPowerSploit-6a71a6e52622c562a1e9c981052457da359ce6a9.tar.gz
PowerSploit-6a71a6e52622c562a1e9c981052457da359ce6a9.zip
Update PowerView.ps1
Fixed null access control entry in results.
Diffstat (limited to 'Recon/PowerView.ps1')
-rwxr-xr-xRecon/PowerView.ps116
1 files changed, 9 insertions, 7 deletions
diff --git a/Recon/PowerView.ps1 b/Recon/PowerView.ps1
index 6d17aeb..c50fdfc 100755
--- a/Recon/PowerView.ps1
+++ b/Recon/PowerView.ps1
@@ -18814,13 +18814,15 @@ function Get-GPODelegation
$Searcher.SearchScope = "Subtree"
$listGPO = $Searcher.FindAll()
foreach ($gpo in $listGPO){
- $ACL = (([ADSI]$gpo.path).ObjectSecurity).Access | ? {$_.ActiveDirectoryRights -match "Write" -and $_.AccessControlType -eq "Allow" -and $Exclusions -notcontains $_.IdentityReference.toString().split("\")[1] -and $_.IdentityReference -ne "CREATOR OWNER"}
- $GpoACL = New-Object psobject
- $GpoACL | Add-Member Noteproperty 'ADSPath' $gpo.Properties.adspath
- $GpoACL | Add-Member Noteproperty 'GPODisplayName' $gpo.Properties.displayname
- $GpoACL | Add-Member Noteproperty 'IdentityReference' $ACL.IdentityReference
- $GpoACL | Add-Member Noteproperty 'ActiveDirectoryRights' $ACL.ActiveDirectoryRights
- $GpoACL
+ $ACL = ([ADSI]$gpo.path).ObjectSecurity.Access | ? {$_.ActiveDirectoryRights -match "Write" -and $_.AccessControlType -eq "Allow" -and $Exclusions -notcontains $_.IdentityReference.toString().split("\")[1] -and $_.IdentityReference -ne "CREATOR OWNER"}
+ if ($ACL -ne $null){
+ $GpoACL = New-Object psobject
+ $GpoACL | Add-Member Noteproperty 'ADSPath' $gpo.Properties.adspath
+ $GpoACL | Add-Member Noteproperty 'GPODisplayName' $gpo.Properties.displayname
+ $GpoACL | Add-Member Noteproperty 'IdentityReference' $ACL.IdentityReference
+ $GpoACL | Add-Member Noteproperty 'ActiveDirectoryRights' $ACL.ActiveDirectoryRights
+ $GpoACL
+ }
}
}
}