mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2026-02-10 12:33:12 +08:00
Code protocol bug fixes and improvements (#5767)
* bump gozero + improve debug mode (code protocol) * run failed integration again assuming they are flaky * dep update --------- Co-authored-by: sandeep <8293321+ehsandeep@users.noreply.github.com>
This commit is contained in:
@@ -86,6 +86,12 @@ func (request *Request) Compile(options *protocols.ExecutorOptions) error {
|
||||
Args: request.Args,
|
||||
EarlyCloseFileDescriptor: true,
|
||||
}
|
||||
|
||||
if options.Options.Debug || options.Options.DebugResponse {
|
||||
// enable debug mode for gozero
|
||||
gozeroOptions.DebugMode = true
|
||||
}
|
||||
|
||||
engine, err := gozero.New(gozeroOptions)
|
||||
if err != nil {
|
||||
return errorutil.NewWithErr(err).Msgf("[%s] engines '%s' not available on host", options.TemplateID, strings.Join(request.Engine, ","))
|
||||
@@ -239,7 +245,22 @@ func (request *Request) ExecuteWithResults(input *contextargs.Context, dynamicVa
|
||||
}
|
||||
|
||||
if request.options.Options.Debug || request.options.Options.DebugRequests {
|
||||
gologger.Debug().Msgf("[%s] Dumped Executed Source Code for %v\n\n%v\n", request.options.TemplateID, input.MetaInput.Input, interpretEnvVars(request.Source, allvars))
|
||||
gologger.Debug().MsgFunc(func() string {
|
||||
dashes := strings.Repeat("-", 15)
|
||||
sb := &strings.Builder{}
|
||||
sb.WriteString(fmt.Sprintf("[%s] Dumped Executed Source Code for input/stdin: '%v'", request.options.TemplateID, input.MetaInput.Input))
|
||||
sb.WriteString(fmt.Sprintf("\n%v\n%v\n%v\n", dashes, "Source Code:", dashes))
|
||||
sb.WriteString(interpretEnvVars(request.Source, allvars))
|
||||
sb.WriteString("\n")
|
||||
sb.WriteString(fmt.Sprintf("\n%v\n%v\n%v\n", dashes, "Command Executed:", dashes))
|
||||
sb.WriteString(interpretEnvVars(gOutput.Command, allvars))
|
||||
sb.WriteString("\n")
|
||||
sb.WriteString(fmt.Sprintf("\n%v\n%v\n%v\n", dashes, "Command Output:", dashes))
|
||||
sb.WriteString(gOutput.DebugData.String())
|
||||
sb.WriteString("\n")
|
||||
sb.WriteString("[WRN] Command Output here is stdout+sterr, in response variables they are seperate (use -v -svd flags for more details)")
|
||||
return sb.String()
|
||||
})
|
||||
}
|
||||
|
||||
dataOutputString := fmtStdout(gOutput.Stdout.String())
|
||||
|
||||
Reference in New Issue
Block a user