Skip to content

Commit

Permalink
added serious error checking hehe
Browse files Browse the repository at this point in the history
  • Loading branch information
pry0cc committed Mar 15, 2022
1 parent 99ed61e commit d85ab13
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,18 @@ func ParseDnsx(filename string) map[string][]string {
var result map[string]interface{}
json.Unmarshal([]byte(scanner.Text()), &result)
host := result["host"].(string)
aRecords := result["a"].([]interface{})
ip := ""

for _, record := range aRecords {
ip = record.(string)
}
if val, ok := result["a"]; ok {
aRecords := val.([]interface{})

ip := ""

data[ip] = append(data[ip], host)
for _, record := range aRecords {
ip = record.(string)
}

data[ip] = append(data[ip], host)
}
}

if err := scanner.Err(); err != nil {
Expand Down

0 comments on commit d85ab13

Please sign in to comment.