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
|
||||
# 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.
|
||||
function Invoke-HuntSMBShares
|
||||
{
|
||||
@ -245,30 +245,13 @@ function Invoke-HuntSMBShares
|
||||
# Create output directory
|
||||
# ----------------------------------------------------------------------
|
||||
if(Test-Path $OutputDirectory){
|
||||
|
||||
# Create sub directory for output
|
||||
try{
|
||||
|
||||
if(-not $AnalyzeOnly){
|
||||
|
||||
# Verify output directory path
|
||||
# good
|
||||
}else{
|
||||
$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 " [x][$Time] The $OutputDirectory was not writable or does not exist."
|
||||
Write-Output " [!][$Time] Aborting operation."
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Import computers from file
|
||||
|
Loading…
x
Reference in New Issue
Block a user