Actions
An action is a single piece of Task for the Nuclei Headless Engine. Each action manipulates the browser state in some way, and finally leads to the state that we are interested in capturing. Nuclei supports a variety of actions. A list of these Actions along with their arguments are given below:navigate
Navigate visits a given URL. url field supports variables like{{BaseURL}}
, {{Hostname}}
to customize the request fully.
script
Script runs a JS code on the current browser page. At the simplest level, you can just provide acode
argument with the JS snippet you want to execute, and it will be run on the page.
window.random-object
with a value, and you want to match on that value.
hook
argument. This will always run the provided Javascript, before any of the pages load.
The example provided hooks window.alert
so that the alerts that are generated by the application do not stop the crawler.
click
Click simulates clicking with the Left-Mouse button on an element specified by a selector.rightclick
RightClick simulates clicking with the Right-Mouse button on an element specified by a selector.text
Text simulates typing something into an input with Keyboard. Selectors can be used to specify the element to type in.screenshot
Screenshots takes the screenshots of a page and writes it to disk. It supports both full page and normal screenshots.fullpage: true
option in the args.
time
Time enters values into time inputs on pages in RFC3339 format.select
Select performs selection on an HTML Input by a selector.files
Files handles a file upload input on the webpage.waitload
WaitLoads waits for a page to finish loading and get in Idle state.waitload
action waits for DOM to load, and window.onload event to be received after which we wait for the page to become idle for 1 seconds.
getresource
GetResource returns the src attribute for an element.extract
Extract extracts either the Text for an HTML Node, or an attribute as specified by the user. The below code will extract the Text for the given XPath Selector Element, which can then also be matched upon by nameextracted-value
with matchers and extractors.
setmethod
SetMethod overrides the method for the request.addheader
AddHeader adds a header to the requests / responses. This does not overwrite any pre-existing headers.setheader
SetHeader sets a header in the requests / responses.deleteheader
DeleteHeader deletes a header from requests / responses.setbody
SetBody sets the body for a request / response.waitevent
WaitEvent waits for an event to trigger on the page.keyboard
Keyboard simulates a single key-press on the keyboard.keys
argument accepts key-codes.
debug
Debug adds a delay of 5 seconds between each headless action and also shows a trace of all the headless events occurring in the browser.Note: Only use this for debugging purposes, don’t use this in production templates.
sleep
Sleeps makes the browser wait for a specified duration in seconds. This is also useful for debugging purposes.Selectors
Selectors are how nuclei headless engine identifies what element to execute an action on. Nuclei supports getting selectors by including a variety of options -Selector | Description |
---|---|
r / regex | Element matches CSS Selector and Text Matches Regex |
x / xpath | Element matches XPath selector |
js | Return elements from a JS function |
search | Search for a query (can be text, XPATH, CSS) |
selector (default) | Element matches CSS Selector |
Matchers / Extractor Parts
Validpart
values supported by Headless protocol for Matchers / Extractor are -
Value | Description |
---|---|
request | Headless Request |
<out_names> | Action names with stored values |
raw / body / data | Final DOM response from browser |
Example Headless Template
An example headless template to automatically login into DVWA is provided below -More complete examples are provided here.