1
0
mirror of https://github.com/nmap/nmap.git synced 2026-02-03 12:06:35 +00:00

Updated refguide and scripting chapter of book to the new syntax of the

--script-args as well as a more full account of some details. The previous text
was very vague about some features, especially array values.
This commit is contained in:
batrick
2009-05-29 07:14:48 +00:00
parent 6f51d7d6a9
commit cfc16fb6de
2 changed files with 49 additions and 26 deletions

View File

@@ -2174,25 +2174,27 @@ which lists the category or categories in which each script belongs.</para>
</varlistentry>
<varlistentry>
<term><option>--script-args <replaceable>name1</replaceable>=<replaceable>value1</replaceable>,<replaceable>name2</replaceable>={<replaceable>name3</replaceable>=<replaceable>value3</replaceable>},<replaceable>name4</replaceable>=<replaceable>value4</replaceable></option>
<term><option>--script-args <replaceable>name1</replaceable>=<replaceable>value1</replaceable>,<replaceable>name2</replaceable>={<replaceable>name3</replaceable>=<replaceable>value3</replaceable>,<replaceable>array_value1</replaceable>},<replaceable>name4</replaceable>=<replaceable>value4</replaceable>,<replaceable>array_value2</replaceable></option>
<indexterm significance="preferred"><primary><option>--script-args</option></primary></indexterm>
<indexterm><primary>script arguments</primary><seealso><option>--script-args</option></seealso></indexterm></term>
<listitem>
<para>Lets you provide arguments to NSE scripts. Arguments are passed
as <literal>name=value</literal> pairs. The provided argument is
processed and stored inside a Lua table, to which all scripts have
access. The names are taken as strings (which must be alphanumeric
values) and used as keys inside the
<literal>argument-table</literal>. Values are either strings or tables
themselves (surrounded by &lsquo;<literal>{</literal>&rsquo; and
&lsquo;<literal>}</literal>&rsquo;).
For example, you could pass the comma-separated arguments:
<literal>user=bar,pass=foo,whois={whodb=nofollow+ripe}</literal>.
String arguments are potentially used by several scripts; subtables are
normally used by only one script. In scripts that take a subtable, the
subtable is usually named after the script (like
<literal>whois</literal> in this example).</para>
<para>
Lets you provide arguments to NSE scripts. Arguments are a comma separated list
of <literal>name=value</literal> pairs or array values within a table. Array
values are simply values with implicit ordered numeric keys. Array Values as
well as Keys and Values in key-value pairs may be strings of characters not
including <literal>"{", "}", "=", ","<literal> or whitespace. You may quote
these strings to allow all characters. The quote delimiter must be escaped by
a backslash if used inside the quoted string. A backslash is only used as an
escape mechanism for quote delimiters in quoted strings; in all other contexts
it is interpreted literally. Array Values and Values in key-value pairs are
allowed to be nested tables delimited by <literal>{</literal> and
<literal>}</literal>. An example of script arguments: <literal>--script-args
auth={user=foo,pass=',{}=bar'},userdb=C:\Path\To\File</literal>. See NSE's
online script documentation at http://nmap.org/nsedoc for each script's
accepted arguments.
</para>
</listitem>
</varlistentry>