mirror of https://github.com/daffainfo/nuclei.git
limited support for same template extraction+reuse
parent
66713434f8
commit
c346087926
|
@ -124,6 +124,7 @@ mainLoop:
|
|||
return
|
||||
}
|
||||
e.setCustomHeaders(compiledRequest)
|
||||
e.setDynamicValues(compiledRequest, result.Extractions)
|
||||
req := compiledRequest.Request
|
||||
|
||||
if e.debug {
|
||||
|
@ -307,6 +308,23 @@ func (e *HTTPExecuter) setCustomHeaders(r *requests.CompiledHTTP) {
|
|||
}
|
||||
}
|
||||
|
||||
// for now supports only headers
|
||||
func (e *HTTPExecuter) setDynamicValues(r *requests.CompiledHTTP, dynamicValues map[string]interface{}) {
|
||||
for dk, dv := range dynamicValues {
|
||||
// replace within header values
|
||||
for k, v := range r.Request.Header {
|
||||
for i, vv := range v {
|
||||
if strings.Contains(vv, "{{"+dk+"}}") {
|
||||
// coerce values to string and picks only the first value
|
||||
if dvv, ok := dv.([]string); ok && len(dvv) > 0 {
|
||||
r.Request.Header[k][i] = strings.ReplaceAll(r.Request.Header[k][i], "{{"+dk+"}}", dvv[0])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
type Result struct {
|
||||
Meta map[string]interface{}
|
||||
Matches map[string]interface{}
|
||||
|
|
Loading…
Reference in New Issue