Skip to content

Commit 7a987c9

Browse files
juzeonyuhan6665
authored andcommitted
use constants for tls versions
1 parent 4ba7e10 commit 7a987c9

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

scanner.go

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,6 @@ import (
99
"time"
1010
)
1111

12-
var TLSDictionary = map[uint16]string{
13-
0x0301: "1.0",
14-
0x0302: "1.1",
15-
0x0303: "1.2",
16-
0x0304: "1.3",
17-
}
18-
1912
func ScanTLS(host Host, out chan<- string) {
2013
if host.IP == nil {
2114
ips, err := net.LookupIP(host.Origin)
@@ -67,7 +60,7 @@ func ScanTLS(host Host, out chan<- string) {
6760
issuers := strings.Join(state.PeerCertificates[0].Issuer.Organization, " | ")
6861
log := slog.Info
6962
feasible := true
70-
if state.Version != 0x0304 || alpn != "h2" || len(domain) == 0 || len(issuers) == 0 {
63+
if state.Version != tls.VersionTLS13 || alpn != "h2" || len(domain) == 0 || len(issuers) == 0 {
7164
// not feasible
7265
log = slog.Debug
7366
feasible = false
@@ -76,5 +69,5 @@ func ScanTLS(host Host, out chan<- string) {
7669
}
7770
log("Connected to target", "feasible", feasible, "ip", host.IP.String(),
7871
"origin", host.Origin,
79-
"tls", TLSDictionary[state.Version], "alpn", alpn, "cert-domain", domain, "cert-issuer", issuers)
72+
"tls", tls.VersionName(state.Version), "alpn", alpn, "cert-domain", domain, "cert-issuer", issuers)
8073
}

0 commit comments

Comments
 (0)