mirror of https://github.com/daffainfo/nuclei.git
Added header as DSL part value (#2052)
* Added header as DSL part value * Fixed failing DSL part test casesdev
parent
c76ff5fde1
commit
8723a1fd70
|
@ -123,6 +123,7 @@ func (request *Request) responseToDSLMap(resp *http.Response, host, matched, raw
|
|||
data["body"] = body
|
||||
data["content_length"] = resp.ContentLength
|
||||
data["all_headers"] = headers
|
||||
data["header"] = headers
|
||||
data["duration"] = duration.Seconds()
|
||||
data["template-id"] = request.options.TemplateID
|
||||
data["template-info"] = request.options.TemplateInfo
|
||||
|
|
|
@ -41,7 +41,7 @@ func TestResponseToDSLMap(t *testing.T) {
|
|||
matched := "http://example.com/test/?test=1"
|
||||
|
||||
event := request.responseToDSLMap(resp, host, matched, exampleRawRequest, exampleRawResponse, exampleResponseBody, exampleResponseHeader, 1*time.Second, map[string]interface{}{})
|
||||
require.Len(t, event, 14, "could not get correct number of items in dsl map")
|
||||
require.Len(t, event, 15, "could not get correct number of items in dsl map")
|
||||
require.Equal(t, exampleRawResponse, event["response"], "could not get correct resp")
|
||||
require.Equal(t, "Test-Response", event["test"], "could not get correct resp for header")
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ func TestHTTPOperatorMatch(t *testing.T) {
|
|||
matched := "http://example.com/test/?test=1"
|
||||
|
||||
event := request.responseToDSLMap(resp, host, matched, exampleRawRequest, exampleRawResponse, exampleResponseBody, exampleResponseHeader, 1*time.Second, map[string]interface{}{})
|
||||
require.Len(t, event, 14, "could not get correct number of items in dsl map")
|
||||
require.Len(t, event, 15, "could not get correct number of items in dsl map")
|
||||
require.Equal(t, exampleRawResponse, event["response"], "could not get correct resp")
|
||||
require.Equal(t, "Test-Response", event["test"], "could not get correct resp for header")
|
||||
|
||||
|
@ -159,7 +159,7 @@ func TestHTTPOperatorExtract(t *testing.T) {
|
|||
matched := "http://example.com/test/?test=1"
|
||||
|
||||
event := request.responseToDSLMap(resp, host, matched, exampleRawRequest, exampleRawResponse, exampleResponseBody, exampleResponseHeader, 1*time.Second, map[string]interface{}{})
|
||||
require.Len(t, event, 14, "could not get correct number of items in dsl map")
|
||||
require.Len(t, event, 15, "could not get correct number of items in dsl map")
|
||||
require.Equal(t, exampleRawResponse, event["response"], "could not get correct resp")
|
||||
require.Equal(t, "Test-Response", event["test_header"], "could not get correct resp for header")
|
||||
|
||||
|
@ -286,7 +286,7 @@ func TestHTTPMakeResult(t *testing.T) {
|
|||
matched := "http://example.com/test/?test=1"
|
||||
|
||||
event := request.responseToDSLMap(resp, host, matched, exampleRawRequest, exampleRawResponse, exampleResponseBody, exampleResponseHeader, 1*time.Second, map[string]interface{}{})
|
||||
require.Len(t, event, 14, "could not get correct number of items in dsl map")
|
||||
require.Len(t, event, 15, "could not get correct number of items in dsl map")
|
||||
require.Equal(t, exampleRawResponse, event["response"], "could not get correct resp")
|
||||
require.Equal(t, "Test-Response", event["test"], "could not get correct resp for header")
|
||||
|
||||
|
|
Loading…
Reference in New Issue