Skip to content

Commit

Permalink
Merge pull request #1193 from dogancanbakir/missing_screenshots
Browse files Browse the repository at this point in the history
Don't write missing screenshots to index file
  • Loading branch information
Mzack9999 authored May 26, 2023
2 parents bd4a4b0 + fae5bab commit b9da565
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -683,7 +683,7 @@ func (r *Runner) RunEnumeration() {
indexData := fmt.Sprintf("%s %s (%d %s)\n", resp.StoredResponsePath, resp.URL, resp.StatusCode, http.StatusText(resp.StatusCode))
_, _ = indexFile.WriteString(indexData)
}
if indexScreenshotFile != nil {
if indexScreenshotFile != nil && resp.ScreenshotPath != "" {
indexData := fmt.Sprintf("%s %s (%d %s)\n", resp.ScreenshotPath, resp.URL, resp.StatusCode, http.StatusText(resp.StatusCode))
_, _ = indexScreenshotFile.WriteString(indexData)
}
Expand Down Expand Up @@ -1680,12 +1680,12 @@ retry:
headlessBody string
)
if scanopts.Screenshot {
screenshotPath = fileutilz.AbsPathOrDefault(filepath.Join(screenshotBaseDir, screenshotResponseFile))
var err error
screenshotBytes, headlessBody, err = r.browser.ScreenshotWithBody(fullURL, r.hp.Options.Timeout)
if err != nil {
gologger.Warning().Msgf("Could not take screenshot '%s': %s", fullURL, err)
} else {
screenshotPath = fileutilz.AbsPathOrDefault(filepath.Join(screenshotBaseDir, screenshotResponseFile))
_ = fileutil.CreateFolder(screenshotBaseDir)
err := os.WriteFile(screenshotPath, screenshotBytes, 0644)
if err != nil {
Expand Down

0 comments on commit b9da565

Please sign in to comment.