Minor cleanup and and got the client sending agents again.

This commit is contained in:
James Wells 2022-07-14 13:27:46 -07:00
parent 42623f63c6
commit 134f33cd6a
Signed by: jwells
GPG key ID: 73196D10B8E65666
7 changed files with 50 additions and 64 deletions

View file

@ -2,6 +2,7 @@ package client
import (
sha "crypto/sha256"
hex "encoding/hex"
fmt "fmt"
ioutil "io/ioutil"
log "log"
@ -40,9 +41,10 @@ func Main(wg *sync.WaitGroup, config gstructs.GagentConfig) {
log.Printf("[DEBUG] Agent file contents: \n----- -----\n%s\n----- -----\n", agent.ScriptCode)
}
agent.Client = config.UUID
agent.Shasum = fmt.Sprintf("%s", sha.Sum256(agent.ScriptCode))
tmpsum := sha.Sum256([]byte(agent.ScriptCode))
agent.Shasum = fmt.Sprintf("%v", hex.EncodeToString(tmpsum[:]))
log.Printf("[INFO] SHA256 of Agent file: %s", agent.Shasum)
agent.Status = "loaded"
agent.Status = 1
agent.Hints = getTagsFromHints(agent)
agent.Answer = nil