Skip to content

Commit

Permalink
Merge pull request #182 from redcanaryco/cyberbuff-patch-2
Browse files Browse the repository at this point in the history
Update Invoke-AtomicTest.ps1
  • Loading branch information
clr2of8 authored Dec 28, 2023
2 parents bc546d3 + e6c4d84 commit 05bfb2b
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions Public/Invoke-AtomicTest.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,24 @@ function Invoke-AtomicTest {
$executionPlatform, $isElevated, $tmpDir, $executionHostname, $executionUser = Get-TargetInfo $Session
$PathToPayloads = if ($Session) { "$tmpDir`AtomicRedTeam" } else { $PathToAtomicsFolder }

# Since there might a comma(T1559-1,2,3) Powershell takes it as array.
# So converting it back to string.
if ($AtomicTechnique -is [array]) {
$AtomicTechnique = $AtomicTechnique -join ","
}

# Splitting Atomic Technique short form into technique and test numbers.
$AtomicTechniqueParams = ($AtomicTechnique -split '-')
$AtomicTechnique = $AtomicTechniqueParams[0]

if ($AtomicTechniqueParams.Length -gt 1) {
$ShortTestNumbers = $AtomicTechniqueParams[-1]
}

if ($null -eq $TestNumbers -and $null -ne $ShortTestNumbers) {
$TestNumbers = $ShortTestNumbers -split ','
}

$isLoggingModuleSet = $false
if (-not $NoExecutionLog) {
$isLoggingModuleSet = $true
Expand Down Expand Up @@ -193,24 +211,6 @@ function Invoke-AtomicTest {
return
}

# Since there might a comma(T1559-1,2,3) Powershell takes it as array.
# So converting it back to string.
if ($AtomicTechnique -is [array]) {
$AtomicTechnique = $AtomicTechnique -join ","
}

# Splitting Atomic Technique short form into technique and test numbers.
$AtomicTechniqueParams = ($AtomicTechnique -split '-')
$AtomicTechnique = $AtomicTechniqueParams[0]

if ($AtomicTechniqueParams.Length -gt 1) {
$ShortTestNumbers = $AtomicTechniqueParams[-1]
}

if ($null -eq $TestNumbers -and $null -ne $ShortTestNumbers) {
$TestNumbers = $ShortTestNumbers -split ','
}

# Here we're rebuilding an equivalent command line to put in the logs
$commandLine = "Invoke-AtomicTest $AtomicTechnique"

Expand Down

0 comments on commit 05bfb2b

Please sign in to comment.