Skip to content
This repository was archived by the owner on Jan 21, 2021. It is now read-only.

Commit 601ad0c

Browse files
committed
Logic bug fix in Get-DomainFileServer
-Domain bug fix in Find-DomainUserLocation stealth
1 parent ad32d6c commit 601ad0c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Recon/PowerView.ps1

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9828,12 +9828,12 @@ One or more strings representing file server names.
98289828
$SearcherArguments['Domain'] = $TargetDomain
98299829
$UserSearcher = Get-DomainSearcher @SearcherArguments
98309830
# get all results w/o the pipeline and uniquify them (I know it's not pretty)
9831-
Sort-Object -Unique -InputObject $(ForEach($UserResult in $UserSearcher.FindAll()) {if ($UserResult.Properties['homedirectory']) {Split-Path($UserResult.Properties['homedirectory'])}if ($UserResult.Properties['scriptpath']) {Split-Path($UserResult.Properties['scriptpath'])}if ($UserResult.Properties['profilepath']) {Split-Path($UserResult.Properties['profilepath'])}})
9831+
$(ForEach($UserResult in $UserSearcher.FindAll()) {if ($UserResult.Properties['homedirectory']) {Split-Path($UserResult.Properties['homedirectory'])}if ($UserResult.Properties['scriptpath']) {Split-Path($UserResult.Properties['scriptpath'])}if ($UserResult.Properties['profilepath']) {Split-Path($UserResult.Properties['profilepath'])}}) | Sort-Object -Unique
98329832
}
98339833
}
98349834
else {
98359835
$UserSearcher = Get-DomainSearcher @SearcherArguments
9836-
Sort-Object -Unique -InputObject $(ForEach($UserResult in $UserSearcher.FindAll()) {if ($UserResult.Properties['homedirectory']) {Split-Path($UserResult.Properties['homedirectory'])}if ($UserResult.Properties['scriptpath']) {Split-Path($UserResult.Properties['scriptpath'])}if ($UserResult.Properties['profilepath']) {Split-Path($UserResult.Properties['profilepath'])}})
9836+
$(ForEach($UserResult in $UserSearcher.FindAll()) {if ($UserResult.Properties['homedirectory']) {Split-Path($UserResult.Properties['homedirectory'])}if ($UserResult.Properties['scriptpath']) {Split-Path($UserResult.Properties['scriptpath'])}if ($UserResult.Properties['profilepath']) {Split-Path($UserResult.Properties['profilepath'])}}) | Sort-Object -Unique
98379837
}
98389838
}
98399839
}
@@ -14796,10 +14796,11 @@ PowerView.UserLocation
1479614796
if ($PSBoundParameters['Tombstone']) { $UserSearcherArguments['Tombstone'] = $Tombstone }
1479714797
if ($PSBoundParameters['Credential']) { $UserSearcherArguments['Credential'] = $Credential }
1479814798

14799+
$TargetComputers = @()
1479914800

1480014801
# first, build the set of computers to enumerate
1480114802
if ($PSBoundParameters['ComputerName']) {
14802-
$TargetComputers = $ComputerName
14803+
$TargetComputers = @($ComputerName)
1480314804
}
1480414805
else {
1480514806
if ($PSBoundParameters['Stealth']) {
@@ -14809,6 +14810,7 @@ PowerView.UserLocation
1480914810
if ($StealthSource -match 'File|All') {
1481014811
Write-Verbose '[Find-DomainUserLocation] Querying for file servers'
1481114812
$FileServerSearcherArguments = @{}
14813+
if ($PSBoundParameters['Domain']) { $FileServerSearcherArguments['Domain'] = $ComputerDomain }
1481214814
if ($PSBoundParameters['ComputerDomain']) { $FileServerSearcherArguments['Domain'] = $ComputerDomain }
1481314815
if ($PSBoundParameters['ComputerSearchBase']) { $FileServerSearcherArguments['SearchBase'] = $ComputerSearchBase }
1481414816
if ($PSBoundParameters['Server']) { $FileServerSearcherArguments['Server'] = $Server }
@@ -14831,6 +14833,7 @@ PowerView.UserLocation
1483114833
$DCSearcherArguments = @{
1483214834
'LDAP' = $True
1483314835
}
14836+
if ($PSBoundParameters['Domain']) { $DCSearcherArguments['Domain'] = $ComputerDomain }
1483414837
if ($PSBoundParameters['ComputerDomain']) { $DCSearcherArguments['Domain'] = $ComputerDomain }
1483514838
if ($PSBoundParameters['Server']) { $DCSearcherArguments['Server'] = $Server }
1483614839
if ($PSBoundParameters['Credential']) { $DCSearcherArguments['Credential'] = $Credential }

0 commit comments

Comments
 (0)