Skip to content

Instantly share code, notes, and snippets.

@khyberspache
Last active January 19, 2021 14:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khyberspache/c8239ec658660c86002d2c9b0529cb26 to your computer and use it in GitHub Desktop.
Save khyberspache/c8239ec658660c86002d2c9b0529cb26 to your computer and use it in GitHub Desktop.
PneumaEX command handler for modules
if executor == "keyword" {
task := splitMessage(message, '.')
if task[0] == "module" {
var err error
if !contains(util.InstalledModuleKeywords, task[1] + "." + task[2]) {
err = util.InstallModule(task[1], payloadPath)
}
if err != nil {
return err.Error(), 1, -1
}
if len(task) >= 4 {
return util.RunModuleTask(task[1], task[2], util.ParseArguments(task[3]))
}
return util.RunModuleTask(task[1], task[2], []string{})
} else if task[0] == "config" {
return updateConfiguration(task[1], agent)
}
return "Keyword selected not available for agent", 0, 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment