2021-09-22 22:41:07 +05:30
|
|
|
package ssl
|
|
|
|
|
|
|
|
|
|
import (
|
2024-04-25 15:37:56 +05:30
|
|
|
"context"
|
2021-09-22 22:41:07 +05:30
|
|
|
"testing"
|
|
|
|
|
|
2021-11-25 17:09:20 +02:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
|
|
2023-10-17 17:44:13 +05:30
|
|
|
"github.com/projectdiscovery/nuclei/v3/pkg/model"
|
|
|
|
|
"github.com/projectdiscovery/nuclei/v3/pkg/model/types/severity"
|
|
|
|
|
"github.com/projectdiscovery/nuclei/v3/pkg/output"
|
|
|
|
|
"github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/contextargs"
|
|
|
|
|
"github.com/projectdiscovery/nuclei/v3/pkg/testutils"
|
2021-09-22 22:41:07 +05:30
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestSSLProtocol(t *testing.T) {
|
|
|
|
|
options := testutils.DefaultOptions
|
|
|
|
|
|
|
|
|
|
testutils.Init(options)
|
|
|
|
|
templateID := "testing-ssl"
|
2021-11-05 16:59:24 +05:30
|
|
|
request := &Request{
|
|
|
|
|
Address: "{{Hostname}}",
|
|
|
|
|
}
|
2021-09-22 22:41:07 +05:30
|
|
|
executerOpts := testutils.NewMockExecuterOptions(options, &testutils.TemplateInfo{
|
|
|
|
|
ID: templateID,
|
|
|
|
|
Info: model.Info{SeverityHolder: severity.Holder{Severity: severity.Low}, Name: "test"},
|
|
|
|
|
})
|
|
|
|
|
err := request.Compile(executerOpts)
|
|
|
|
|
require.Nil(t, err, "could not compile ssl request")
|
|
|
|
|
|
2021-11-05 16:59:24 +05:30
|
|
|
var gotEvent output.InternalEvent
|
2024-04-25 15:37:56 +05:30
|
|
|
ctxArgs := contextargs.NewWithInput(context.Background(), "scanme.sh:443")
|
2022-10-03 12:12:20 +02:00
|
|
|
err = request.ExecuteWithResults(ctxArgs, nil, nil, func(event *output.InternalWrappedEvent) {
|
2021-11-05 16:59:24 +05:30
|
|
|
gotEvent = event.InternalEvent
|
|
|
|
|
})
|
2021-09-22 22:41:07 +05:30
|
|
|
require.Nil(t, err, "could not run ssl request")
|
2021-11-05 16:59:24 +05:30
|
|
|
require.NotEmpty(t, gotEvent, "could not get event items")
|
2021-09-22 22:41:07 +05:30
|
|
|
}
|