sensepost / gowitness

🔍 gowitness - a golang, web screenshot utility using Chrome Headless
GNU General Public License v3.0
2.82k stars 324 forks source link

[FEATURE REQUEST] Add ability to specify CDP websocket for a remote chrome instance #210

Open deoxykev opened 7 months ago

deoxykev commented 7 months ago

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

Describe alternatives you've considered

Additional context


I think something like this could work in chrome/chrome.go, but i'm not entirely familiar with the codebase. Can you doublecheck?

    var actx chromedp.Context
    var acancel context.CancelFunc
    var devtoolsWsURL *string

    // Check if REMOTE_DEVTOOLS_WS_URL environment variable is set
    if wsURL := os.Getenv("REMOTE_DEVTOOLS_WS_URL"); wsURL != "" {
        devtoolsWsURL = &wsURL
        actx, acancel = chromedp.NewRemoteAllocator(context.Background(), *devtoolsWsURL)
    } else {
        actx, acancel = chromedp.NewExecAllocator(context.Background(), chromedp.DefaultExecAllocatorOptions...)
    }

    // Use actx and acancel here
    defer acancel()