Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restoring https://github.com/projectdiscovery/httpx/pull/1331 #1360

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading