4 Commits

Author SHA1 Message Date
wh1te909
5dbe513fe3 v2.0.1 2022-03-24 18:24:45 -07:00
wh1te909
92af9b5c67 add debug 2022-03-25 00:10:08 +00:00
wh1te909
c57c5a0cbf fallback to cwd if unable to create tmpdir in /tmp amidaware/tacticalrmm#1017 2022-03-24 01:51:00 +00:00
wh1te909
118608999c strip windows newlines on nix 2022-03-23 22:55:10 +00:00
6 changed files with 36 additions and 14 deletions

View File

@@ -133,11 +133,12 @@ func NewAgentConfig() *rmm.AgentConfig {
}
func (a *Agent) RunScript(code string, shell string, args []string, timeout int) (stdout, stderr string, exitcode int, e error) {
code = removeWinNewLines(code)
content := []byte(code)
f, err := os.CreateTemp("", "trmm")
f, err := createTmpFile()
if err != nil {
a.Logger.Errorln(err)
a.Logger.Errorln("RunScript createTmpFile()", err)
return "", err.Error(), 85, err
}
defer os.Remove(f.Name())
@@ -186,9 +187,9 @@ func (a *Agent) AgentUpdate(url, inno, version string) {
return
}
f, err := os.CreateTemp("", "")
f, err := createTmpFile()
if err != nil {
a.Logger.Errorln("AgentUpdate()", err)
a.Logger.Errorln("AgentUpdate createTmpFile()", err)
return
}
defer os.Remove(f.Name())
@@ -231,9 +232,9 @@ func (a *Agent) AgentUpdate(url, inno, version string) {
}
func (a *Agent) AgentUninstall(code string) {
f, err := os.CreateTemp("", "trmm")
f, err := createTmpFile()
if err != nil {
a.Logger.Errorln("AgentUninstall CreateTemp:", err)
a.Logger.Errorln("AgentUninstall createTmpFile():", err)
return
}
@@ -261,11 +262,12 @@ func (a *Agent) NixMeshNodeID() string {
for !meshSuccess {
out := a.CmdV2(opts)
meshNodeID = out.Stdout
a.Logger.Debugln("Stdout:", out.Stdout)
a.Logger.Debugln("Stderr:", out.Stderr)
if meshNodeID == "" {
time.Sleep(1 * time.Second)
continue
} else if strings.Contains(strings.ToLower(meshNodeID), "graphical version") || strings.Contains(strings.ToLower(meshNodeID), "zenity") {
a.Logger.Debugln(out.Stdout)
time.Sleep(1 * time.Second)
continue
}

View File

@@ -298,3 +298,23 @@ func randRange(min, max int) int {
func randomCheckDelay() {
time.Sleep(time.Duration(randRange(300, 950)) * time.Millisecond)
}
func removeWinNewLines(s string) string {
return strings.ReplaceAll(s, "\r\n", "\n")
}
func createTmpFile() (*os.File, error) {
var f *os.File
f, err := os.CreateTemp("", "trmm")
if err != nil {
cwd, err := os.Getwd()
if err != nil {
return f, err
}
f, err = os.CreateTemp(cwd, "trmm")
if err != nil {
return f, err
}
}
return f, nil
}

View File

@@ -3,7 +3,7 @@
<assemblyIdentity
type="win32"
name="TacticalRMM"
version="2.0.0.0"
version="2.0.1.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.0.0"
#define MyAppVersion "2.0.1"
#define MyAppPublisher "AmidaWare LLC"
#define MyAppURL "https://github.com/amidaware"
#define MyAppExeName "tacticalrmm.exe"

View File

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

View File

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