order modules to run in specified order from .ini
This commit is contained in:
parent
bd8dcd9b7b
commit
23a4636c34
@ -37,6 +37,7 @@ func (b *BaseModule) SetDefaultPortAndName(cmd *flags.Command, port uint, name s
|
||||
}
|
||||
|
||||
var modules map[string]*Module
|
||||
var orderedModules []string
|
||||
|
||||
func init() {
|
||||
modules = make(map[string]*Module)
|
||||
@ -47,6 +48,6 @@ func RegisterModule(name string, m Module) {
|
||||
if modules[name] != nil {
|
||||
log.Fatal("name already used")
|
||||
}
|
||||
|
||||
orderedModules = append(orderedModules, name)
|
||||
modules[name] = &m
|
||||
}
|
||||
|
@ -32,7 +32,8 @@ type ModuleResponse struct {
|
||||
func grabTarget(input target, m *Monitor) []byte {
|
||||
moduleResult := make(map[string]ModuleResponse)
|
||||
|
||||
for _, action := range modules {
|
||||
for _, moduleName := range orderedModules {
|
||||
action := modules[moduleName]
|
||||
name, res := runHandler(*action, m, input.IP)
|
||||
moduleResult[name] = res
|
||||
if res.Error != nil && !config.Multiple.ContinueOnError {
|
||||
|
Loading…
Reference in New Issue
Block a user