Skip to content

Commit

Permalink
Restoring #1331 (#1360)
Browse files Browse the repository at this point in the history
* Restoring #1331

* updating readme
  • Loading branch information
Mzack9999 authored Sep 14, 2023
1 parent 877fca9 commit 88fa321
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,10 @@ PROBES:
-probe display probe status

HEADLESS:
-ss, -screenshot enable saving screenshot of the page using headless browser
-system-chrome enable using local installed chrome for screenshot
-ss, -screenshot enable saving screenshot of the page using headless browser
-system-chrome enable using local installed chrome for screenshot
-esb, -exclude-screenshot-bytes enable excluding screenshot bytes from json output
-ehb, -exclude-headless-body enable excluding headless header from json output

MATCHERS:
-mc, -match-code string match response with specified status code (-mc 200,302)
Expand All @@ -133,7 +135,7 @@ MATCHERS:

EXTRACTOR:
-er, -extract-regex string[] display response content with matched regex
-ep, -extract-preset string[] display response content matched by a pre-defined regex (mail,url,ipv4)
-ep, -extract-preset string[] display response content matched by a pre-defined regex (ipv4,mail,url)

FILTERS:
-fc, -filter-code string filter response with specified status code (-fc 403,401)
Expand Down
10 changes: 9 additions & 1 deletion runner/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ type ScanOptions struct {
Hashes string
Screenshot bool
UseInstalledChrome bool
DisableStdini bool
DisableStdin bool
NoScreenshotBytes bool
NoHeadlessBody bool
}

func (s *ScanOptions) Clone() *ScanOptions {
Expand Down Expand Up @@ -136,6 +138,8 @@ func (s *ScanOptions) Clone() *ScanOptions {
Hashes: s.Hashes,
Screenshot: s.Screenshot,
UseInstalledChrome: s.UseInstalledChrome,
NoScreenshotBytes: s.NoScreenshotBytes,
NoHeadlessBody: s.NoHeadlessBody,
}
}

Expand Down Expand Up @@ -279,6 +283,8 @@ type Options struct {
UseInstalledChrome bool
TlsImpersonate bool
DisableStdin bool
NoScreenshotBytes bool
NoHeadlessBody bool
}

// ParseOptions parses the command line options for application
Expand Down Expand Up @@ -322,6 +328,8 @@ func ParseOptions() *Options {
flagSet.CreateGroup("headless", "Headless",
flagSet.BoolVarP(&options.Screenshot, "screenshot", "ss", false, "enable saving screenshot of the page using headless browser"),
flagSet.BoolVar(&options.UseInstalledChrome, "system-chrome", false, "enable using local installed chrome for screenshot"),
flagSet.BoolVarP(&options.NoScreenshotBytes, "exclude-screenshot-bytes", "esb", false, "enable excluding screenshot bytes from json output"),
flagSet.BoolVarP(&options.NoHeadlessBody, "exclude-headless-body", "ehb", false, "enable excluding headless header from json output"),
)

flagSet.CreateGroup("matchers", "Matchers",
Expand Down
8 changes: 8 additions & 0 deletions runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ func New(options *Options) (*Runner, error) {
runner.browser = browser
}
scanopts.Screenshot = options.Screenshot
scanopts.NoScreenshotBytes = options.NoScreenshotBytes
scanopts.NoHeadlessBody = options.NoHeadlessBody
scanopts.UseInstalledChrome = options.UseInstalledChrome

if options.OutputExtractRegexs != nil {
Expand Down Expand Up @@ -1889,6 +1891,12 @@ retry:
gologger.Error().Msgf("Could not write screenshot at path '%s', to disk: %s", screenshotPath, err)
}
}
if scanopts.NoScreenshotBytes {
screenshotBytes = []byte{}
}
if scanopts.NoHeadlessBody {
headlessBody = ""
}
}

result := Result{
Expand Down

0 comments on commit 88fa321

Please sign in to comment.