mirror of
https://github.com/nmap/nmap.git
synced 2026-01-04 13:49:03 +00:00
Reformat and merge documentation for stdnse, shortport, strbuf, snmp, ssh1,
ssh2, smb, pop3, and msrpc.
This commit is contained in:
@@ -1428,58 +1428,6 @@ if(s) code_to_be_done_on_match end
|
||||
<indexterm class="endofrange" startref="nse-openssl-indexterm"/>
|
||||
</sect2>
|
||||
|
||||
<sect2 id="nse-lib-shortport">
|
||||
<title>Short Portrules</title>
|
||||
<indexterm><primary><varname>shortport</varname> NSE module</primary></indexterm>
|
||||
<para>
|
||||
Since portrules are mostly the same for many scripts, the
|
||||
<literal>shortport</literal> module provides functions for the most common tests.
|
||||
The arguments in brackets (<literal>[]</literal>) are optional. If no
|
||||
<literal>proto</literal> is provided, <literal>tcp</literal> is used. The default
|
||||
<literal>state</literal> is <literal>open</literal>
|
||||
</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>shortport.portnumber(port,[proto],[state])</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
The port argument is either a number or a table of numbers which are
|
||||
interpreted as port numbers, against which the script should run.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>shortport.service(service,[proto],[state])</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
The service argument is either a string or a table
|
||||
of strings which are interpreted as service names
|
||||
(e.g. <literal>"http"</literal>, <literal>"https"</literal>, <literal>"smtp"</literal> or <literal>"ftp"</literal>) against which the
|
||||
script should run. These service names are
|
||||
determined by Nmap's version scan or (if no version
|
||||
scan information is available) the service assigned
|
||||
to the port in <filename>nmap-services</filename>
|
||||
(e.g. <literal>"http"</literal> for TCP port 80).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>shortport.port_or_service(port,service,[proto],[state])</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
This is a combination of the above functions, since many scripts
|
||||
explicitly try to run against the well-known ports, but want
|
||||
also to run against any other port which was discovered to run the
|
||||
named service. A typical example for this function is:
|
||||
<literal>portrule = shortport.port_or_service(22,"ssh")</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</sect2>
|
||||
<sect2 id="nse-lib-strbuf">
|
||||
<title>String Buffer Operations</title>
|
||||
<indexterm><primary><varname>strbuf</varname> NSE module</primary></indexterm>
|
||||
@@ -1664,108 +1612,6 @@ if(s) code_to_be_done_on_match end
|
||||
</variablelist>
|
||||
</sect2>
|
||||
|
||||
</sect2>
|
||||
<sect2 id="nse-lib-stdnse">
|
||||
<title>Various Utility Functions</title>
|
||||
<indexterm><primary><varname>stdnse</varname> NSE module</primary></indexterm>
|
||||
<para>
|
||||
The <literal>stdnse</literal> library contains various handy
|
||||
functions which are too small to justify modules of their own:
|
||||
</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><option>stdnse.print_debug([verbosity,] format, ...)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Wrapper function around <literal>print_debug_unformatted()</literal>
|
||||
in the <literal>nmap</literal> namespace. The first optional numeric
|
||||
argument, <literal>verbosity</literal>, is
|
||||
used as the necessary debug level to print the message (it defaults
|
||||
to 1 if omitted). All remaining arguments are processed with
|
||||
Lua's <literal>string.format()</literal> function, which provides a
|
||||
C-style printf interface.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>list = stdnse.strsplit("delimiter", "text")</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
This function will certainly be appreciated by Perl programmers.
|
||||
It takes two strings as arguments and splits the second one around
|
||||
all occurrences of the first one, returning a list (table), which
|
||||
contains the substrings without the delimiting string.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>string = stdnse.strjoin("delimiter", list)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Inverse function to <literal>strsplit()</literal>. Basically this is
|
||||
Lua's <literal>table.concat()</literal> function with the parameters
|
||||
swapped for coherence.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>string = stdnse.tobinary(n)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Converts the given number, <literal>n</literal>, to a string
|
||||
in a binary number format (e.g. 5 becomes "101").
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>string = stdnse.tooctal(n)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Converts the given number, <literal>n</literal>, to a string
|
||||
in an octal number format (e.g. 9 becomes "11").
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>string = stdnse.tohex(s, options)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
Converts the given number or string, <literal>s</literal>, to a
|
||||
string in a hexadecimal number format (e.g. 10 becomes "a").
|
||||
<literal>options</literal> is a table containing parameters to
|
||||
control the formatting. You may specify <literal>options.separator</literal>
|
||||
which will be used as separator for groups of consecutive bytes.
|
||||
With <literal>options.group</literal> you can control the group
|
||||
length to be used with <literal>options.separator</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>string = stdnse.make_buffer(socket, sep)</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>
|
||||
This function operates on a socket attempting to read data.
|
||||
It separates the data by <literal>sep</literal> and, for each
|
||||
invocation, returns a piece of the separated data. Typically
|
||||
this is used to iterate over the lines of data received from a
|
||||
socket (<literal>sep = "\r?\n"</literal>). The returned string
|
||||
does not include the separator. It will return the final data
|
||||
even if it is not followed by the separator. Once an error or
|
||||
EOF is reached, it returns <literal>nil, msg</literal>.
|
||||
<literal>msg</literal> is what is returned by
|
||||
<literal>nmap.receive_lines()</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</sect2>
|
||||
<indexterm class="endofrange" startref="nse-library-indexterm"/>
|
||||
</sect1>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user