Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
projectdiscovery
GitHub Repository: projectdiscovery/nuclei
Path: blob/dev/pkg/protocols/ssl/ssl_test.go
2070 views
1
package ssl
2
3
import (
4
"context"
5
"testing"
6
7
"github.com/stretchr/testify/require"
8
9
"github.com/projectdiscovery/nuclei/v3/pkg/model"
10
"github.com/projectdiscovery/nuclei/v3/pkg/model/types/severity"
11
"github.com/projectdiscovery/nuclei/v3/pkg/output"
12
"github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/contextargs"
13
"github.com/projectdiscovery/nuclei/v3/pkg/testutils"
14
)
15
16
func TestSSLProtocol(t *testing.T) {
17
options := testutils.DefaultOptions
18
19
testutils.Init(options)
20
templateID := "testing-ssl"
21
request := &Request{
22
Address: "{{Hostname}}",
23
}
24
executerOpts := testutils.NewMockExecuterOptions(options, &testutils.TemplateInfo{
25
ID: templateID,
26
Info: model.Info{SeverityHolder: severity.Holder{Severity: severity.Low}, Name: "test"},
27
})
28
err := request.Compile(executerOpts)
29
require.Nil(t, err, "could not compile ssl request")
30
31
var gotEvent output.InternalEvent
32
ctxArgs := contextargs.NewWithInput(context.Background(), "scanme.sh:443")
33
err = request.ExecuteWithResults(ctxArgs, nil, nil, func(event *output.InternalWrappedEvent) {
34
gotEvent = event.InternalEvent
35
})
36
require.Nil(t, err, "could not run ssl request")
37
require.NotEmpty(t, gotEvent, "could not get event items")
38
}
39
40