From abc41be0c51c959afb9468d09b5fc6b787d1384c Mon Sep 17 00:00:00 2001 From: Jozef Reisinger Date: Sat, 13 Nov 2021 15:33:03 +0100 Subject: [PATCH] rename Info.String to Info.Summary --- check/check.go | 4 ++-- checks/abuseipdb.go | 2 +- checks/as.go | 2 +- checks/dns.go | 2 +- checks/geo.go | 2 +- checks/shodan.go | 2 +- checks/urlscan.go | 2 +- checks/virustotal.go | 2 +- cli/cli.go | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/check/check.go b/check/check.go index b76e48d..ccb6db5 100644 --- a/check/check.go +++ b/check/check.go @@ -28,7 +28,7 @@ type Result struct { // Info is some generic information provided by an Info check. type Info interface { - String() string + Summary() string JsonString() (string, error) } @@ -37,7 +37,7 @@ type Info interface { type EmptyInfo struct { } -func (EmptyInfo) String() string { +func (EmptyInfo) Summary() string { return Na("") } diff --git a/checks/abuseipdb.go b/checks/abuseipdb.go index c2658c7..dd693de 100644 --- a/checks/abuseipdb.go +++ b/checks/abuseipdb.go @@ -26,7 +26,7 @@ type abuseIPDB struct { LastReportedAt time.Time `json:"lastReportedAt"` } -func (a abuseIPDB) String() string { +func (a abuseIPDB) Summary() string { return fmt.Sprintf("domain: %s, usage type: %s", check.Na(a.Domain), check.Na(a.UsageType)) } diff --git a/checks/as.go b/checks/as.go index 0aab652..f027f8a 100644 --- a/checks/as.go +++ b/checks/as.go @@ -21,7 +21,7 @@ type autonomousSystem struct { CountryCode string `json:"-"` } -func (a autonomousSystem) String() string { +func (a autonomousSystem) Summary() string { return fmt.Sprintf("AS description: %s", check.Na(a.Description)) } diff --git a/checks/dns.go b/checks/dns.go index 910ffd6..089d866 100644 --- a/checks/dns.go +++ b/checks/dns.go @@ -13,7 +13,7 @@ type dns struct { Names []string `json:"names"` } -func (d dns) String() string { +func (d dns) Summary() string { msg := "DNS name" if len(d.Names) > 1 { msg += "s" diff --git a/checks/geo.go b/checks/geo.go index b889e19..13450e0 100644 --- a/checks/geo.go +++ b/checks/geo.go @@ -15,7 +15,7 @@ type geo struct { IsoCode string `json:"iso_code"` } -func (g geo) String() string { +func (g geo) Summary() string { return fmt.Sprintf("city: %s, country: %s, ISO code: %s", check.Na(g.City), check.Na(g.Country), check.Na(g.IsoCode)) } diff --git a/checks/shodan.go b/checks/shodan.go index 2a9e726..42ceb86 100644 --- a/checks/shodan.go +++ b/checks/shodan.go @@ -51,7 +51,7 @@ func (x byPort) Less(i, j int) bool { return x[i].Port < x[j].Port } func (x byPort) Swap(i, j int) { x[i], x[j] = x[j], x[i] } // Info returns interesting information from the check. -func (s shodan) String() string { +func (s shodan) Summary() string { var portInfo []string sort.Sort(byPort(s.Data)) for _, d := range s.Data { diff --git a/checks/urlscan.go b/checks/urlscan.go index f723dc5..83caa24 100644 --- a/checks/urlscan.go +++ b/checks/urlscan.go @@ -87,7 +87,7 @@ type urlscanResult struct { } // Strings tells how many scanned URLs are associated with the IP address. -func (u urlscan) String() string { +func (u urlscan) Summary() string { urlCnt := make(map[string]int) for _, r := range u.Results { urlCnt[r.Page.URL]++ diff --git a/checks/virustotal.go b/checks/virustotal.go index f7f35a2..b1d87e9 100644 --- a/checks/virustotal.go +++ b/checks/virustotal.go @@ -31,7 +31,7 @@ type virusTotal struct { } `json:"data"` } -func (v virusTotal) String() string { +func (v virusTotal) Summary() string { return fmt.Sprintf("AS onwer: %s, network: %s, SAN: %s", check.Na(v.Data.Attributes.ASowner), check.Na(v.Data.Attributes.Network), check.Na(strings.Join(v.Data.Attributes.LastHTTPScert.Extensions.SAN, ", "))) } diff --git a/cli/cli.go b/cli/cli.go index 14968f7..9af1697 100755 --- a/cli/cli.go +++ b/cli/cli.go @@ -57,7 +57,7 @@ func (rs Results) SortByName() { func (rs Results) PrintInfo() { for _, r := range rs { if r.Type == "Info" || r.Type == "InfoSec" { - fmt.Printf("%-15s %s\n", r.Name, r.Info.String()) + fmt.Printf("%-15s %s\n", r.Name, r.Info.Summary()) } } }