Release 2.4.4

This commit is contained in:
wh1te909 2022-12-21 11:11:08 -08:00
commit a3c3de947e
10 changed files with 51 additions and 21 deletions

View File

@ -418,6 +418,7 @@ func (a *Agent) setupNatsOptions() []nats.Option {
opts = append(opts, nats.UserInfo(a.AgentID, a.Token))
opts = append(opts, nats.ReconnectWait(time.Duration(reconnectWait)*time.Second))
opts = append(opts, nats.RetryOnFailedConnect(true))
opts = append(opts, nats.IgnoreAuthErrorAbort())
opts = append(opts, nats.PingInterval(time.Duration(a.NatsPingInterval)*time.Second))
opts = append(opts, nats.Compression(a.NatsWSCompression))
opts = append(opts, nats.MaxReconnects(-1))

View File

@ -132,7 +132,7 @@ func (a *Agent) RunScript(code string, shell string, args []string, timeout int,
switch shell {
case "powershell":
exe = "Powershell"
exe = getPowershellExe()
cmdArgs = []string{"-NonInteractive", "-NoProfile", "-ExecutionPolicy", "Bypass", tmpfn.Name()}
case "python":
exe = a.PyBin
@ -260,23 +260,25 @@ func CMDShell(shell string, cmdArgs []string, command string, timeout int, detac
defer cancel()
sysProcAttr := &windows.SysProcAttr{}
cmdExe := getCMDExe()
powershell := getPowershellExe()
if len(cmdArgs) > 0 && command == "" {
switch shell {
case "cmd":
cmdArgs = append([]string{"/C"}, cmdArgs...)
cmd = exec.Command("cmd.exe", cmdArgs...)
cmd = exec.Command(cmdExe, cmdArgs...)
case "powershell":
cmdArgs = append([]string{"-NonInteractive", "-NoProfile"}, cmdArgs...)
cmd = exec.Command("powershell.exe", cmdArgs...)
cmd = exec.Command(powershell, cmdArgs...)
}
} else {
switch shell {
case "cmd":
cmd = exec.Command("cmd.exe")
sysProcAttr.CmdLine = fmt.Sprintf("cmd.exe /C %s", command)
cmd = exec.Command(cmdExe)
sysProcAttr.CmdLine = fmt.Sprintf("%s /C %s", cmdExe, command)
case "powershell":
cmd = exec.Command("Powershell", "-NonInteractive", "-NoProfile", command)
cmd = exec.Command(powershell, "-NonInteractive", "-NoProfile", command)
}
}

View File

@ -12,6 +12,9 @@ https://license.tacticalrmm.com
package agent
import (
"os"
"os/exec"
"path/filepath"
"time"
rmm "github.com/amidaware/rmmagent/shared"
@ -59,7 +62,14 @@ func (a *Agent) InstallChoco() {
}
func (a *Agent) InstallWithChoco(name string) (string, error) {
out, err := CMD("choco.exe", []string{"install", name, "--yes", "--force", "--force-dependencies", "--no-progress"}, 1200, false)
var exe string
choco, err := exec.LookPath("choco.exe")
if err != nil || choco == "" {
exe = filepath.Join(os.Getenv("PROGRAMDATA"), `chocolatey\bin\choco.exe`)
} else {
exe = choco
}
out, err := CMD(exe, []string{"install", name, "--yes", "--force", "--force-dependencies", "--no-progress"}, 1200, false)
if err != nil {
a.Logger.Errorln(err)
return err.Error(), err

View File

@ -20,6 +20,7 @@ import (
"math/rand"
"net"
"os"
"os/exec"
"path/filepath"
"runtime"
goDebug "runtime/debug"
@ -60,7 +61,7 @@ func DoPing(host string) (PingResponse, error) {
}
pinger.Count = 3
pinger.Size = 24
pinger.Size = 548
pinger.Interval = time.Second
pinger.Timeout = 5 * time.Second
pinger.SetPrivileged(true)
@ -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
}

View File

@ -3,7 +3,7 @@
<assemblyIdentity
type="win32"
name="TacticalRMM"
version="2.4.3.0"
version="2.4.4.0"
processorArchitecture="*"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>

View File

@ -1,5 +1,5 @@
#define MyAppName "Tactical RMM Agent"
#define MyAppVersion "2.4.3"
#define MyAppVersion "2.4.4"
#define MyAppPublisher "AmidaWare LLC"
#define MyAppURL "https://github.com/amidaware"
#define MyAppExeName "tacticalrmm.exe"

4
go.mod
View File

@ -10,8 +10,8 @@ require (
github.com/go-resty/resty/v2 v2.7.0
github.com/gonutz/w32/v2 v2.4.0
github.com/iamacarpet/go-win64api v0.0.0-20220531131246-e84054eb584d
github.com/nats-io/nats-server/v2 v2.9.8 // indirect
github.com/nats-io/nats.go v1.20.0
github.com/nats-io/nats-server/v2 v2.9.10 // indirect
github.com/nats-io/nats.go v1.22.0
github.com/rickb777/date v1.19.1
github.com/shirou/gopsutil/v3 v3.22.10
github.com/sirupsen/logrus v1.9.0

8
go.sum
View File

@ -212,10 +212,10 @@ github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrk
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/nats-io/jwt/v2 v2.3.0 h1:z2mA1a7tIf5ShggOFlR1oBPgd6hGqcDYsISxZByUzdI=
github.com/nats-io/nats-server/v2 v2.9.8 h1:jgxZsv+A3Reb3MgwxaINcNq/za8xZInKhDg9Q0cGN1o=
github.com/nats-io/nats-server/v2 v2.9.8/go.mod h1:AB6hAnGZDlYfqb7CTAm66ZKMZy9DpfierY1/PbpvI2g=
github.com/nats-io/nats.go v1.20.0 h1:T8JJnQfVSdh1CzGiwAOv5hEobYCBho/0EupGznYw0oM=
github.com/nats-io/nats.go v1.20.0/go.mod h1:tLqubohF7t4z3du1QDPYJIQQyhb4wl6DhjxEajSI7UA=
github.com/nats-io/nats-server/v2 v2.9.10 h1:LMC46Oi9E6BUx/xBsaCVZgofliAqKQzRPU6eKWkN8jE=
github.com/nats-io/nats-server/v2 v2.9.10/go.mod h1:AB6hAnGZDlYfqb7CTAm66ZKMZy9DpfierY1/PbpvI2g=
github.com/nats-io/nats.go v1.22.0 h1:3dxyVf+S449DbMriqQV27HgSbXklxT9SUKbDKIxhrV0=
github.com/nats-io/nats.go v1.22.0/go.mod h1:tLqubohF7t4z3du1QDPYJIQQyhb4wl6DhjxEajSI7UA=
github.com/nats-io/nkeys v0.3.0 h1:cgM5tL53EvYRU+2YLXIK0G2mJtK12Ft9oeooSZMA2G8=
github.com/nats-io/nkeys v0.3.0/go.mod h1:gvUNGjVcM2IPr5rCsRsC6Wb3Hr2CQAm08dsxtV6A5y4=
github.com/nats-io/nuid v1.0.1 h1:5iA8DT8V7q8WK2EScv2padNa/rTESc1KdnPw4TC2paw=

View File

@ -25,7 +25,7 @@ import (
)
var (
version = "2.4.3"
version = "2.4.4"
log = logrus.New()
logFile *os.File
)

View File

@ -3,13 +3,13 @@
"FileVersion": {
"Major": 2,
"Minor": 4,
"Patch": 3,
"Patch": 4,
"Build": 0
},
"ProductVersion": {
"Major": 2,
"Minor": 4,
"Patch": 3,
"Patch": 4,
"Build": 0
},
"FileFlagsMask": "3f",
@ -22,14 +22,14 @@
"Comments": "",
"CompanyName": "AmidaWare LLC",
"FileDescription": "Tactical RMM Agent",
"FileVersion": "v2.4.3.0",
"FileVersion": "v2.4.4.0",
"InternalName": "tacticalrmm.exe",
"LegalCopyright": "Copyright (c) 2022 AmidaWare LLC",
"LegalTrademarks": "",
"OriginalFilename": "tacticalrmm.exe",
"PrivateBuild": "",
"ProductName": "Tactical RMM Agent",
"ProductVersion": "v2.4.3.0",
"ProductVersion": "v2.4.4.0",
"SpecialBuild": ""
},
"VarFileInfo": {