From dee094a993642894d4542c6bc8c11864863e4536 Mon Sep 17 00:00:00 2001 From: Harmj0y Date: Fri, 11 Mar 2016 16:37:14 -0500 Subject: Additional error checking in Get-DFSshare --- Recon/PowerView.ps1 | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'Recon') diff --git a/Recon/PowerView.ps1 b/Recon/PowerView.ps1 index 5823d18..5f9cc73 100644 --- a/Recon/PowerView.ps1 +++ b/Recon/PowerView.ps1 @@ -5394,15 +5394,16 @@ function Get-DFSshare { } } - $redirects = Parse-Pkt $pkt[0] - $redirects | ForEach-Object { - # If a folder doesn't have a redirection it will - # have a target like - # \\null\TestNameSpace\folder\.DFSFolderLink so we - # do actually want to match on "null" rather than - # $null - if ($_ -ne "null") { - New-Object -TypeName PSObject -Property @{'Name'=$Properties.name[0];'RemoteServerName'=$_} + if($pkt -and $pkt[0]) { + Parse-Pkt $pkt[0] | ForEach-Object { + # If a folder doesn't have a redirection it will + # have a target like + # \\null\TestNameSpace\folder\.DFSFolderLink so we + # do actually want to match on "null" rather than + # $null + if ($_ -ne "null") { + New-Object -TypeName PSObject -Property @{'Name'=$Properties.name[0];'RemoteServerName'=$_} + } } } } -- cgit v1.2.3