Skip to content

Commit

Permalink
Fix empty results
Browse files Browse the repository at this point in the history
  • Loading branch information
alex27riva committed Dec 1, 2024
1 parent 02a777f commit 69fcf17
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion cmd/ip.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@ func analyzeIP(ip string) {

if abuseIPDBData != nil {
color.Blue("\nAbuseIPDB report")
if abuseIPDBData.Data.TotalReports == 0 {
fmt.Println("No reports found for this IP address")
return
}

// Print AbuseIPDB info
fmt.Printf("Abuse Confidence Score: %d\n", abuseIPDBData.Data.AbuseConfidenceScore)
Expand All @@ -106,7 +110,7 @@ func analyzeIP(ip string) {
}

} else {
fmt.Println("No reports found for this IP.")
color.Red("An error has occured.")
}

}
Expand Down

0 comments on commit 69fcf17

Please sign in to comment.