コード例 #1
1
ファイル: usage.go プロジェクト: essentialkaos/ek
// renderArgs render args with colors
func renderArgs(args []string) string {
	var result string

	for _, a := range args {
		if strings.HasPrefix(a, "?") {
			result += "{s-}" + a[1:] + "{!} "
		} else {
			result += "{s}" + a + "{!} "
		}
	}

	return fmtc.Sprintf(strings.TrimRight(result, " "))
}
コード例 #2
1
ファイル: cli.go プロジェクト: essentialkaos/sslcli
// getStatusInProgress return status message from any in-progress endpoint
func getStatusInProgress(endpoints []*sslscan.EndpointInfo) string {
	if len(endpoints) == 1 {
		return endpoints[0].StatusDetailsMessage
	}

	for num, endpoint := range endpoints {
		if endpoint.Grade != "" {
			continue
		}

		if endpoint.StatusDetailsMessage != "" {
			return fmtc.Sprintf("#%d: %s", num, endpoint.StatusDetailsMessage)
		}
	}

	return ""
}
コード例 #3
0
ファイル: details.go プロジェクト: essentialkaos/sslcli
// printHandshakeSimulationInfo print info about handshakes simulations
func printHandshakeSimulationInfo(details *sslscan.EndpointDetails, suiteIndex map[int]int) {
	printCategoryHeader("Handshake Simulation")

	for _, sim := range details.SIMS.Results {
		if sim.ErrorCode != 0 {
			fmtc.Printf(" %-24s {s}|{!} {r}Fail{!}\n", sim.Client.Name+" "+sim.Client.Version)
			continue
		}

		tag := "{s-}No FS{!}"
		suite := details.Suites.List[suiteIndex[sim.SuiteID]]

		if strings.Contains(suite.Name, "DHE_") {
			tag = "{g}   FS{!}"
		}

		if sim.Client.IsReference {
			fmtc.Printf(" %-38s {s}|{!} ", sim.Client.Name+" "+sim.Client.Version+" "+fmtc.Sprintf("{g}R"))
		} else {
			fmtc.Printf(" %-24s {s}|{!} ", sim.Client.Name+" "+sim.Client.Version)
		}

		switch protocolIDs[sim.ProtocolID] {
		case "TLS 1.2":
			fmtc.Printf("{g}%-7s{!} %-42s "+tag+" %d\n",
				protocolIDs[sim.ProtocolID],
				suite.Name, suite.CipherStrength,
			)
		case "SSL 2.0", "SSL 3.0":
			fmtc.Printf("{r}%-7s{!} %-42s "+tag+" %d\n",
				protocolIDs[sim.ProtocolID],
				suite.Name, suite.CipherStrength,
			)
		default:
			fmtc.Printf("%-7s %-42s "+tag+" %d\n",
				protocolIDs[sim.ProtocolID],
				suite.Name, suite.CipherStrength,
			)
		}
	}
}