From 196b2ae8c6cf99dfb2717abd1614712d048d764d Mon Sep 17 00:00:00 2001 From: Carrie Roberts Date: Wed, 29 Jan 2020 14:10:15 -0700 Subject: [PATCH] fix prereq bug for multi-line powershell (#815) * move emond test into correct T# * only show cleanup with inputs if there are inputs * fix prereq bug for multi-line powershell Co-authored-by: Tony M Lambert Co-authored-by: Michael Haag --- Invoke-AtomicRedTeam/Private/Invoke-CheckPrereqs.ps1 | 2 +- Invoke-AtomicRedTeam/Public/Invoke-AtomicTest.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Invoke-AtomicRedTeam/Private/Invoke-CheckPrereqs.ps1 b/Invoke-AtomicRedTeam/Private/Invoke-CheckPrereqs.ps1 index 5e4c224..c15fcce 100644 --- a/Invoke-AtomicRedTeam/Private/Invoke-CheckPrereqs.ps1 +++ b/Invoke-AtomicRedTeam/Private/Invoke-CheckPrereqs.ps1 @@ -6,7 +6,7 @@ function Invoke-CheckPrereqs ($test, $isElevated, $customInputArgs, $PathToAtomi foreach ($dep in $test.dependencies) { $executor = Get-PrereqExecutor $test $final_command = Merge-InputArgs $dep.prereq_command $test $customInputArgs $PathToAtomicsFolder - $final_command = ($final_Command.trim()).Replace("`n", " && ") + if($executor -ne "powershell") { $final_command = ($final_Command.trim()).Replace("`n", " && ") } $res = Invoke-ExecuteCommand $final_command $executor $TimeoutSeconds $description = Merge-InputArgs $dep.description $test $customInputArgs $PathToAtomicsFolder if ($res -ne 0) { diff --git a/Invoke-AtomicRedTeam/Public/Invoke-AtomicTest.ps1 b/Invoke-AtomicRedTeam/Public/Invoke-AtomicTest.ps1 index 772e922..b247195 100644 --- a/Invoke-AtomicRedTeam/Public/Invoke-AtomicTest.ps1 +++ b/Invoke-AtomicRedTeam/Public/Invoke-AtomicTest.ps1 @@ -202,7 +202,7 @@ function Invoke-AtomicTest { $description = (Merge-InputArgs $dep.description $test $InputArgs $PathToAtomicsFolder).trim() Write-KeyValue "Attempting to satisfy prereq: " $description $final_command_prereq = Merge-InputArgs $dep.prereq_command $test $InputArgs $PathToAtomicsFolder - $final_command_prereq = ($final_command_prereq.trim()).Replace("`n", " && ") + if($executor -ne "powershell") { $final_command_prereq = ($final_command_prereq.trim()).Replace("`n", " && ") } $final_command_get_prereq = Merge-InputArgs $dep.get_prereq_command $test $InputArgs $PathToAtomicsFolder $res = Invoke-ExecuteCommand $final_command_prereq $executor $TimeoutSeconds