From 762b07c138dbf1596183ebf83292e1f62e62651f Mon Sep 17 00:00:00 2001 From: Hare Sudhan Date: Sun, 14 Apr 2024 17:04:58 -0400 Subject: [PATCH] running pwsh lint --- Private/Invoke-ExecuteCommand.ps1 | 2 +- Public/Invoke-AtomicTest.ps1 | 2 +- Public/Invoke-SetupAtomicRunner.ps1 | 2 +- Public/Set-Sudo.ps1 | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Private/Invoke-ExecuteCommand.ps1 b/Private/Invoke-ExecuteCommand.ps1 index 7d68931..1fb0a1c 100644 --- a/Private/Invoke-ExecuteCommand.ps1 +++ b/Private/Invoke-ExecuteCommand.ps1 @@ -12,7 +12,7 @@ function Invoke-ExecuteCommand ($finalCommand, $executor, $elevationreq, $can_su $execExe = $executor $execPrefix = "-c" } - + if ($executor -eq "command_prompt") { $execPrefix = "/c"; $execExe = "cmd.exe"; diff --git a/Public/Invoke-AtomicTest.ps1 b/Public/Invoke-AtomicTest.ps1 index 4555aa1..c4f6644 100644 --- a/Public/Invoke-AtomicTest.ps1 +++ b/Public/Invoke-AtomicTest.ps1 @@ -431,7 +431,7 @@ function Invoke-AtomicTest { # Check if linux Host can use sudo without a password. $can_sudo = Set-Sudo($false) - + if ($CheckPrereqs) { Write-KeyValue "CheckPrereq's for: " $testId $failureReasons = Invoke-CheckPrereqs $test $isElevated $executionPlatform $InputArgs $PathToPayloads $TimeoutSeconds $session diff --git a/Public/Invoke-SetupAtomicRunner.ps1 b/Public/Invoke-SetupAtomicRunner.ps1 index d4adb18..be3369d 100755 --- a/Public/Invoke-SetupAtomicRunner.ps1 +++ b/Public/Invoke-SetupAtomicRunner.ps1 @@ -99,7 +99,7 @@ function Invoke-SetupAtomicRunner { $exists = cat /etc/crontab | Select-String -Quiet "KickoffAtomicRunner" #checks if the Kickoff-AtomicRunner job exists. If not appends it to the system crontab. if ($null -eq $exists -and $can_sudo -eq $true) { - $(echo "$job" | sudo tee -a /etc/crontab) + $(Write-Output "$job" | sudo tee -a /etc/crontab) write-host "setting cronjob" } elseif ($null -eq $exists -and $can_sudo -eq $false) { diff --git a/Public/Set-Sudo.ps1 b/Public/Set-Sudo.ps1 index fb93be1..ea33f89 100644 --- a/Public/Set-Sudo.ps1 +++ b/Public/Set-Sudo.ps1 @@ -5,7 +5,7 @@ function Set-Sudo ($set_sudo) { try { if ((sudo -A whoami) -and ((sudo grep -r $env:USER /etc/sudoers | grep NOPASSWD:ALL) -or (sudo grep -r $env:USER /etc/sudoers.d | grep NOPASSWD:ALL))){ - + if($set_sudo){ Write-Host "Passwordless logon already configured.`n" } @@ -13,9 +13,9 @@ function Set-Sudo ($set_sudo) { } elseif ($set_sudo -eq $true){ - + Write-Host "Configuring Passwordless logon...`n" - echo "$env:USER ALL=(ALL) NOPASSWD:ALL" > /tmp/90-$env:USER-sudo-access + Write-Output "$env:USER ALL=(ALL) NOPASSWD:ALL" > /tmp/90-$env:USER-sudo-access sudo install -m 440 /tmp/90-$env:USER-sudo-access /etc/sudoers.d/90-$env:USER-sudo-access rm -f /tmp/90-$env:USER-sudo-access $nopassword_enabled = $true @@ -30,4 +30,4 @@ function Set-Sudo ($set_sudo) { $nopassword_enabled = $false } return $nopassword_enabled -} \ No newline at end of file +}