From f40228bcc474043aad0a3094ef51976531b4a3ae Mon Sep 17 00:00:00 2001 From: "M. Mert Yildiran" Date: Fri, 17 Sep 2021 21:53:09 +0300 Subject: [PATCH] Fix some issues --- agent/main.go | 2 ++ agent/pkg/api/socket_routes.go | 6 +----- agent/pkg/controllers/entries_controller.go | 6 +++++- tap/extensions/amqp/main.go | 1 - 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/agent/main.go b/agent/main.go index 2dc07ecc4..9d2113f1d 100644 --- a/agent/main.go +++ b/agent/main.go @@ -75,6 +75,8 @@ func main() { rlog.Infof("Filtering for the following authorities: %v", tap.GetFilterIPs()) } + time.Sleep(2 * time.Second) + // harOutputChannel, outboundLinkOutputChannel := tap.StartPassiveTapper(tapOpts) filteredOutputItemsChannel := make(chan *tapApi.OutputChannelItem) tap.StartPassiveTapper(tapOpts, filteredOutputItemsChannel, extensions) diff --git a/agent/pkg/api/socket_routes.go b/agent/pkg/api/socket_routes.go index 385d96252..e72ff3bb6 100644 --- a/agent/pkg/api/socket_routes.go +++ b/agent/pkg/api/socket_routes.go @@ -41,11 +41,7 @@ func init() { func WebSocketRoutes(app *gin.Engine, eventHandlers EventHandlers) { app.GET("/ws", func(c *gin.Context) { - queryMap := c.Request.URL.Query() - query := "" - if val, ok := queryMap["q"]; ok { - query = val[0] - } + query := c.DefaultQuery("q", "") websocketHandlerUI(c.Writer, c.Request, eventHandlers, false, query) }) app.GET("/wsTapper", func(c *gin.Context) { diff --git a/agent/pkg/controllers/entries_controller.go b/agent/pkg/controllers/entries_controller.go index 45d21d310..c5b726847 100644 --- a/agent/pkg/controllers/entries_controller.go +++ b/agent/pkg/controllers/entries_controller.go @@ -139,6 +139,10 @@ func GetEntry(c *gin.Context) { id, _ := strconv.Atoi(c.Param("entryId")) fmt.Printf("GetEntry id: %v\n", id) entry := api.Single(uint(id)) + var response map[string]interface{} + if entry["response"] != nil { + response = entry["response"].(map[string]interface{}) + } entryData := tapApi.MizuEntry{ Protocol: tapApi.Protocol{ Name: entry["proto"].(map[string]interface{})["name"].(string), @@ -152,7 +156,7 @@ func GetEntry(c *gin.Context) { Priority: uint8(entry["proto"].(map[string]interface{})["priority"].(float64)), }, Request: entry["request"].(map[string]interface{}), - Response: entry["response"].(map[string]interface{}), + Response: response, EntryId: entry["entryId"].(string), Entry: entry["entry"].(string), Url: entry["url"].(string), diff --git a/tap/extensions/amqp/main.go b/tap/extensions/amqp/main.go index ad6c5b8ee..128f54872 100644 --- a/tap/extensions/amqp/main.go +++ b/tap/extensions/amqp/main.go @@ -269,7 +269,6 @@ func (d dissecting) Analyze(item *api.OutputChannelItem, entryId string, resolve return &api.MizuEntry{ Protocol: protocol, Request: reqDetails, - Response: item.Pair.Response.Payload.(map[string]interface{})["details"].(map[string]interface{}), EntryId: entryId, Entry: string(entryBytes), Url: fmt.Sprintf("%s%s", service, summary),