Documentation ¶
Index ¶
- Variables
- func FetchContinueRequest(page *rod.Page, e *proto.FetchRequestPaused) error
- func FetchGetResponseBody(page *rod.Page, e *proto.FetchRequestPaused) ([]byte, error)
- func GetSameSite(cookie *http.Cookie) string
- func MustDisableSandbox() bool
- type Action
- type ActionType
- type ActionTypeHolder
- func (holder ActionTypeHolder) JSONSchema() *jsonschema.Schema
- func (holder *ActionTypeHolder) MarshalJSON() ([]byte, error)
- func (holder ActionTypeHolder) MarshalYAML() (interface{}, error)
- func (holder ActionTypeHolder) String() string
- func (holder *ActionTypeHolder) UnmarshalJSON(data []byte) error
- func (holder *ActionTypeHolder) UnmarshalYAML(unmarshal func(interface{}) error) error
- type Browser
- type Hijack
- type HijackHandler
- type HistoryData
- type Instance
- type Options
- type Page
- func (p *Page) ActionAddHeader(act *Action, out map[string]string) error
- func (p *Page) ActionDeleteHeader(act *Action, out map[string]string) error
- func (p *Page) ActionSetBody(act *Action, out map[string]string) error
- func (p *Page) ActionSetHeader(act *Action, out map[string]string) error
- func (p *Page) ActionSetMethod(act *Action, out map[string]string) error
- func (p *Page) Browser() *rod.Browser
- func (p *Page) ClickElement(act *Action, out map[string]string) error
- func (p *Page) Close()
- func (p *Page) DebugAction(act *Action, out map[string]string) error
- func (p *Page) DumpHistory() string
- func (p *Page) ExecuteActions(input *contextargs.Context, actions []*Action, ...) (outData map[string]string, err error)
- func (p *Page) ExtractElement(act *Action, out map[string]string) error
- func (p *Page) FilesInput(act *Action, out map[string]string) error
- func (p *Page) GetResource(act *Action, out map[string]string) error
- func (p *Page) InputElement(act *Action, out map[string]string) error
- func (p *Page) KeyboardAction(act *Action, out map[string]string) error
- func (p *Page) NavigateURL(action *Action, out map[string]string, allvars map[string]interface{}) error
- func (p *Page) Page() *rod.Page
- func (p *Page) RightClickElement(act *Action, out map[string]string) error
- func (p *Page) RunScript(action *Action, out map[string]string) error
- func (p *Page) Screenshot(act *Action, out map[string]string) error
- func (p *Page) SelectInputElement(act *Action, out map[string]string) error
- func (p *Page) SleepAction(act *Action, out map[string]string) error
- func (p *Page) Sleeper(pollTimeout, timeout time.Duration) *Page
- func (p *Page) TimeInputElement(act *Action, out map[string]string) error
- func (p *Page) Timeout(timeout time.Duration) *Page
- func (p *Page) URL() string
- func (p *Page) WaitEvent(act *Action, out map[string]string) (func() error, error)
- func (p *Page) WaitLoad(act *Action, out map[string]string) error
- func (p *Page) WaitVisible(act *Action, out map[string]string) error
Constants ¶
This section is empty.
Variables ¶
var ActionStringToAction = map[string]ActionType{ "navigate": ActionNavigate, "script": ActionScript, "click": ActionClick, "rightclick": ActionRightClick, "text": ActionTextInput, "screenshot": ActionScreenshot, "time": ActionTimeInput, "select": ActionSelectInput, "files": ActionFilesInput, "waitload": ActionWaitLoad, "getresource": ActionGetResource, "extract": ActionExtract, "setmethod": ActionSetMethod, "addheader": ActionAddHeader, "setheader": ActionSetHeader, "deleteheader": ActionDeleteHeader, "setbody": ActionSetBody, "waitevent": ActionWaitEvent, "keyboard": ActionKeyboard, "debug": ActionDebug, "sleep": ActionSleep, "waitvisible": ActionWaitVisible, }
ActionStringToAction converts an action from string to internal representation
var ActionToActionString = map[ActionType]string{ ActionNavigate: "navigate", ActionScript: "script", ActionClick: "click", ActionRightClick: "rightclick", ActionTextInput: "text", ActionScreenshot: "screenshot", ActionTimeInput: "time", ActionSelectInput: "select", ActionFilesInput: "files", ActionWaitLoad: "waitload", ActionGetResource: "getresource", ActionExtract: "extract", ActionSetMethod: "setmethod", ActionAddHeader: "addheader", ActionSetHeader: "setheader", ActionDeleteHeader: "deleteheader", ActionSetBody: "setbody", ActionWaitEvent: "waitevent", ActionKeyboard: "keyboard", ActionDebug: "debug", ActionSleep: "sleep", ActionWaitVisible: "waitvisible", }
ActionToActionString converts an action from internal representation to string
var (
ErrLFAccessDenied = errorutil.New("Use -allow-local-file-access flag to enable local file access")
)
Functions ¶
func FetchContinueRequest ¶
func FetchContinueRequest(page *rod.Page, e *proto.FetchRequestPaused) error
FetchContinueRequest continue request
func FetchGetResponseBody ¶
FetchGetResponseBody get request body.
func GetSameSite ¶
func MustDisableSandbox ¶
func MustDisableSandbox() bool
MustDisableSandbox determines if the current os and user needs sandbox mode disabled
Types ¶
type Action ¶
type Action struct { // description: // Args contain arguments for the headless action. // // Per action arguments are described in detail [here](https://nuclei.projectdiscovery.io/templating-guide/protocols/headless/). Data map[string]string `` /* 151-byte string literal not displayed */ // description: | // Name is the name assigned to the headless action. // // This can be used to execute code, for instance in browser // DOM using script action, and get the result in a variable // which can be matched upon by nuclei. An Example template [here](https://github.com/projectdiscovery/nuclei-templates/blob/main/headless/prototype-pollution-check.yaml). Name string `` /* 148-byte string literal not displayed */ // description: | // Description is the optional description of the headless action Description string `` /* 155-byte string literal not displayed */ // description: | // Action is the type of the action to perform. ActionType ActionTypeHolder `` /* 386-byte string literal not displayed */ }
Action is an action taken by the browser to reach a navigation
Each step that the browser executes is an action. Most navigations usually start from the ActionLoadURL event, and further navigations are discovered on the found page. We also keep track and only scrape new navigation from pages we haven't crawled yet.
func (Action) JSONSchemaExtend ¶
func (a Action) JSONSchemaExtend(schema *jsonschema.Schema)
type ActionType ¶
type ActionType int8
ActionType defines the action type for a browser action
const ( // name:navigate ActionNavigate ActionType = iota + 1 // ActionScript executes a JS snippet on the page. // name:script ActionScript // ActionClick performs the left-click action on an Element. // name:click ActionClick // ActionRightClick performs the right-click action on an Element. // name:rightclick ActionRightClick // ActionTextInput performs an action for a text input // name:text ActionTextInput // ActionScreenshot performs the screenshot action writing to a file. // name:screenshot ActionScreenshot // ActionTimeInput performs an action on a time input. // name:time ActionTimeInput // ActionSelectInput performs an action on a select input. // name:select ActionSelectInput // ActionFilesInput performs an action on a file input. // name:files ActionFilesInput // ActionWaitLoad waits for the page to stop loading. // name:waitload ActionWaitLoad // ActionGetResource performs a get resource action on an element // name:getresource ActionGetResource // ActionExtract performs an extraction on an element // name:extract ActionExtract // ActionSetMethod sets the request method // name:setmethod ActionSetMethod // ActionAddHeader adds a header to the request // name:addheader ActionAddHeader // ActionSetHeader sets a header in the request // name:setheader ActionSetHeader // ActionDeleteHeader deletes a header from the request // name:deleteheader ActionDeleteHeader // ActionSetBody sets the value of the request body // name:setbody ActionSetBody // ActionWaitEvent waits for a specific event. // name:waitevent ActionWaitEvent // ActionKeyboard performs a keyboard action event on a page. // name:keyboard ActionKeyboard // ActionDebug debug slows down headless and adds a sleep to each page. // name:debug ActionDebug // ActionSleep executes a sleep for a specified duration // name:sleep ActionSleep // ActionWaitVisible waits until an element appears. // name:waitvisible ActionWaitVisible )
Types to be executed by the user. name:ActionType
func GetSupportedActionTypes ¶
func GetSupportedActionTypes() []ActionType
GetSupportedActionTypes returns list of supported types
func (ActionType) String ¶
func (t ActionType) String() string
type ActionTypeHolder ¶
type ActionTypeHolder struct {
ActionType ActionType `mapping:"true"`
}
ActionTypeHolder is used to hold internal type of the action
func (ActionTypeHolder) JSONSchema ¶
func (holder ActionTypeHolder) JSONSchema() *jsonschema.Schema
func (*ActionTypeHolder) MarshalJSON ¶
func (holder *ActionTypeHolder) MarshalJSON() ([]byte, error)
func (ActionTypeHolder) MarshalYAML ¶
func (holder ActionTypeHolder) MarshalYAML() (interface{}, error)
func (ActionTypeHolder) String ¶
func (holder ActionTypeHolder) String() string
func (*ActionTypeHolder) UnmarshalJSON ¶
func (holder *ActionTypeHolder) UnmarshalJSON(data []byte) error
func (*ActionTypeHolder) UnmarshalYAML ¶
func (holder *ActionTypeHolder) UnmarshalYAML(unmarshal func(interface{}) error) error
type Browser ¶
type Browser struct {
// contains filtered or unexported fields
}
Browser is a browser structure for nuclei headless module
func (*Browser) NewInstance ¶
NewInstance creates a new instance for the current browser.
The login process is repeated only once for a browser, and the created isolated browser instance is used for entire navigation one by one.
Users can also choose to run the login->actions process again which uses a new incognito browser instance to run actions.
func (*Browser) SetUserAgent ¶
SetUserAgent sets custom user agent to the browser
type Hijack ¶
type Hijack struct {
// contains filtered or unexported fields
}
Hijack is a hijack handler
func (*Hijack) SetPattern ¶
func (h *Hijack) SetPattern(pattern *proto.FetchRequestPattern)
SetPattern set pattern directly
type HijackHandler ¶
type HijackHandler = func(e *proto.FetchRequestPaused) error
HijackHandler type
type HistoryData ¶
HistoryData contains the page request/response pairs
type Instance ¶
type Instance struct {
// contains filtered or unexported fields
}
Instance is an isolated browser instance opened for doing operations with it.
func (*Instance) GetRequestLog ¶
returns a map of [template-defined-urls] -> [actual-request-sent] Note: this does not include CORS or other requests while rendering that were not explicitly specified in template
func (*Instance) Run ¶
func (i *Instance) Run(input *contextargs.Context, actions []*Action, payloads map[string]interface{}, options *Options) (map[string]string, *Page, error)
Run runs a list of actions by creating a new page in the browser.
func (*Instance) SetInteractsh ¶
func (i *Instance) SetInteractsh(interactsh *interactsh.Client)
SetInteractsh client
type Page ¶
type Page struct { History []HistoryData InteractshURLs []string // contains filtered or unexported fields }
Page is a single page in an isolated browser instance
func (*Page) ActionAddHeader ¶
ActionAddHeader executes a AddHeader action.
func (*Page) ActionDeleteHeader ¶
ActionDeleteHeader executes a DeleteHeader action.
func (*Page) ActionSetBody ¶
ActionSetBody executes a SetBody action.
func (*Page) ActionSetHeader ¶
ActionSetHeader executes a SetHeader action.
func (*Page) ActionSetMethod ¶
ActionSetMethod executes an SetMethod action.
func (*Page) ClickElement ¶
ClickElement executes click actions for an element.
func (*Page) DebugAction ¶
DebugAction enables debug action on a page.
func (*Page) DumpHistory ¶
DumpHistory returns the full page navigation history
func (*Page) ExecuteActions ¶
func (p *Page) ExecuteActions(input *contextargs.Context, actions []*Action, variables map[string]interface{}) (outData map[string]string, err error)
ExecuteActions executes a list of actions on a page.
func (*Page) ExtractElement ¶
ExtractElement extracts from an element on the page.
func (*Page) FilesInput ¶
FilesInput acts with a file input element on page
func (*Page) GetResource ¶
GetResource gets a resource from an element from page.
func (*Page) InputElement ¶
InputElement executes input element actions for an element.
func (*Page) KeyboardAction ¶
KeyboardAction executes a keyboard action on the page.
func (*Page) NavigateURL ¶
func (p *Page) NavigateURL(action *Action, out map[string]string, allvars map[string]interface{}) error
NavigateURL executes an ActionLoadURL actions loading a URL for the page.
func (*Page) RightClickElement ¶
RightClickElement executes right click actions for an element.
func (*Page) Screenshot ¶
Screenshot executes screenshot action on a page
func (*Page) SelectInputElement ¶
SelectInputElement executes select input statement action on a element
func (*Page) SleepAction ¶
SleepAction sleeps on the page for a specified duration
func (*Page) TimeInputElement ¶
TimeInputElement executes time input on an element