From d61c033319802dd66d21bf1b0905a7398a4fcb46 Mon Sep 17 00:00:00 2001 From: Arceliar Date: Sat, 3 Dec 2022 16:23:44 -0600 Subject: [PATCH] fix some missed edge cases in the go crawler --- scripts/crawler.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/crawler.go b/scripts/crawler.go index a6d638d..2d34088 100644 --- a/scripts/crawler.go +++ b/scripts/crawler.go @@ -63,6 +63,9 @@ func doRequest(request map[string]interface{}) map[string]interface{} { } // TODO parse res, check if there's an error if res, ok := res["response"]; ok { + if _, ok := res.(map[string]interface{}); !ok { + continue + } if _, isIn := res.(map[string]interface{})["error"]; isIn { continue } @@ -101,6 +104,9 @@ func doRumor(key string, out chan rumorResult) { defer func() { <-semaphore }() results := make(map[string]interface{}) if res, ok := getNodeInfo(key)["response"]; ok { + if _, ok := res.(map[string]interface{}); !ok { + return + } for addr, v := range res.(map[string]interface{}) { vm, ok := v.(map[string]interface{}) if !ok { @@ -111,6 +117,9 @@ func doRumor(key string, out chan rumorResult) { } } if res, ok := getSelf(key)["response"]; ok { + if _, ok := res.(map[string]interface{}); !ok { + return + } for _, v := range res.(map[string]interface{}) { vm, ok := v.(map[string]interface{}) if !ok { @@ -122,6 +131,9 @@ func doRumor(key string, out chan rumorResult) { } } if res, ok := getPeers(key)["response"]; ok { + if _, ok := res.(map[string]interface{}); !ok { + return + } for _, v := range res.(map[string]interface{}) { vm, ok := v.(map[string]interface{}) if !ok { @@ -133,6 +145,9 @@ func doRumor(key string, out chan rumorResult) { } } if res, ok := getDHT(key)["response"]; ok { + if _, ok := res.(map[string]interface{}); !ok { + return + } for _, v := range res.(map[string]interface{}) { vm, ok := v.(map[string]interface{}) if !ok {