From a4668b2935243a28fe0a4f0a0475e6908031e961 Mon Sep 17 00:00:00 2001 From: Manabu Niseki Date: Tue, 15 Sep 2026 14:24:09 +0900 Subject: [PATCH 1/2] refactor: add eval script & user agent (livescan) --- api/livescan.go | 14 ++++++++++++++ cmd/pro/livescan/scan.go | 6 ++++++ 2 files changed, 20 insertions(+) diff --git a/api/livescan.go b/api/livescan.go index 89f025b..ce273ce 100644 --- a/api/livescan.go +++ b/api/livescan.go @@ -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"` } @@ -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 { diff --git a/cmd/pro/livescan/scan.go b/cmd/pro/livescan/scan.go index 7051cb1..dc60242 100644 --- a/cmd/pro/livescan/scan.go +++ b/cmd/pro/livescan/scan.go @@ -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") @@ -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() @@ -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) From 8bee0c47485afb2cccfa9de768ef1aa91fc23b70 Mon Sep 17 00:00:00 2001 From: Manabu Niseki Date: Tue, 15 Sep 2026 14:24:17 +0900 Subject: [PATCH 2/2] docs: sync docs --- docs/urlscan_pro_livescan_scan.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/urlscan_pro_livescan_scan.md b/docs/urlscan_pro_livescan_scan.md index ca4562c..7d389f9 100644 --- a/docs/urlscan_pro_livescan_scan.md +++ b/docs/urlscan_pro_livescan_scan.md @@ -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") ```