Documentation
¶
Overview ¶
internal/browser/manager.go
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles the browser process lifecycle and session creation. It is responsible for creating, managing, and shutting down browser sessions.
func NewManager ¶
func NewManager(allocCtx context.Context, cfg config.Interface, logger *zap.Logger) (*Manager, error)
NewManager creates and returns a new browser manager. It takes a browser allocator context, configuration, and a logger. It returns an error if the allocator context is invalid.
func (*Manager) NavigateAndExtract ¶
NavigateAndExtract is a high-level convenience method that creates a temporary, synchronous session to perform a simple task: navigate to a URL and extract all hyperlink `href` attributes from the page. It handles session creation, navigation, script execution, and teardown internally.
Parameters:
- ctx: The context for the entire operation, including navigation and script execution.
- url: The URL of the page to navigate to.
Returns a slice of strings containing the hrefs of all links found, or an error.
func (*Manager) NewAnalysisContext ¶
func (m *Manager) NewAnalysisContext( sessionCtx context.Context, cfg interface{}, persona schemas.Persona, taintTemplate string, taintConfig string, findingsChan chan<- schemas.Finding, ) (schemas.SessionContext, error)
NewAnalysisContext creates a new browser tab (session) for a detailed security analysis. It configures the session with a specific persona, taint tracking rules, and a channel for reporting findings. This method is central to launching targeted analysis tasks.
Parameters:
- sessionCtx: The context governing the lifetime of the session.
- cfg: The application configuration, expected to be a config.Interface.
- persona: The user persona to simulate during the analysis.
- taintTemplate: The template for taint tracking analysis.
- taintConfig: The configuration for taint tracking.
- findingsChan: The channel to which discovered findings will be sent.
Returns a schemas.SessionContext for interacting with the browser session, or an error if setup fails.
func (*Manager) Shutdown ¶
Shutdown gracefully closes all active browser sessions managed by the manager. It performs a concurrent shutdown of sessions to improve speed. Note: This method does *not* close the underlying browser process itself, as the allocator context that controls the browser lifecycle is managed externally.
Parameters:
- ctx: A context to control the shutdown process, allowing for timeouts.
Returns nil on successful shutdown. Errors during individual session closes are logged but do not halt the process.
Directories
¶
| Path | Synopsis |
|---|---|
|
FILE: ./internal/browser/humanoid/behavior.go
|
FILE: ./internal/browser/humanoid/behavior.go |
|
internal/browser/session/cdp_executor.go This file implements the humanoid.Executor interface using the Chrome DevTools Protocol (CDP).
|
internal/browser/session/cdp_executor.go This file implements the humanoid.Executor interface using the Chrome DevTools Protocol (CDP). |
|
internal/browser/stealth/stealth.go package stealth provides functionality to apply various browser fingerprinting evasions.
|
internal/browser/stealth/stealth.go package stealth provides functionality to apply various browser fingerprinting evasions. |