Skip to content

Commit

Permalink
Fixed load-assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
Ne0nd0g committed Jul 21, 2022
1 parent 6ed48de commit 2d7754d
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkg/server/jobs/jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,17 +182,19 @@ func Add(agentID uuid.UUID, jobType string, jobArgs []string) (string, error) {
if err != nil {
return "", fmt.Errorf("there was an error reading the assembly at %s:\n%s", jobArgs[0], err)
}

name := filepath.Base(jobArgs[0])
if len(jobArgs) > 1 {
name = jobArgs[1]
}

fileHash := sha256.New()
_, err = io.WriteString(fileHash, string(assembly))
if err != nil {
message("warn", fmt.Sprintf("there was an error generating a file hash:\n%s", err))
}
jobArgs[2] = fmt.Sprintf("%s", fileHash.Sum(nil))
jobArgs = append(jobArgs, fmt.Sprintf("%s", fileHash.Sum(nil)))

name := filepath.Base(jobArgs[0])
if len(jobArgs) > 1 {
name = jobArgs[1]
}
job.Payload = merlinJob.Command{
Command: "clr",
Args: []string{jobType, base64.StdEncoding.EncodeToString([]byte(assembly)), name},
Expand Down

0 comments on commit 2d7754d

Please sign in to comment.