diff --git a/v2/cmd/integration-test/dns.go b/v2/cmd/integration-test/dns.go index 1a5d2423..0353884e 100644 --- a/v2/cmd/integration-test/dns.go +++ b/v2/cmd/integration-test/dns.go @@ -16,15 +16,10 @@ type dnsBasic struct{} // Execute executes a test case and returns an error if occurred func (h *dnsBasic) Execute(filePath string) error { - var routerErr error - results, err := testutils.RunNucleiTemplateAndGetResults(filePath, "one.one.one.one", debug) if err != nil { return err } - if routerErr != nil { - return routerErr - } return expectResultsCount(results, 1) } @@ -32,15 +27,10 @@ type dnsPtr struct{} // Execute executes a test case and returns an error if occurred func (h *dnsPtr) Execute(filePath string) error { - var routerErr error - results, err := testutils.RunNucleiTemplateAndGetResults(filePath, "1.1.1.1", debug) if err != nil { return err } - if routerErr != nil { - return routerErr - } return expectResultsCount(results, 1) } @@ -48,15 +38,10 @@ type dnsCAA struct{} // Execute executes a test case and returns an error if occurred func (h *dnsCAA) Execute(filePath string) error { - var routerErr error - results, err := testutils.RunNucleiTemplateAndGetResults(filePath, "google.com", debug) if err != nil { return err } - if routerErr != nil { - return routerErr - } return expectResultsCount(results, 1) } @@ -64,15 +49,10 @@ type dnsTLSA struct{} // Execute executes a test case and returns an error if occurred func (h *dnsTLSA) Execute(filePath string) error { - var routerErr error - results, err := testutils.RunNucleiTemplateAndGetResults(filePath, "scanme.sh", debug) if err != nil { return err } - if routerErr != nil { - return routerErr - } return expectResultsCount(results, 0) } @@ -80,14 +60,9 @@ type dnsVariables struct{} // Execute executes a test case and returns an error if occurred func (h *dnsVariables) Execute(filePath string) error { - var routerErr error - results, err := testutils.RunNucleiTemplateAndGetResults(filePath, "one.one.one.one", debug) if err != nil { return err } - if routerErr != nil { - return routerErr - } return expectResultsCount(results, 1) } diff --git a/v2/cmd/integration-test/http.go b/v2/cmd/integration-test/http.go index fd6f529a..0bca46b3 100644 --- a/v2/cmd/integration-test/http.go +++ b/v2/cmd/integration-test/http.go @@ -461,8 +461,6 @@ type httpRawGetQuery struct{} // Execute executes a test case and returns an error if occurred func (h *httpRawGetQuery) Execute(filePath string) error { router := httprouter.New() - var routerErr error - router.GET("/", func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { if strings.EqualFold(r.URL.Query().Get("test"), "nuclei") { fmt.Fprintf(w, "Test is test raw-get-query-matcher text") @@ -475,9 +473,6 @@ func (h *httpRawGetQuery) Execute(filePath string) error { if err != nil { return err } - if routerErr != nil { - return routerErr - } return expectResultsCount(results, 1) } @@ -487,8 +482,6 @@ type httpRawGet struct{} // Execute executes a test case and returns an error if occurred func (h *httpRawGet) Execute(filePath string) error { router := httprouter.New() - var routerErr error - router.GET("/", func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { fmt.Fprintf(w, "Test is test raw-get-matcher text") }) @@ -499,9 +492,6 @@ func (h *httpRawGet) Execute(filePath string) error { if err != nil { return err } - if routerErr != nil { - return routerErr - } return expectResultsCount(results, 1) } @@ -639,6 +629,7 @@ func (h *httpRawCookieReuse) Execute(filePath string) error { return expectResultsCount(results, 1) } +// TODO: excluded due to parsing errors with console // type httpRawUnsafeRequest struct{ // Execute executes a test case and returns an error if occurred // func (h *httpRawUnsafeRequest) Execute(filePath string) error { @@ -666,13 +657,12 @@ type httpRequestCondition struct{} // Execute executes a test case and returns an error if occurred func (h *httpRequestCondition) Execute(filePath string) error { router := httprouter.New() - var routerErr error router.GET("/200", func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { - w.WriteHeader(200) + w.WriteHeader(http.StatusOK) }) router.GET("/400", func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { - w.WriteHeader(400) + w.WriteHeader(http.StatusBadRequest) }) ts := httptest.NewServer(router) defer ts.Close() @@ -681,9 +671,6 @@ func (h *httpRequestCondition) Execute(filePath string) error { if err != nil { return err } - if routerErr != nil { - return routerErr - } return expectResultsCount(results, 1) } @@ -693,8 +680,6 @@ type httpRequestSelContained struct{} // Execute executes a test case and returns an error if occurred func (h *httpRequestSelContained) Execute(filePath string) error { router := httprouter.New() - var routerErr error - router.GET("/", func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) { _, _ = w.Write([]byte("This is self-contained response")) }) @@ -711,9 +696,6 @@ func (h *httpRequestSelContained) Execute(filePath string) error { if err != nil { return err } - if routerErr != nil { - return routerErr - } return expectResultsCount(results, 1) } diff --git a/v2/cmd/integration-test/network.go b/v2/cmd/integration-test/network.go index 936c82c9..37ce8c39 100644 --- a/v2/cmd/integration-test/network.go +++ b/v2/cmd/integration-test/network.go @@ -99,8 +99,6 @@ type networkRequestSelContained struct{} // Execute executes a test case and returns an error if occurred func (h *networkRequestSelContained) Execute(filePath string) error { - var routerErr error - ts := testutils.NewTCPServer(nil, defaultStaticPort, func(conn net.Conn) { defer conn.Close() @@ -111,9 +109,6 @@ func (h *networkRequestSelContained) Execute(filePath string) error { if err != nil { return err } - if routerErr != nil { - return routerErr - } return expectResultsCount(results, 1) } diff --git a/v2/cmd/integration-test/template-dir.go b/v2/cmd/integration-test/template-dir.go index 2b897960..025fbb29 100644 --- a/v2/cmd/integration-test/template-dir.go +++ b/v2/cmd/integration-test/template-dir.go @@ -21,14 +21,10 @@ type templateDirWithTargetTest struct{} func (h *templateDirWithTargetTest) Execute(filePath string) error { defer os.RemoveAll(getTemplatesDir()) - var routerErr error - results, err := testutils.RunNucleiTemplateAndGetResults(filePath, "8x8exch02.8x8.com", debug, "-ud", getTemplatesDir()) if err != nil { return err } - if routerErr != nil { - return routerErr - } + return expectResultsCount(results, 1) }