From 5b8cb9a82c9ac34cd9854018c2752728d389045f Mon Sep 17 00:00:00 2001 From: Simone Margaritelli Date: Wed, 7 Apr 2021 17:58:18 +0200 Subject: [PATCH] fix: check ssid probes for non printable characters --- modules/graph/node.go | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/graph/node.go b/modules/graph/node.go index bdf44622..db71eed1 100644 --- a/modules/graph/node.go +++ b/modules/graph/node.go @@ -3,6 +3,7 @@ package graph import ( "fmt" "time" + "unicode" ) type NodeType string @@ -50,7 +51,20 @@ func (n Node) String() string { func (n Node) Label() string { switch n.Type { case SSID: - return n.Entity.(string) + s := n.Entity.(string) + allPrint := true + + for _, rn := range s { + if !unicode.IsPrint(rune(rn)) { + allPrint = false + break + } + } + + if !allPrint { + s = fmt.Sprintf("0x%x", s) + } + return s case BLEServer: return fmt.Sprintf("%s\\n(%s)", n.Entity.(map[string]interface{})["mac"].(string),