diff --git a/pkg/protocols/common/interactsh/interactsh.go b/pkg/protocols/common/interactsh/interactsh.go index 675590d5..490ae539 100644 --- a/pkg/protocols/common/interactsh/interactsh.go +++ b/pkg/protocols/common/interactsh/interactsh.go @@ -151,6 +151,13 @@ func requestShouldStopAtFirstMatch(request *RequestData) bool { // processInteractionForRequest processes an interaction for a request func (c *Client) processInteractionForRequest(interaction *server.Interaction, data *RequestData) bool { + var result *operators.Result + var matched bool + defer func() { + if r := recover(); r != nil { + gologger.Error().Msgf("panic occurred while processing interaction with result=%v matched=%v err=%v", result, matched, r) + } + }() data.Event.Lock() data.Event.InternalEvent["interactsh_protocol"] = interaction.Protocol data.Event.InternalEvent["interactsh_request"] = interaction.RawRequest @@ -158,7 +165,16 @@ func (c *Client) processInteractionForRequest(interaction *server.Interaction, d data.Event.InternalEvent["interactsh_ip"] = interaction.RemoteAddress data.Event.Unlock() - result, matched := data.Operators.Execute(data.Event.InternalEvent, data.MatchFunc, data.ExtractFunc, c.options.Debug || c.options.DebugRequest || c.options.DebugResponse) + if data.Operators != nil { + result, matched = data.Operators.Execute(data.Event.InternalEvent, data.MatchFunc, data.ExtractFunc, c.options.Debug || c.options.DebugRequest || c.options.DebugResponse) + } else { + // this is most likely a bug so error instead of warning + var templateID string + if data.Event.InternalEvent != nil { + templateID = fmt.Sprint(data.Event.InternalEvent[templateIdAttribute]) + } + gologger.Error().Msgf("missing compiled operators for '%v' template", templateID) + } // for more context in github actions if strings.EqualFold(os.Getenv("GITHUB_ACTIONS"), "true") && c.options.Debug {