From 7467c30cce64b5b450416389f63b1bc6e883c7f0 Mon Sep 17 00:00:00 2001 From: Jozef Reisinger Date: Tue, 19 Apr 2022 21:43:08 +0200 Subject: [PATCH] don't print empty summary info --- README.md | 5 +---- check/dnsname.go | 2 +- check/phishstats.go | 2 +- cli/cli.go | 4 ++-- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index ad7be92..f765ccf 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,8 @@ $ checkip 218.92.0.158 abuseipdb.com --> domain: chinatelecom.com.cn, usage type: Data Center/Web Hosting/Transit db-ip.com --> country: China (CN), city: Nanjing (Jiangning Qu), EU member: false dns mx --> chinatelecom.com.cn: testmail.chinatelecom.com.cn -dns name --> n/a iptoasn.com --> AS description: CHINANET-BACKBONE No.31,Jin-rong Street maxmind.com --> country: China (CN), city: Caolin, EU member: false -phishstats.info --> n/a shodan.io --> OS: n/a, 2 open ports: tcp/22 (OpenSSH, 7.4), tcp/53 urlscan.io --> 0 related URLs virustotal.com --> network: 218.92.0.0/16, SAN: n/a @@ -40,14 +38,13 @@ Active checks (`-a`) directly interact with the IP address. And scan checks (`-s $ checkip -a -s 45.33.32.156 # scanme.nmap.org checkip: Tls: dial tcp 45.33.32.156:443: connect: connection refused Open TCP ports --> 22 (ssh), 80 (http), 9929 (nping-echo), 31337 (Elite) -Ping --> 0% packet loss, sent 5, recv 5, avg round-trip 169 ms +Ping --> 0% packet loss, sent 5, recv 5, avg round-trip 168 ms abuseipdb.com --> domain: linode.com, usage type: Data Center/Web Hosting/Transit db-ip.com --> country: United States (US), city: Fremont, EU member: false dns mx --> linode.com: inbound-mail1.linode.com, inbound-mail3.linode.com dns name --> scanme.nmap.org iptoasn.com --> AS description: LINODE-AP Linode, LLC maxmind.com --> country: United States (US), city: Fremont, EU member: false -phishstats.info --> n/a shodan.io --> OS: n/a, 3 open ports: tcp/22 (OpenSSH, 6.6.1p1 Ubuntu-2ubuntu2.13), tcp/80 (Apache httpd, 2.4.7), udp/123 urlscan.io --> 0 related URLs virustotal.com --> network: 45.33.0.0/17, SAN: n/a diff --git a/check/dnsname.go b/check/dnsname.go index ce1b173..c4f3f0a 100644 --- a/check/dnsname.go +++ b/check/dnsname.go @@ -12,7 +12,7 @@ import ( type Names []string func (n Names) Summary() string { - return na(strings.Join(n, ", ")) + return strings.Join(n, ", ") } func (n Names) Json() ([]byte, error) { diff --git a/check/phishstats.go b/check/phishstats.go index 1bc63a1..2f6084a 100644 --- a/check/phishstats.go +++ b/check/phishstats.go @@ -16,7 +16,7 @@ type phishstats struct { } func (ps phishstats) Summary() string { - return na(ps.url) + return ps.url } func (ps phishstats) Json() ([]byte, error) { diff --git a/cli/cli.go b/cli/cli.go index 518fa7b..dd624f7 100755 --- a/cli/cli.go +++ b/cli/cli.go @@ -66,8 +66,8 @@ func (rs Results) SortByName() { func (rs Results) PrintSummary() { for _, r := range rs { // To avoid "invalid memory address or nil pointer dereference" - // runtime error. - if r.Info == nil { + // runtime error and printing empty summary info. + if r.Info == nil || r.Info.Summary() == "" { continue }