-
Notifications
You must be signed in to change notification settings - Fork 81
/
simple.go
39 lines (32 loc) · 945 Bytes
/
simple.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"fmt"
"github.com/projectdiscovery/tlsx/pkg/tlsx"
"github.com/projectdiscovery/tlsx/pkg/tlsx/clients"
)
func main() {
// setup tlsx client with options
// https://pkg.go.dev/github.com/projectdiscovery/tlsx/pkg/tlsx/clients#Options
opts := &clients.Options{
TLSVersion: true,
Retries: 3,
Expired: true,
}
// available scanmodes
allmodes := []string{"auto", "openssl", "ctls", "ztls"}
for _, scanMode := range allmodes {
opts.ScanMode = scanMode
// create tlsx service with options
service, err := tlsx.New(opts)
if err != nil {
panic(err)
}
// connect to any host either with hostname or ip
// service.Connect(hostname, ip , port string)
resp, err := service.Connect("scanme.sh", "", "443")
if err != nil {
panic(err)
}
fmt.Printf("[%v] scan-mode:%-7v tls-version:%v self-signed:%v cipher:%v\n", resp.Host, scanMode, resp.Version, resp.SelfSigned, resp.Cipher)
}
}