Skip to content
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
14 changes: 14 additions & 0 deletions api/livescan.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ type LiveScanOptions struct {
ExtraHeaders map[string]string `json:"extraHeaders,omitempty"`
EnableFeatures []string `json:"enableFeatures,omitempty"`
DisableFeatures []string `json:"disableFeatures,omitempty"`
EvalScript string `json:"evalScript,omitempty"`
UserAgent string `json:"userAgent,omitempty"`
} `json:"scanner"`
}

Expand Down Expand Up @@ -73,6 +75,18 @@ func WithLiveScanScannerDisableFeatures(features []string) LiveScanOption {
}
}

func WithLiveScanScannerEvalScript(script string) LiveScanOption {
return func(opts *LiveScanOptions) {
opts.Scanner.EvalScript = script
}
}

func WithLiveScanScannerUserAgent(userAgent string) LiveScanOption {
return func(opts *LiveScanOptions) {
opts.Scanner.UserAgent = userAgent
}
}

func newLiveScanOptions(opts ...LiveScanOption) *LiveScanOptions {
var o LiveScanOptions
for _, fn := range opts {
Expand Down
6 changes: 6 additions & 0 deletions cmd/pro/livescan/scan.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ var scanCmd = &cobra.Command{
extraHeaders, _ := cmd.Flags().GetStringToString("extra-headers")
enableFeatures, _ := cmd.Flags().GetStringSlice("enable-features")
disableFeatures, _ := cmd.Flags().GetStringSlice("disable-features")
evalScript, _ := cmd.Flags().GetString("eval-script")
userAgent, _ := cmd.Flags().GetString("user-agent")

blocking, _ := cmd.Flags().GetBool("blocking")

Expand All @@ -55,6 +57,8 @@ var scanCmd = &cobra.Command{
api.WithLiveScanScannerExtraHeaders(extraHeaders),
api.WithLiveScanScannerEnableFeatures(enableFeatures),
api.WithLiveScanScannerDisableFeatures(disableFeatures),
api.WithLiveScanScannerEvalScript(evalScript),
api.WithLiveScanScannerUserAgent(userAgent),
}

client, err := utils.NewAPIClient()
Expand Down Expand Up @@ -87,6 +91,8 @@ func init() {
scanCmd.Flags().StringToStringP("extra-headers", "H", map[string]string{}, "Extra headers to send with the request (e.g., User-Agent: urlscan-cli)")
scanCmd.Flags().StringSliceP("enable-features", "e", []string{}, "Features to enable (bannerBypass, downloadWait, fullscreen)")
scanCmd.Flags().StringSliceP("disable-features", "d", []string{}, "Features to disable (annotation, dom, downloads, hideheadless, pageInformation, responses, screenshot)")
scanCmd.Flags().StringP("eval-script", "J", "", "Javascript snippet to execute as the first item in the main page context")
scanCmd.Flags().StringP("user-agent", "A", "", "Custom User-Agent to use for the scan")
scanCmd.Flags().BoolP("blocking", "b", true, "Whether to do a blocking scan or not")

addVisibilityFlag(scanCmd)
Expand Down
2 changes: 2 additions & 0 deletions docs/urlscan_pro_livescan_scan.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ urlscan pro livescan scan [flags]
-c, --capture-delay int Delay after page has finished loading before capturing page content (in ms) (default 10000)
-d, --disable-features strings Features to disable (annotation, dom, downloads, hideheadless, pageInformation, responses, screenshot)
-e, --enable-features strings Features to enable (bannerBypass, downloadWait, fullscreen)
-J, --eval-script string Javascript snippet to execute as the first item in the main page context
-H, --extra-headers stringToString Extra headers to send with the request (e.g., User-Agent: urlscan-cli) (default [])
-h, --help help for scan
-p, --page-timeout int Time to wait for the whole scan process (in ms) (default 10000)
--refang Refang an input (convert '[.]' back to '.' and so on)
-s, --scanner-id string ID of the scanner (required)
-A, --user-agent string Custom User-Agent to use for the scan
-v, --visibility string Visibility of the scan (public, unlisted or private) (default "private")
```

Expand Down