mirror of https://github.com/daffainfo/nuclei.git
Rawhttp fixes, render non-printable chars with unsafe
parent
e70ca44741
commit
d541b09928
|
@ -114,12 +114,12 @@ func (r *requestGenerator) makeHTTPRequestFromModel(ctx context.Context, data st
|
|||
|
||||
// makeHTTPRequestFromRaw creates a *http.Request from a raw request
|
||||
func (r *requestGenerator) makeHTTPRequestFromRaw(ctx context.Context, baseURL, data string, values, payloads map[string]interface{}) (*generatedRequest, error) {
|
||||
// add "\r\n" only to RCF compliant requests without body
|
||||
// Add "\r\n" only to RCF compliant requests without body
|
||||
if !r.request.Unsafe && !rawHasBody(data) {
|
||||
data += "\r\n"
|
||||
} else {
|
||||
data = strings.TrimSuffix(data, "\r\n")
|
||||
}
|
||||
} else {
|
||||
data = strings.TrimSuffix(data, "\r\n")
|
||||
}
|
||||
return r.handleRawWithPaylods(ctx, data, baseURL, values, payloads)
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,9 @@ func Parse(request, baseURL string, unsafe bool) (*Request, error) {
|
|||
Headers: make(map[string]string),
|
||||
}
|
||||
if unsafe {
|
||||
request = strings.ReplaceAll(request, "\\0", "\x00")
|
||||
request = strings.ReplaceAll(request, "\\r", "\r")
|
||||
request = strings.ReplaceAll(request, "\\n", "\n")
|
||||
rawRequest.UnsafeRawBytes = []byte(request)
|
||||
return rawRequest, nil
|
||||
}
|
||||
|
|
|
@ -139,6 +139,5 @@ func rawHasBody(data string) bool {
|
|||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return len(body) > 0
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue