fix path on exchange servers fixes amidaware/tacticalrmm#1359

This commit is contained in:
wh1te909 2022-12-11 23:50:00 -08:00
parent 293151ea0a
commit c3e33a6def
2 changed files with 25 additions and 6 deletions

View file

@ -20,6 +20,7 @@ import (
"math/rand"
"net"
"os"
"os/exec"
"path/filepath"
"runtime"
goDebug "runtime/debug"
@ -339,3 +340,19 @@ func regRangeToInt(s string) int {
max, _ := strconv.Atoi(split[1])
return randRange(min, max)
}
func getPowershellExe() string {
powershell, err := exec.LookPath("powershell.exe")
if err != nil || powershell == "" {
return filepath.Join(os.Getenv("WINDIR"), `System32\WindowsPowerShell\v1.0\powershell.exe`)
}
return powershell
}
func getCMDExe() string {
cmdExe, err := exec.LookPath("cmd.exe")
if err != nil || cmdExe == "" {
return filepath.Join(os.Getenv("WINDIR"), `System32\cmd.exe`)
}
return cmdExe
}