1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

NSEdoc fixes

This commit is contained in:
dmiller
2025-03-13 18:13:21 +00:00
parent fb58d2440e
commit b2ebc18360
17 changed files with 40 additions and 36 deletions

View File

@@ -357,8 +357,8 @@ Options = {
return (val == "true" or val == true or tonumber(val) == 1) return (val == "true" or val == true or tonumber(val) == 1)
end, end,
--- Sets the brute mode to either iterate over users or passwords --- Sets the brute mode to either iterate over users or passwords.
-- @see description for more information. -- See description for more information.
-- --
-- @param mode string containing either "user" or "password" -- @param mode string containing either "user" or "password"
-- @return status true on success else false -- @return status true on success else false

View File

@@ -26,7 +26,7 @@ local crlf_pattern = "\r?\n"
-- @return code The numeric response code, as returned by read_reply, or error message if socket is nil. -- @return code The numeric response code, as returned by read_reply, or error message if socket is nil.
-- @return message The response message -- @return message The response message
-- @return buffer The socket read buffer function, to be passed to read_reply. -- @return buffer The socket read buffer function, to be passed to read_reply.
-- @see comm.lua -- @see comm
connect = function(host, port, opts) connect = function(host, port, opts)
opts = opts or {} opts = opts or {}
opts.recv_before = true opts.recv_before = true

View File

@@ -72,7 +72,7 @@ function publickey_canauth(session, username, publickeydata)
-- @param session Authenticated libssh2 session -- @param session Authenticated libssh2 session
-- @param no_pty If true, skip requesting a PTY. -- @param no_pty If true, skip requesting a PTY.
-- @return libssh2 channel -- @return libssh2 channel
function open_channel(session, pty) function open_channel(session, no_pty)
--- Reads data from stdin on libssh2 channel. --- Reads data from stdin on libssh2 channel.
-- @param session Authenticated libssh2 session -- @param session Authenticated libssh2 session

View File

@@ -267,7 +267,7 @@ Session = {
--- Prepares and sends the challenge response authentication to the server --- Prepares and sends the challenge response authentication to the server
-- @name Session.authenticate -- @name Session.authenticate
-- @param request instance of the request object requiring authentication -- @param request instance of the request object requiring authentication
-- @param authdata string containing authentication data -- @param response string containing authentication data
-- @return status true on success false on failure -- @return status true on success false on failure
-- @return err string containing an error message if status is false -- @return err string containing an error message if status is false
authenticate = function(self, request, response) authenticate = function(self, request, response)
@@ -582,7 +582,7 @@ Request = {
--- Sets the request content data --- Sets the request content data
-- @name Request.setContent -- @name Request.setContent
-- @param string containing the content data -- @param content string containing the content data
setContent = function(self, content) self.content = content end, setContent = function(self, content) self.content = content end,
--- Sets the requests' content type --- Sets the requests' content type

View File

@@ -192,7 +192,7 @@ parser = {
unescape = function(str) return string.gsub( str, '(&(#?)([%d%a]+);)', entitySwap ) end, unescape = function(str) return string.gsub( str, '(&(#?)([%d%a]+);)', entitySwap ) end,
--- Parses the xml in sax like manner. --- Parses the xml in sax like manner.
-- @self The parser object. -- @param self The parser object.
-- @param xml The xml body to be parsed. -- @param xml The xml body to be parsed.
-- @param options Options if any specified. -- @param options Options if any specified.
parseSAX = function(self, xml, options) parseSAX = function(self, xml, options)

View File

@@ -458,7 +458,7 @@ function start_raw(host, port)
return true, socket return true, socket
end end
--- This function will take a string like "a.b.c.d" and return "a", "a.b", "a.b.c", and "a.b.c.d". -- This function will take a string like "a.b.c.d" and return "a", "a.b", "a.b.c", and "a.b.c.d".
-- --
-- This is used for discovering NetBIOS names. If a NetBIOS name is unknown, the substrings of the -- This is used for discovering NetBIOS names. If a NetBIOS name is unknown, the substrings of the
-- DNS name can be used in this way. -- DNS name can be used in this way.
@@ -687,7 +687,7 @@ function smb_encode_header(smb, command, overrides)
return header return header
end end
--- Converts a string containing the parameters section into the encoded -- Converts a string containing the parameters section into the encoded
-- parameters string. -- parameters string.
-- --
-- The encoding is simple: -- The encoding is simple:
@@ -705,7 +705,7 @@ local function smb_encode_parameters(parameters, overrides)
return string.pack("<B", overrides['parameters_length'] or (#parameters / 2)) .. parameters return string.pack("<B", overrides['parameters_length'] or (#parameters / 2)) .. parameters
end end
--- Converts a string containing the data section into the encoded data string. -- Converts a string containing the data section into the encoded data string.
-- --
-- The encoding is simple: -- The encoding is simple:
-- * (2 bytes) The number of bytes in the data section -- * (2 bytes) The number of bytes in the data section
@@ -722,7 +722,7 @@ local function smb_encode_data(data, overrides)
return string.pack("<I2", overrides['data_length'] or #data) .. data return string.pack("<I2", overrides['data_length'] or #data) .. data
end end
---Sign the message, if possible. This is done by replacing the signature with the sequence --Sign the message, if possible. This is done by replacing the signature with the sequence
-- number, creating a hash, then putting that hash in the signature location. -- number, creating a hash, then putting that hash in the signature location.
--@param smb The smb state object. --@param smb The smb state object.
--@param body The body of the packet that's being signed. --@param body The body of the packet that's being signed.
@@ -749,7 +749,7 @@ local function message_sign(smb, body)
return string.sub(body, 1, 14) .. signature .. string.sub(body, 23) return string.sub(body, 1, 14) .. signature .. string.sub(body, 23)
end end
---Check the signature of the message. --Check the signature of the message.
-- --
-- This is the opposite of <code>message_sign</code>, and works the same way -- This is the opposite of <code>message_sign</code>, and works the same way
-- (replaces the signature with the sequence number, calculates hash, checks) -- (replaces the signature with the sequence number, calculates hash, checks)
@@ -2142,7 +2142,7 @@ function delete_file(smb, path, overrides)
return true return true
end end
--- --
-- Implements SMB_COM_TRANSACTION2 to support the find_files function -- Implements SMB_COM_TRANSACTION2 to support the find_files function
-- This function has not been extensively tested -- This function has not been extensively tested
-- --

View File

@@ -322,7 +322,7 @@ function init_account(host)
end end
end end
---Generate the Lanman v1 hash (LMv1). --Generate the Lanman v1 hash (LMv1).
-- --
-- The generated hash is incredibly easy to reverse, because the input is -- The generated hash is incredibly easy to reverse, because the input is
-- padded or truncated to 14 characters, then split into two 7-character -- padded or truncated to 14 characters, then split into two 7-character
@@ -628,7 +628,7 @@ end
-- be generated properly). -- be generated properly).
--@return lm_response, to be send directly back to the server --@return lm_response, to be send directly back to the server
--@return ntlm_response, to be send directly back to the server --@return ntlm_response, to be send directly back to the server
--@reutrn mac_key used for message signing. --@return mac_key used for message signing.
function get_password_response(ip, username, domain, password, password_hash, hash_type, challenge, is_extended) function get_password_response(ip, username, domain, password, password_hash, hash_type, challenge, is_extended)
local status local status
local lm_hash = nil local lm_hash = nil

View File

@@ -151,7 +151,7 @@ end
local version_to_num = {v1=0, v2c=1} local version_to_num = {v1=0, v2c=1}
local num_to_version = {[0]="v1", [1]="v2c"} local num_to_version = {[0]="v1", [1]="v2c"}
--- Returns the numerical value of a given SNMP protocol version -- Returns the numerical value of a given SNMP protocol version
-- --
-- Numerical input is simply passed through, assuming it is valid. -- Numerical input is simply passed through, assuming it is valid.
-- String input is translated to its corresponding numerical value. -- String input is translated to its corresponding numerical value.
@@ -549,7 +549,7 @@ Helper = {
-- @param options SNMP options table -- @param options SNMP options table
-- @see snmp.options -- @see snmp.options
-- @param oid Object identifiers of object to be set. -- @param oid Object identifiers of object to be set.
-- @param value To which value object should be set. If given a table, -- @param setparam To which value object should be set. If given a table,
-- use the table instead of OID/value pair. -- use the table instead of OID/value pair.
-- @return status False if error, true otherwise -- @return status False if error, true otherwise
-- @return Table with all decoded responses and their OIDs. -- @return Table with all decoded responses and their OIDs.

View File

@@ -643,7 +643,7 @@ end
-- => mode = "timed" -- => mode = "timed"
-- => domains = {"host1","host2"} -- => domains = {"host1","host2"}
-- --
-- @param Arguments Script arguments to check. -- @param ... Script arguments to check.
-- @return Arguments values. -- @return Arguments values.
function get_script_args (...) function get_script_args (...)
local args = {} local args = {}

View File

@@ -41,14 +41,13 @@ end
--- Split a string at a given delimiter, which may be a pattern. --- Split a string at a given delimiter, which may be a pattern.
-- --
-- If you want to loop over the resulting values, consider using string.gmatch instead. -- If you want to loop over the resulting values, consider using <code>string.gmatch</code> instead.
-- @usage -- @usage
-- stringaux.strsplit(",%s*", "Anna, Bob, Charlie, Dolores") -- stringaux.strsplit(",%s*", "Anna, Bob, Charlie, Dolores")
-- --> { "Anna", "Bob", "Charlie", "Dolores" } -- --> { "Anna", "Bob", "Charlie", "Dolores" }
-- @param pattern Pattern that separates the desired strings. -- @param pattern Pattern that separates the desired strings.
-- @param text String to split. -- @param text String to split.
-- @return Array of substrings without the separating pattern. -- @return Array of substrings without the separating pattern.
-- @see string.gmatch
function strsplit(pattern, text) function strsplit(pattern, text)
local list, pos = {}, 1; local list, pos = {}, 1;

View File

@@ -62,7 +62,7 @@ end
--- Check for the presence of a value in a table --- Check for the presence of a value in a table
--@param t the table to search into --@param t the table to search into
--@param item the searched value --@param item the searched value
--@array (optional) If true, then use ipairs to only search the array indices of the table. --@param array (optional) If true, then use ipairs to only search the array indices of the table.
--@return Boolean true if the item was found, false if not --@return Boolean true if the item was found, false if not
--@return The index or key where the value was found, or nil --@return The index or key where the value was found, or nil
function contains(t, item, array) function contains(t, item, array)

View File

@@ -60,7 +60,7 @@ end
-- --
-- Only prerule, portrule and hostrule scripts can add new targets. -- Only prerule, portrule and hostrule scripts can add new targets.
-- --
-- @param targets A variable number of targets. Target is a -- @param ... A variable number of targets. Target is a
-- string that represents an IP or a Hostname. If this function -- string that represents an IP or a Hostname. If this function
-- is called without target arguments then it will return true -- is called without target arguments then it will return true
-- and the number of pending targets (waiting to be scanned). -- and the number of pending targets (waiting to be scanned).

View File

@@ -324,8 +324,8 @@ Telnet = {
-- Buffer addresses can come in 14 or 12 (this terminal doesn't support 16 bit) -- Buffer addresses can come in 14 or 12 (this terminal doesn't support 16 bit)
-- this function takes two bytes (buffer addresses are two bytes long) and returns -- this function takes two bytes (buffer addresses are two bytes long) and returns
-- the decoded buffer address. -- the decoded buffer address.
-- @param1 unsigned char, first byte of buffer address. -- @param unsigned char, first byte of buffer address.
-- @param2 unsigned char, second byte of buffer address. -- @param unsigned char, second byte of buffer address.
-- @return integer of buffer address -- @return integer of buffer address
DECODE_BADDR = function ( byte1, byte2 ) DECODE_BADDR = function ( byte1, byte2 )
if (byte1 & 0xC0) == 0 then if (byte1 & 0xC0) == 0 then
@@ -339,7 +339,7 @@ Telnet = {
--- Encode Buffer Address --- Encode Buffer Address
-- --
-- @param integer buffer address -- @param address integer buffer address
-- @return TN3270 encoded buffer address (12 bit) as string -- @return TN3270 encoded buffer address (12 bit) as string
ENCODE_BADDR = function ( self, address ) ENCODE_BADDR = function ( self, address )
stdnse.debug(3, "Encoding Address: %s", address) stdnse.debug(3, "Encoding Address: %s", address)
@@ -842,7 +842,7 @@ Telnet = {
--- WCC / tn3270 data stream processor --- WCC / tn3270 data stream processor
-- --
-- @param tn3270 data stream -- @param data tn3270 data stream
-- @return status true on success, false on failure -- @return status true on success, false on failure
-- @return changes self.buffer to match requested changes -- @return changes self.buffer to match requested changes
process_write = function ( self, data ) process_write = function ( self, data )
@@ -1065,7 +1065,7 @@ Telnet = {
--- Sends TN3270 Packet --- Sends TN3270 Packet
-- --
-- Expands IAC to IAC IAC and finally appends IAC EOR -- Expands IAC to IAC IAC and finally appends IAC EOR
-- @param data: table containing buffer array -- @param data table containing buffer array
send_tn3270 = function ( self, data ) send_tn3270 = function ( self, data )
local packet = '' local packet = ''
if self.state == self.TN3270E_DATA then if self.state == self.TN3270E_DATA then
@@ -1164,8 +1164,8 @@ Telnet = {
--- Sends the data to the location specified --- Sends the data to the location specified
-- --
-- Using a location on the screen sends the data -- Using a location on the screen sends the data
-- @param location: a location on the screen (between 0 and 1920) -- @param location a location on the screen (between 0 and 1920)
-- @param data: ascii data to send to that location -- @param data ascii data to send to that location
send_location = function( self, location, data ) send_location = function( self, location, data )
local cursor_location = location + #data local cursor_location = location + #data
local ebcdic_letter = '' local ebcdic_letter = ''
@@ -1191,7 +1191,7 @@ Telnet = {
-- --
-- Using a supplied tuple of location and data generates tn3270 data to -- Using a supplied tuple of location and data generates tn3270 data to
-- fill out the screen -- fill out the screen
-- @param location_tuple: and array of tuples with location and data. For -- @param location_tuple and array of tuples with location and data. For
-- example: send_locations([{579:"dade"},{630:"secret"}]) -- example: send_locations([{579:"dade"},{630:"secret"}])
send_locations = function( self, location_tuple ) send_locations = function( self, location_tuple )
local cursor_location = location_tuple[#location_tuple][1] + #location_tuple[#location_tuple][2] local cursor_location = location_tuple[#location_tuple][1] + #location_tuple[#location_tuple][2]
@@ -1303,7 +1303,7 @@ Telnet = {
--- Any Hidden Fields --- Any Hidden Fields
-- --
-- @returns true if there are any hidden fields in the buffer -- @return true if there are any hidden fields in the buffer
any_hidden = function ( self ) any_hidden = function ( self )
local hidden_attrib = 0x0c -- 00001100 is hidden local hidden_attrib = 0x0c -- 00001100 is hidden
for i = 0,#self.fa_buffer do for i = 0,#self.fa_buffer do
@@ -1315,7 +1315,7 @@ Telnet = {
--- Hidden Fields --- Hidden Fields
-- --
-- @returns the locations of hidden fields in a table with each pair being the start and stop of the hidden field -- @return the locations of hidden fields in a table with each pair being the start and stop of the hidden field
hidden_fields_location = function ( self ) hidden_fields_location = function ( self )
local hidden_attrib = 0x0c -- 00001100 is hidden local hidden_attrib = 0x0c -- 00001100 is hidden
local hidden_location = {} local hidden_location = {}

View File

@@ -672,7 +672,7 @@ Packet.Unknown1 = {
--- Creates a new Packet.Unknown1 --- Creates a new Packet.Unknown1
-- --
-- @param version containing the version of the packet to send -- @param os string containing the version of the packet to send
-- @return new instance of Packet.Unknown1 -- @return new instance of Packet.Unknown1
new = function(self, os) new = function(self, os)
local o = { os = os } local o = { os = os }
@@ -1690,7 +1690,7 @@ Helper = {
--- Authenticates to the database --- Authenticates to the database
-- --
-- @param user containing the Oracle user name -- @param user containing the Oracle user name
-- @param pass containing the Oracle user password -- @param password containing the Oracle user password
-- @return true on success, false on failure -- @return true on success, false on failure
-- @return err containing error message when status is false -- @return err containing error message when status is false
Login = function( self, user, password ) Login = function( self, user, password )
@@ -1720,7 +1720,7 @@ Helper = {
--- Steal auth data from database --- Steal auth data from database
-- @param user containing the Oracle user name -- @param user containing the Oracle user name
-- @param pass containing the Oracle user password -- @param password containing the Oracle user password
-- @return true on success, false on failure -- @return true on success, false on failure
-- @return err containing error message when status is false -- @return err containing error message when status is false
StealthLogin = function( self, user, password ) StealthLogin = function( self, user, password )

View File

@@ -235,6 +235,8 @@ end
-- @class function -- @class function
--@param cp The Unicode code point as a number --@param cp The Unicode code point as a number
--@return A string containing the code point in UTF-8 encoding. --@return A string containing the code point in UTF-8 encoding.
--@class function
--@name utf8_enc
utf8_enc = utf8.char utf8_enc = utf8.char
---Decodes a UTF-8 character. ---Decodes a UTF-8 character.

View File

@@ -427,7 +427,7 @@ Helper = {
-- @param username string -- @param username string
-- @param password string -- @param password string
-- @param mech string containing a supported authentication mechanism -- @param mech string containing a supported authentication mechanism
-- @see Helper.getAuthMechs -- @see XMPP.getAuthMechs
-- @return status true on success, false on failure -- @return status true on success, false on failure
-- @return err string containing error message if status is false -- @return err string containing error message if status is false
login = function(self, username, password, mech) login = function(self, username, password, mech)

View File

@@ -8,6 +8,9 @@ author = {"Alessandro ZANNI <alessandro.zanni@bt.com>", "Daniel Miller"}
license = "Same as Nmap--See https://nmap.org/book/man-legal.html" license = "Same as Nmap--See https://nmap.org/book/man-legal.html"
categories = {"default","safe","discovery","version"} categories = {"default","safe","discovery","version"}
---@output
--|_weblogic-t3-info: T3 protocol in use (WebLogic version: 12.1.2)
portrule = function(host, port) portrule = function(host, port)
if type(port.version) == "table" and port.version.name_confidence > 3 and port.version.product ~= nil then if type(port.version) == "table" and port.version.name_confidence > 3 and port.version.product ~= nil then
return string.find(port.version.product, "WebLogic", 1, true) and nmap.version_intensity() >= 7 return string.find(port.version.product, "WebLogic", 1, true) and nmap.version_intensity() >= 7