From e98975a213c323b5fcd355d45ef9667e82cb5c13 Mon Sep 17 00:00:00 2001 From: evilsocket Date: Sun, 24 Feb 2019 20:59:35 +0100 Subject: [PATCH] misc: small fix or general refactoring i did not bother commenting --- modules/events_stream/trigger_list.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/modules/events_stream/trigger_list.go b/modules/events_stream/trigger_list.go index 08bb7ff7..6ada05ab 100644 --- a/modules/events_stream/trigger_list.go +++ b/modules/events_stream/trigger_list.go @@ -92,8 +92,7 @@ func (l *TriggerList) Dispatch(e session.Event) (ident string, cmd string, err e for id, t := range l.triggers { if e.Tag == t.For { - found = true - ident = id + // this is ugly but it's also the only way to allow // the user to do this easily - since each event Data // field is an interface and type casting is not possible @@ -102,9 +101,11 @@ func (l *TriggerList) Dispatch(e session.Event) (ident string, cmd string, err e // user to access it in the command via JSON-Query, example: // // events.on wifi.client.new "wifi.deauth {{Client\mac}}" + cmd = t.Action + found = true + ident = id buf := ([]byte)(nil) doc := (*jsonquery.Node)(nil) - cmd = t.Action // parse each {EXPR} for _, m := range reQueryCapture.FindAllString(t.Action, -1) { // parse the event Data field as a JSON objects once