16 g2pkp
, _
= base64
.StdEncoding
.DecodeString("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnCoEd1zYUJE6BqOC4NhQSLyJP/EZcBqIRn7gj8Xxic4h7lr+YQ23MkSJoHQLU09VpM6CYpXu61lfxuEFgBLEXpQ/vFtIOPRT9yTm+5HpFcTP9FMN9Er8n1Tefb6ga2+HwNBQHygwA0DaCHNRbH//OjynNwaOvUsRBOt9JN7m+fwxcfuU1WDzLkqvQtLL6sRqGrLMU90VS4sfyBlhH82dqD5jK4Q1aWWEyBnFRiL4U5W+44BKEMYq7LqXIBHHOZkQBKDwYXqVJYxOUnXitu0IyhT8ziJqs07PRgOXlwN+wLHee69FM8+6PnG33vQlJcINNYmdnfsOEXmJHjfFr45yaQIDAQAB")
17 g3pkp
, _
= base64
.StdEncoding
.DecodeString("MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAylJL6h7/ziRrqNpyGGjVVl0OSFotNQl2Ws+kyByxqf5TifutNP+IW5+75+gAAdw1c3UDrbOxuaR9KyZ5zhVACu9RuJ8yjHxwhlJLFv5qJ2vmNnpiUNjfmonMCSnrTykUiIALjzgegGoYfB29lzt4fUVJNk9BzaLgdlc8aDF5ZMlu11EeZsOiZCx5wOdlw1aEU1pDbcuaAiDS7xpp0bCdc6LgKmBlUDHP+7MvvxGIQC61SRAPCm7cl/q/LJ8FOQtYVK8GlujFjgEWvKgaTUHFk5GiHqGL8v7BiCRJo0dLxRMB3adXEmliK+v+IO9p+zql8H4p7u2WFvexH6DkkCXgMwIDAQAB")
18 // g3ecc, _ = base64.StdEncoding.DecodeString("MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEG4ANKJrwlpAPXThRcA3Z4XbkwQvWhj5J/kicXpbBQclS4uyuQ5iSOGKcuCRt8ralqREJXuRsnLZo0sIT680+VQ==")
21 func testTls(ip
string, config
*ScanConfig
, record
*ScanRecord
) bool {
23 conn
, err
:= net
.DialTimeout("tcp", net
.JoinHostPort(ip
, "443"), config
.ScanMaxRTT
)
30 if len(config
.ServerName
) == 0 {
31 serverName
= randomHost()
33 serverName
= config
.ServerName
[rand
.Intn(len(config
.ServerName
))]
36 tlscfg
:= &tls
.Config
{
37 InsecureSkipVerify
: true,
38 MinVersion
: tls
.VersionTLS10
,
39 MaxVersion
: tls
.VersionTLS12
,
40 CipherSuites
: []uint16{
41 tls
.TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
,
42 tls
.TLS_RSA_WITH_AES_128_CBC_SHA256
,
43 tls
.TLS_RSA_WITH_3DES_EDE_CBC_SHA
,
45 ServerName
: serverName
,
48 tlsconn
:= tls
.Client(conn
, tlscfg
)
51 tlsconn
.SetDeadline(time
.Now().Add(config
.HandshakeTimeout
))
52 if err
= tlsconn
.Handshake(); err
!= nil {
56 pcs
:= tlsconn
.ConnectionState().PeerCertificates
57 if pcs
== nil ||
len(pcs
) < 2 {
60 if org
:= pcs
[0].Subject
.Organization
; len(org
) == 0 || org
[0] != "Google Inc" {
63 pkp
:= pcs
[1].RawSubjectPublicKeyInfo
64 if !bytes
.Equal(g2pkp
, pkp
) && !bytes
.Equal(g3pkp
, pkp
) { // && !bytes.Equal(g3ecc, pkp[:]) {
69 url
:= "https://" + config
.HTTPVerifyHosts
[rand
.Intn(len(config
.HTTPVerifyHosts
))]
70 req
, _
:= http
.NewRequest(http
.MethodGet
, url
, nil)
73 Transport
: &http
.Transport
{
74 DialTLS
: func(network
, addr
string) (net
.Conn
, error
) { return tlsconn
, nil },
76 CheckRedirect
: func(req
*http
.Request
, via
[]*http
.Request
) error
{
77 return http
.ErrUseLastResponse
79 Timeout
: config
.ScanMaxRTT
- time
.Since(start
),
82 if resp
== nil ||
(resp
.StatusCode
< 200 || resp
.StatusCode
>= 400) {
86 io
.Copy(ioutil
.Discard
, resp
.Body
)
91 if rtt
:= time
.Since(start
); rtt
> config
.ScanMinRTT
{