Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
5dbe513fe3 | ||
![]() |
92af9b5c67 | ||
![]() |
c57c5a0cbf | ||
![]() |
118608999c |
@@ -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
|
||||
}
|
||||
|
@@ -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
|
||||
}
|
||||
|
@@ -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>
|
||||
|
@@ -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"
|
||||
|
2
main.go
2
main.go
@@ -25,7 +25,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
version = "2.0.0"
|
||||
version = "2.0.1"
|
||||
log = logrus.New()
|
||||
logFile *os.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": {
|
||||
|
Reference in New Issue
Block a user