From ed138122889d85ee3b29bb9ef686004fcec3803e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?n=C3=B8nexist?= <111337838+n0nexist@users.noreply.github.com> Date: Sat, 6 Jan 2024 12:53:55 +0100 Subject: [PATCH] Fixed csv reading bug --- main.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 2472a01..8c9674a 100644 --- a/main.go +++ b/main.go @@ -13,12 +13,13 @@ import ( "sync" "strings" "time" + "encoding/csv" "github.com/akamensky/argparse" ) var ( - version = "1.0.1" + version = "1.0.2" author = "n0nexist" mapEntries = []string{} foundBssids = []string{} @@ -97,7 +98,20 @@ func getIconString(device_type, auth_mode string) string{ } func processLine(line, action, filterssid, filtermac string) { - parts := strings.Split(line, ",") + r := csv.NewReader(strings.NewReader(line)) + r.Comma = ',' + + parts, err := r.Read() + if err != nil { + fmt.Println("Errore durante la lettura della riga:", err) + return + } + + if len(parts) < 9 { + fmt.Println("La riga non contiene abbastanza campi") + return + } + mac := parts[0] ssid := parts[1] auth_mode := parts[2]