Documentation ¶
Index ¶
- func ConvertToNetworkHeaders(headersMap map[string][]string) proto.NetworkHeaders
- func CreateHistoryFromHijack(request *rod.HijackRequest, response *rod.HijackResponse, source string, ...) *db.History
- func DumpHijackRequest(req *rod.HijackRequest) (raw string, body string)
- func DumpHijackResponse(res *rod.HijackResponse) (rawResponse string, body string)
- func GetBrowserLauncher() *launcher.Launcher
- func Hijack(config HijackConfig, browser *rod.Browser, source string, ...)
- func HijackWithContext(config HijackConfig, browser *rod.Browser, source string, ...) *rod.HijackRouter
- func ListenForPostMessages(page *rod.Page) error
- func NewBrowser() *rod.Browser
- func NewBrowserWithTimeout(timeoutDuration time.Duration) (*rod.Browser, error)
- func ReplayRequestInBrowser(page *rod.Page, req *http.Request) error
- func ReplayRequestInBrowserAndCreateHistory(page *rod.Page, req *http.Request, workspaceID, taskID uint, note string) (history *db.History, err error)
- type BrowserGeolocation
- type BrowserPoolManager
- type BrowserPoolManagerConfig
- type EmulationConfig
- type HijackConfig
- type HijackResult
- type PagePoolManager
- type PagePoolManagerConfig
- type PostMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertToNetworkHeaders ¶
func ConvertToNetworkHeaders(headersMap map[string][]string) proto.NetworkHeaders
ConvertToNetworkHeaders converts map[string][]string to NetworkHeaders
func CreateHistoryFromHijack ¶
func CreateHistoryFromHijack(request *rod.HijackRequest, response *rod.HijackResponse, source string, note string, workspaceID, taskID uint) *db.History
CreateHistoryFromHijack saves a history request from hijack request/response items.
func DumpHijackRequest ¶
func DumpHijackRequest(req *rod.HijackRequest) (raw string, body string)
func DumpHijackResponse ¶
func DumpHijackResponse(res *rod.HijackResponse) (rawResponse string, body string)
func GetBrowserLauncher ¶
func Hijack ¶
func Hijack(config HijackConfig, browser *rod.Browser, source string, resultsChannel chan HijackResult, workspaceID, taskID uint)
func HijackWithContext ¶
func HijackWithContext(config HijackConfig, browser *rod.Browser, source string, resultsChannel chan HijackResult, ctx context.Context, workspaceID, taskID uint) *rod.HijackRouter
func ListenForPostMessages ¶
ListenForPostMessages executes JavaScript in the page to listen for post messages
func NewBrowser ¶
func NewBrowserWithTimeout ¶
NewBrowserWithTimeout attempts to create a new browser instance with a specified timeout.
func ReplayRequestInBrowser ¶
ReplayRequestInBrowser takes a rod.Page and an http.Request, it loads the URL of the input request in the browser, but hijacks it and updates the headers, method, etc. to match the input request.
Types ¶
type BrowserGeolocation ¶
type BrowserGeolocation struct { // Latitude (optional) Mock latitude Latitude float64 `json:"latitude,omitempty"` // Longitude (optional) Mock longitude Longitude float64 `json:"longitude,omitempty"` // Accuracy (optional) Mock accuracy Accuracy float64 `json:"accuracy,omitempty"` }
BrowserGeolocation https://pkg.go.dev/github.com/go-rod/rod@v0.81.3/lib/proto#EmulationSetGeolocationOverride
type BrowserPoolManager ¶
type BrowserPoolManager struct { HijackResultsChannel chan HijackResult // contains filtered or unexported fields }
func GetScannerBrowserPoolManager ¶
func GetScannerBrowserPoolManager() *BrowserPoolManager
GetBrowserPoolManager returns a singleton instance of BrowserPoolManager used by active scanners
func NewBrowserPoolManager ¶
func NewBrowserPoolManager(config BrowserPoolManagerConfig, workspaceID, taskID uint) *BrowserPoolManager
func NewHijackedBrowserPoolManager ¶
func NewHijackedBrowserPoolManager(config BrowserPoolManagerConfig, hijackResultsChannel chan HijackResult, workspaceID uint) *BrowserPoolManager
func (*BrowserPoolManager) Cleanup ¶
func (b *BrowserPoolManager) Cleanup()
func (*BrowserPoolManager) NewBrowser ¶
func (b *BrowserPoolManager) NewBrowser() *rod.Browser
func (*BrowserPoolManager) ReleaseBrowser ¶
func (b *BrowserPoolManager) ReleaseBrowser(browser *rod.Browser)
func (*BrowserPoolManager) Start ¶
func (b *BrowserPoolManager) Start()
type EmulationConfig ¶
type EmulationConfig struct { UserAgent string OverrideGeolocation BrowserGeolocation Viewport proto.EmulationSetDeviceMetricsOverride }
type HijackConfig ¶
HijackConfig represents a hijack configuration to apply when using the browser
type HijackResult ¶
type PagePoolManager ¶
type PagePoolManager struct { HijackResultsChannel chan HijackResult // contains filtered or unexported fields }
func NewHijackedPagePoolManager ¶
func NewHijackedPagePoolManager(config PagePoolManagerConfig, source string, hijackResultsChannel chan HijackResult, workspaceID, taskID uint) *PagePoolManager
func NewPagePoolManager ¶
func NewPagePoolManager(config PagePoolManagerConfig, source string) *PagePoolManager
func (*PagePoolManager) Close ¶
func (b *PagePoolManager) Close()
func (*PagePoolManager) NewPage ¶
func (b *PagePoolManager) NewPage() *rod.Page
func (*PagePoolManager) ReleasePage ¶
func (b *PagePoolManager) ReleasePage(page *rod.Page)
func (*PagePoolManager) Start ¶
func (b *PagePoolManager) Start(hijack bool, source string)
type PagePoolManagerConfig ¶
type PostMessage ¶
type PostMessage struct { Data interface{} `json:"data"` Origin string `json:"origin"` Timestamp int64 `json:"timestamp"` }
PostMessage represents the structure of a post message
func GetPostMessages ¶
func GetPostMessages(page *rod.Page) ([]PostMessage, error)
GetPostMessages returns all post messages that have been sent to the page. NOTE: This function will only return messages that have been sent after ListenForPostMessages has been called.