Skip to content

Commit

Permalink
rename Info.String to Info.Summary
Browse files Browse the repository at this point in the history
  • Loading branch information
Jozef Reisinger committed Nov 13, 2021
1 parent b43d3fa commit abc41be
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions check/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -37,7 +37,7 @@ type Info interface {
type EmptyInfo struct {
}

func (EmptyInfo) String() string {
func (EmptyInfo) Summary() string {
return Na("")
}

Expand Down
2 changes: 1 addition & 1 deletion checks/abuseipdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand Down
2 changes: 1 addition & 1 deletion checks/as.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand Down
2 changes: 1 addition & 1 deletion checks/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion checks/geo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

Expand Down
2 changes: 1 addition & 1 deletion checks/shodan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion checks/urlscan.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]++
Expand Down
2 changes: 1 addition & 1 deletion checks/virustotal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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, ", ")))
}

Expand Down
2 changes: 1 addition & 1 deletion cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
}
}
Expand Down

0 comments on commit abc41be

Please sign in to comment.