mirror of
https://github.com/NetSPI/PowerHuntShares.git
synced 2025-05-05 03:38:42 +02:00
Update PowerHuntShares.psm1
This commit is contained in:
parent
abc41f450a
commit
d351ea3a66
@ -4,7 +4,7 @@
|
|||||||
#--------------------------------------
|
#--------------------------------------
|
||||||
# Author: Scott Sutherland, 2022 NetSPI
|
# Author: Scott Sutherland, 2022 NetSPI
|
||||||
# License: 3-clause BSD
|
# License: 3-clause BSD
|
||||||
# Version: v1.24
|
# Version: v1.25
|
||||||
# References: This script includes custom code and code taken and modified from the open source projects PowerView, Invoke-Ping, and Invoke-Parrell.
|
# References: This script includes custom code and code taken and modified from the open source projects PowerView, Invoke-Ping, and Invoke-Parrell.
|
||||||
function Invoke-HuntSMBShares
|
function Invoke-HuntSMBShares
|
||||||
{
|
{
|
||||||
@ -245,29 +245,12 @@ function Invoke-HuntSMBShares
|
|||||||
# Create output directory
|
# Create output directory
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
if(Test-Path $OutputDirectory){
|
if(Test-Path $OutputDirectory){
|
||||||
|
# good
|
||||||
# Create sub directory for output
|
}else{
|
||||||
try{
|
$Time = Get-Date -UFormat "%m/%d/%Y %R"
|
||||||
|
Write-Output " [x][$Time] The $OutputDirectory was not writable or does not exist."
|
||||||
if(-not $AnalyzeOnly){
|
|
||||||
|
|
||||||
# Verify output directory path
|
|
||||||
$Time = Get-Date -UFormat "%m/%d/%Y %R"
|
|
||||||
$FolderDateTime = Get-Date -Format "MMddyyyyHHmmss"
|
|
||||||
$OutputDirectoryBase = "$OutputDirectory\SmbShareHunt-$FolderDateTime"
|
|
||||||
|
|
||||||
# Create sub directories
|
|
||||||
mkdir $OutputDirectoryBase | Out-Null
|
|
||||||
$SubDir = "Results"
|
|
||||||
mkdir "$OutputDirectoryBase\$SubDir" | Out-Null
|
|
||||||
$OutputDirectory = "$OutputDirectoryBase\Results"
|
|
||||||
Write-Output " [*][$Time] Output Directory: $OutputDirectoryBase"
|
|
||||||
}
|
|
||||||
}catch{
|
|
||||||
Write-Output " [x][$Time] The $OutputDirectory was not writable."
|
|
||||||
Write-Output " [!][$Time] Aborting operation."
|
Write-Output " [!][$Time] Aborting operation."
|
||||||
break
|
break
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user