Skip to content

Commit

Permalink
UI improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
andyone committed Dec 11, 2023
1 parent ff1c1eb commit 128d4e7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 42 deletions.
6 changes: 3 additions & 3 deletions cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,9 @@ func check(host string) (string, bool) {
expiryMessage := getExpiryMessage(ap, maxLeftToExpiry)

if len(info.Endpoints) == 1 {
fmtc.TPrintf("{*}%s{!} "+getColoredGrade(info.Endpoints[0].Grade)+expiryMessage+"\n", host)
fmtc.TPrintf("{*}%s{!} {s-}→{!} "+getColoredGrade(info.Endpoints[0].Grade)+expiryMessage+"\n", host)
} else {
fmtc.TPrintf("{*}%s{!} "+getColoredGrades(info.Endpoints)+expiryMessage+"\n", host)
fmtc.TPrintf("{*}%s{!} {s-}→{!} "+getColoredGrades(info.Endpoints)+expiryMessage+"\n", host)
}

if options.GetB(OPT_DETAILED) {
Expand Down Expand Up @@ -491,7 +491,7 @@ func getColoredGrades(endpoints []*sslscan.EndpointInfo) string {
var result string

for _, endpoint := range endpoints {
result += getColoredGrade(endpoint.Grade) + "{s-}/" + endpoint.IPAddress + "{!} "
result += getColoredGrade(endpoint.Grade) + "{s}/" + endpoint.IPAddress + "{!} "
}

return result
Expand Down
49 changes: 10 additions & 39 deletions cli/details.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,11 @@ func printProtocolInfo(protocol string, supportedProtocols map[string]bool) {
fmtc.Println("{y}No{!}")
}
case protocol == "TLS 1.0", protocol == "TLS 1.1":
fmtc.Printf("{y}%s{!}\n", printBool(supportedProtocols[protocol]))
if supportedProtocols[protocol] {
fmtc.Println("{y}Yes{!}")
} else {
fmtc.Println("No")
}
case protocol == "SSL 3.0" && supportedProtocols[protocol]:
fmtc.Printf("{r}%s (INSECURE){!}\n", printBool(supportedProtocols[protocol]))
case protocol == "SSL 2.0" && supportedProtocols[protocol]:
Expand Down Expand Up @@ -1099,28 +1103,16 @@ func printEndpointNamedGroups(namedGroups *sslscan.NamedGroups) {
return
}

groups := getNamedGroups(namedGroups)
var groups []string

for i := 0; i < len(groups); i++ {
switch i {
case 0:
// skip
default:
fmtc.NewLine()
fmtc.Printf(" %-40s {s}|{!} ", "")
}

fmtc.Printf(strings.Join(groups[i], ", "))

if i != len(groups)-1 {
fmtc.Printf(",")
}
for _, group := range namedGroups.List {
groups = append(groups, group.Name)
}

fmtc.Print(strings.Join(groups, ", "))

if namedGroups.Preference {
fmtc.Printf(" {s-}(server preferred order){!}\n")
} else {
fmtc.Printf("\n")
}
}

Expand Down Expand Up @@ -1366,27 +1358,6 @@ func getProtocols(protocols []*sslscan.Protocol) map[string]bool {
return supported
}

// getNamedGroups returns slice of slices with named groups
func getNamedGroups(groups *sslscan.NamedGroups) [][]string {
var result [][]string
var buf []string

for _, group := range groups.List {
buf = append(buf, group.Name)

if len(buf) == 3 {
result = append(result, buf)
buf = nil
}
}

if buf != nil {
result = append(result, buf)
}

return result
}

// getPinsFromPolicy returns slice with all pins in policy
func getPinsFromPolicy(policy *sslscan.HPKPPolicy) []string {
var pins []string
Expand Down

0 comments on commit 128d4e7

Please sign in to comment.