investigating tests

This commit is contained in:
Mzack9999 2023-03-17 15:39:12 +01:00
parent 4c0d988a67
commit c115768b8e
2 changed files with 62 additions and 61 deletions

View File

@ -26,51 +26,51 @@ import (
var httpTestcases = map[string]testutils.TestCase{
// "http/raw-unsafe-request.yaml": &httpRawUnsafeRequest{},
"http/get-headers.yaml": &httpGetHeaders{},
"http/get-query-string.yaml": &httpGetQueryString{},
"http/get-redirects.yaml": &httpGetRedirects{},
"http/get-host-redirects.yaml": &httpGetHostRedirects{},
"http/disable-redirects.yaml": &httpDisableRedirects{},
"http/get.yaml": &httpGet{},
"http/post-body.yaml": &httpPostBody{},
"http/post-json-body.yaml": &httpPostJSONBody{},
"http/post-multipart-body.yaml": &httpPostMultipartBody{},
"http/raw-cookie-reuse.yaml": &httpRawCookieReuse{},
"http/raw-dynamic-extractor.yaml": &httpRawDynamicExtractor{},
"http/raw-get-query.yaml": &httpRawGetQuery{},
"http/raw-get.yaml": &httpRawGet{},
"http/raw-path-trailing-slash.yaml": &httpRawPathTrailingSlash{},
"http/raw-payload.yaml": &httpRawPayload{},
"http/raw-post-body.yaml": &httpRawPostBody{},
"http/raw-unsafe-path.yaml": &httpRawUnsafePath{},
"http/http-paths.yaml": &httpPaths{},
"http/request-condition.yaml": &httpRequestCondition{},
"http/request-condition-new.yaml": &httpRequestCondition{},
"http/interactsh.yaml": &httpInteractshRequest{},
"http/interactsh-stop-at-first-match.yaml": &httpInteractshStopAtFirstMatchRequest{},
"http/self-contained.yaml": &httpRequestSelfContained{},
"http/self-contained-file-input.yaml": &httpRequestSelfContainedFileInput{},
"http/get-case-insensitive.yaml": &httpGetCaseInsensitive{},
"http/get.yaml,http/get-case-insensitive.yaml": &httpGetCaseInsensitiveCluster{},
"http/get-redirects-chain-headers.yaml": &httpGetRedirectsChainHeaders{},
"http/dsl-matcher-variable.yaml": &httpDSLVariable{},
"http/dsl-functions.yaml": &httpDSLFunctions{},
"http/race-simple.yaml": &httpRaceSimple{},
"http/race-multiple.yaml": &httpRaceMultiple{},
"http/stop-at-first-match.yaml": &httpStopAtFirstMatch{},
"http/stop-at-first-match-with-extractors.yaml": &httpStopAtFirstMatchWithExtractors{},
"http/variables.yaml": &httpVariables{},
"http/get-override-sni.yaml": &httpSniAnnotation{},
"http/get-sni.yaml": &customCLISNI{},
"http/redirect-match-url.yaml": &httpRedirectMatchURL{},
"http/get-sni-unsafe.yaml": &customCLISNIUnsafe{},
"http/annotation-timeout.yaml": &annotationTimeout{},
"http/custom-attack-type.yaml": &customAttackType{},
"http/get-all-ips.yaml": &scanAllIPS{},
"http/get-without-scheme.yaml": &httpGetWithoutScheme{},
"http/cl-body-without-header.yaml": &httpCLBodyWithoutHeader{},
"http/cl-body-with-header.yaml": &httpCLBodyWithHeader{},
"http/default-matcher-condition.yaml": &httpDefaultMatcherCondition{},
// "http/get-headers.yaml": &httpGetHeaders{},
// "http/get-query-string.yaml": &httpGetQueryString{},
// "http/get-redirects.yaml": &httpGetRedirects{},
// "http/get-host-redirects.yaml": &httpGetHostRedirects{},
// "http/disable-redirects.yaml": &httpDisableRedirects{},
// "http/get.yaml": &httpGet{},
// "http/post-body.yaml": &httpPostBody{},
// "http/post-json-body.yaml": &httpPostJSONBody{},
// "http/post-multipart-body.yaml": &httpPostMultipartBody{},
// "http/raw-cookie-reuse.yaml": &httpRawCookieReuse{},
// "http/raw-dynamic-extractor.yaml": &httpRawDynamicExtractor{},
// "http/raw-get-query.yaml": &httpRawGetQuery{},
// "http/raw-get.yaml": &httpRawGet{},
// "http/raw-path-trailing-slash.yaml": &httpRawPathTrailingSlash{},
// "http/raw-payload.yaml": &httpRawPayload{},
// "http/raw-post-body.yaml": &httpRawPostBody{},
// "http/raw-unsafe-path.yaml": &httpRawUnsafePath{},
// "http/http-paths.yaml": &httpPaths{},
// "http/request-condition.yaml": &httpRequestCondition{},
// "http/request-condition-new.yaml": &httpRequestCondition{},
// "http/interactsh.yaml": &httpInteractshRequest{},
// "http/interactsh-stop-at-first-match.yaml": &httpInteractshStopAtFirstMatchRequest{},
// "http/self-contained.yaml": &httpRequestSelfContained{},
// "http/self-contained-file-input.yaml": &httpRequestSelfContainedFileInput{},
// "http/get-case-insensitive.yaml": &httpGetCaseInsensitive{},
// "http/get.yaml,http/get-case-insensitive.yaml": &httpGetCaseInsensitiveCluster{},
// "http/get-redirects-chain-headers.yaml": &httpGetRedirectsChainHeaders{},
// "http/dsl-matcher-variable.yaml": &httpDSLVariable{},
// "http/dsl-functions.yaml": &httpDSLFunctions{},
// "http/race-simple.yaml": &httpRaceSimple{},
// "http/race-multiple.yaml": &httpRaceMultiple{},
// "http/stop-at-first-match.yaml": &httpStopAtFirstMatch{},
// "http/stop-at-first-match-with-extractors.yaml": &httpStopAtFirstMatchWithExtractors{},
// "http/variables.yaml": &httpVariables{},
// "http/get-override-sni.yaml": &httpSniAnnotation{},
// "http/get-sni.yaml": &customCLISNI{},
// "http/redirect-match-url.yaml": &httpRedirectMatchURL{},
// "http/get-sni-unsafe.yaml": &customCLISNIUnsafe{},
// "http/annotation-timeout.yaml": &annotationTimeout{},
// "http/custom-attack-type.yaml": &customAttackType{},
// "http/get-all-ips.yaml": &scanAllIPS{},
// "http/get-without-scheme.yaml": &httpGetWithoutScheme{},
// "http/cl-body-without-header.yaml": &httpCLBodyWithoutHeader{},
// "http/cl-body-with-header.yaml": &httpCLBodyWithHeader{},
"http/default-matcher-condition.yaml": &httpDefaultMatcherCondition{},
}
type httpInteractshRequest struct{}

View File

@ -20,22 +20,22 @@ var (
failed = aurora.Red("[✘]").String()
protocolTests = map[string]map[string]testutils.TestCase{
"http": httpTestcases,
"network": networkTestcases,
"dns": dnsTestCases,
"workflow": workflowTestcases,
"loader": loaderTestcases,
"websocket": websocketTestCases,
"headless": headlessTestcases,
"whois": whoisTestCases,
"ssl": sslTestcases,
"code": codeTestcases,
"templatesPath": templatesPathTestCases,
"templatesDir": templatesDirTestCases,
"file": fileTestcases,
"offlineHttp": offlineHttpTestcases,
"customConfigDir": customConfigDirTestCases,
"fuzzing": fuzzingTestCases,
"http": httpTestcases,
// "network": networkTestcases,
// "dns": dnsTestCases,
// "workflow": workflowTestcases,
// "loader": loaderTestcases,
// "websocket": websocketTestCases,
// "headless": headlessTestcases,
// "whois": whoisTestCases,
// "ssl": sslTestcases,
// "code": codeTestcases,
// "templatesPath": templatesPathTestCases,
// "templatesDir": templatesDirTestCases,
// "file": fileTestcases,
// "offlineHttp": offlineHttpTestcases,
// "customConfigDir": customConfigDirTestCases,
// "fuzzing": fuzzingTestCases,
}
// For debug purposes
@ -118,6 +118,7 @@ func execute(testCase testutils.TestCase, templatePath string) (string, error) {
}
func expectResultsCount(results []string, expectedNumber int) error {
fmt.Println(results, len(results))
if len(results) != expectedNumber {
return fmt.Errorf("incorrect number of results: %d (actual) vs %d (expected) \nResults:\n\t%s\n", len(results), expectedNumber, strings.Join(results, "\n\t"))
}