mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-18 05:15:24 +00:00
Added interactsh based template to integration test
This commit is contained in:
parent
19e0f39f2b
commit
deaa86f5cc
19
integration_tests/http/interactsh.yaml
Normal file
19
integration_tests/http/interactsh.yaml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
id: interactsh-integration-test
|
||||||
|
|
||||||
|
info:
|
||||||
|
name: Interactsh Integration Test
|
||||||
|
author: pdteam
|
||||||
|
severity: info
|
||||||
|
|
||||||
|
requests:
|
||||||
|
- method: GET
|
||||||
|
path:
|
||||||
|
- "{{BaseURL}}"
|
||||||
|
headers:
|
||||||
|
url: 'http://{{interactsh-url}}'
|
||||||
|
|
||||||
|
matchers:
|
||||||
|
- type: word
|
||||||
|
part: interactsh_protocol # Confirms the HTTP Interaction
|
||||||
|
words:
|
||||||
|
- "http"
|
||||||
@ -32,6 +32,7 @@ var httpTestcases = map[string]testutils.TestCase{
|
|||||||
"http/raw-unsafe-request.yaml": &httpRawUnsafeRequest{},
|
"http/raw-unsafe-request.yaml": &httpRawUnsafeRequest{},
|
||||||
"http/request-condition.yaml": &httpRequestCondition{},
|
"http/request-condition.yaml": &httpRequestCondition{},
|
||||||
"http/request-condition-new.yaml": &httpRequestCondition{},
|
"http/request-condition-new.yaml": &httpRequestCondition{},
|
||||||
|
"http/interactsh.yaml": &httpInteractshRequest{},
|
||||||
}
|
}
|
||||||
|
|
||||||
func httpDebugRequestDump(r *http.Request) {
|
func httpDebugRequestDump(r *http.Request) {
|
||||||
@ -42,6 +43,34 @@ func httpDebugRequestDump(r *http.Request) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type httpInteractshRequest struct{}
|
||||||
|
|
||||||
|
// Executes executes a test case and returns an error if occurred
|
||||||
|
func (h *httpInteractshRequest) Execute(filePath string) error {
|
||||||
|
router := httprouter.New()
|
||||||
|
router.GET("/", httprouter.Handle(func(w http.ResponseWriter, r *http.Request, _ httprouter.Params) {
|
||||||
|
httpDebugRequestDump(r)
|
||||||
|
|
||||||
|
value := r.Header.Get("url")
|
||||||
|
if value != "" {
|
||||||
|
if resp, _ := http.DefaultClient.Get(value); resp != nil {
|
||||||
|
resp.Body.Close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}))
|
||||||
|
ts := httptest.NewServer(router)
|
||||||
|
defer ts.Close()
|
||||||
|
|
||||||
|
results, err := testutils.RunNucleiAndGetResults(filePath, ts.URL, debug)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if len(results) != 1 {
|
||||||
|
return errIncorrectResultsCount(results)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type httpGetHeaders struct{}
|
type httpGetHeaders struct{}
|
||||||
|
|
||||||
// Executes executes a test case and returns an error if occurred
|
// Executes executes a test case and returns an error if occurred
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user