diff --git a/nselib/afp.lua b/nselib/afp.lua
index 88b802cb3..d662f522b 100644
--- a/nselib/afp.lua
+++ b/nselib/afp.lua
@@ -4,11 +4,11 @@
-- still missing several functions.
--
-- The library currently supports
--- o Authentication using the DHX UAM (CAST128)
--- o File reading and writing
--- o Listing sharepoints
--- o Listing directory contents
--- o Querying ACLs and mapping user identities (UIDs)
+-- * Authentication using the DHX UAM (CAST128)
+-- * File reading and writing
+-- * Listing sharepoints
+-- * Listing directory contents
+-- * Querying ACLs and mapping user identities (UIDs)
--
-- The library was built based on the following reference:
-- http://developer.apple.com/mac/library/documentation/Networking/Reference/AFP_Reference/Reference/reference.html
@@ -17,20 +17,20 @@
-- Most functions have been tested against both Mac OS X 10.6.2 and Netatalk 2.0.3
--
-- The library contains the following four classes
--- o Response
--- - A class used as return value by functions in the Proto class
--- - The response class acts as a wrapper and holds the response data and any error information
--- o Proto
--- - This class contains all the AFP specific functions and calls
--- - The functions can be accessed directly but the preferred method is through the Helper class
--- - The function names closely resemble those described in the Apple documentation
--- - Some functions may lack some of the options outlined in Apple's documentation
--- o Helper
--- - The helper class wraps the Proto class using functions with a more descriptive name
--- - Functions are task oriented eg. ReadFile and usually call several functions in the Proto class
--- - The purpose of this class is to give developers easy access to some of the common AFP tasks
--- o Util
--- - The util class contains a number of static functions mainly used to convert data
+-- * Response
+-- ** A class used as return value by functions in the Proto class.
+-- ** The response class acts as a wrapper and holds the response data and any error information.
+-- * Proto
+-- ** This class contains all the AFP specific functions and calls.
+-- ** The functions can be accessed directly but the preferred method is through the Helper class.
+-- ** The function names closely resemble those described in the Apple documentation.
+-- ** Some functions may lack some of the options outlined in Apple's documentation.
+-- * Helper
+-- ** The helper class wraps the Proto class using functions with a more descriptive name.
+-- ** Functions are task-oriented. For example, ReadFile and usually call several functions in the Proto class.
+-- ** The purpose of this class is to give developers easy access to some of the common AFP tasks.
+-- * Util
+-- ** The Util class contains a number of static functions mainly used to convert data.
--
-- The following information will describe how to use the AFP Helper class to communicate with an AFP server.
--
diff --git a/nselib/asn1.lua b/nselib/asn1.lua
index 88b07b432..8fa33416f 100644
--- a/nselib/asn1.lua
+++ b/nselib/asn1.lua
@@ -1,6 +1,7 @@
---- ASN1 functions.
+---
+-- ASN.1 functions.
--
--- Large chunks of this code have been ripped right out from snmp.lua
+-- Large chunks of this code have been ripped right out from snmp.lua.
--
-- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html
--
diff --git a/nselib/base64.lua b/nselib/base64.lua
index b59a4d61e..065773ffb 100644
--- a/nselib/base64.lua
+++ b/nselib/base64.lua
@@ -1,4 +1,6 @@
---- Base64 encoding and decoding. Follows RFC 4648.
+---
+-- Base64 encoding and decoding. Follows RFC 4648.
+--
-- @author Philip Pickering
-- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html
diff --git a/nselib/bin.luadoc b/nselib/bin.luadoc
index 26be22d28..6f899d4c8 100644
--- a/nselib/bin.luadoc
+++ b/nselib/bin.luadoc
@@ -1,4 +1,5 @@
---- Pack and unpack binary data.
+---
+-- Pack and unpack binary data.
--
-- A problem script authors often face is the necessity of encoding values
-- into binary data. For example after analyzing a protocol the starting
diff --git a/nselib/bit.luadoc b/nselib/bit.luadoc
index 996605445..090f8974f 100644
--- a/nselib/bit.luadoc
+++ b/nselib/bit.luadoc
@@ -1,4 +1,5 @@
---- Bitwise operations on integers.
+---
+-- Bitwise operations on integers.
--
-- Lua does not provide bitwise logical operations. Since they are often useful
-- for low-level network communication, Reuben Thomas' BitLib
diff --git a/nselib/comm.lua b/nselib/comm.lua
index c796d0ef2..34ab464ed 100644
--- a/nselib/comm.lua
+++ b/nselib/comm.lua
@@ -1,4 +1,5 @@
---- Common communication functions for network discovery tasks like
+---
+-- Common communication functions for network discovery tasks like
-- banner grabbing and data exchange.
--
-- The functions in this module return values appropriate for use with
diff --git a/nselib/datafiles.lua b/nselib/datafiles.lua
index 192a4d012..cada536cf 100644
--- a/nselib/datafiles.lua
+++ b/nselib/datafiles.lua
@@ -1,4 +1,5 @@
---- Read and parse some of Nmap's data files: nmap-protocols,
+---
+-- Read and parse some of Nmap's data files: nmap-protocols,
-- nmap-rpc, nmap-services, and
-- nmap-mac-prefixes.
--
diff --git a/nselib/db2.lua b/nselib/db2.lua
index 0c9e6dff9..7bd8e8e26 100644
--- a/nselib/db2.lua
+++ b/nselib/db2.lua
@@ -1,61 +1,44 @@
---
--- DB2 Library supporting a very limited subset of operations
+-- DB2 Library supporting a very limited subset of operations.
--
-- Summary
--- -------
--- o The library currently provides functionality to:
--- 1. Query the server for basic settings using the
--- getServerInfo function of the helper class
--- 2. Authenticate to a DB2 server using a plain-text username and
--- password.
+-- * The library currently provides functionality to: (1) Query the server for
+-- basic settings using the code>getServerInfo function of the helper
+-- class. (2) Authenticate to a DB2 server using a plain-text username and
+-- password.
--
--- Overview
--- --------
-- The library contains the following classes:
+-- * DRDA
+-- ** Implements the Distributed Relational Database Architecture class .
+-- * DRDAParameter
+-- ** Implements a number of functions to handle DRDA parameters.
+-- * DDM
+-- ** Implements the DDM portion of the DRDA structure
+-- * Command
+-- ** Provides functions for easy creation of the most common DRDAs.
+-- ** Implemented as a static class that returns an instance of the DRDA.
+-- * Helper
+-- ** A helper class that provides easy access to the rest of the library
+-- * DB2Socket
+-- ** A smallish socket wrapper that provides fundamental buffering
+-- * StringUtil
+-- ** Provides EBCDIC/ASCII conversion functions
--
--- o DRDA
--- - Implements the Distributed Relational Database Architecture class
---
--- o DRDAParameter
--- - Implements a number of functions to handle DRDA parameters
---
--- o DDM
--- - Implements the DDM portion of the DRDA structure
---
--- o Command
--- - Provides functions for easy creation of the most common DRDA's
--- - Implemented as a static class that returns an instance of the DRDA
---
--- o Helper
--- - A helper class that provides easy access to the rest of the library
---
--- o DB2Socket
--- - A smallish socket wrapper that provides fundamental buffering
---
--- o StringUtil
--- - Provides EBCDIC/ASCII conversion functions
---
---
--- Example
--- -------
-- The following sample code illustrates how scripts can use the Helper class
--- to interface the library:
+-- to interface with the library:
--
--
--- db2helper = db2.Helper:new()
+-- db2helper = db2.Helper:new()
-- status, err = db2helper:connect(host, port)
-- status, res = db2helper:getServerInfo()
-- status, err = db2helper:close()
--
--
--- Additional information
--- ----------------------
-- The implementation is based on packet dumps and the excellent decoding
-- provided by Wireshark.
--
--- There is some documentation over at:
--- o http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/topic/
--- com.ibm.db29.doc.drda/db2z_drda.htm [link spans two lines]
+-- There is some documentation at
+-- http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/topic/com.ibm.db29.doc.drda/db2z_drda.htm.
--
-- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html
-- @author "Patrik Karlsson "
diff --git a/nselib/dns.lua b/nselib/dns.lua
index 7a0920a42..831f4f3cf 100644
--- a/nselib/dns.lua
+++ b/nselib/dns.lua
@@ -1,5 +1,7 @@
---- Simple DNS library supporting packet creation, encoding, decoding,
+---
+-- Simple DNS library supporting packet creation, encoding, decoding,
-- and querying.
+--
-- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html
module(... or "dns", package.seeall)
diff --git a/nselib/http.lua b/nselib/http.lua
index 69e59b855..305edee59 100644
--- a/nselib/http.lua
+++ b/nselib/http.lua
@@ -1,4 +1,5 @@
---- Client-side HTTP library.
+---
+-- Client-side HTTP library.
--
-- The return value of each function in this module is a table with the
-- following keys: status, status-line,
diff --git a/nselib/imap.lua b/nselib/imap.lua
index 038fede5c..eac92d7a1 100644
--- a/nselib/imap.lua
+++ b/nselib/imap.lua
@@ -1,4 +1,6 @@
---- IMAP functions.
+---
+-- IMAP functions.
+--
-- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html
module(... or "imap", package.seeall)
diff --git a/nselib/ipOps.lua b/nselib/ipOps.lua
index 80efc1700..3859d9b63 100644
--- a/nselib/ipOps.lua
+++ b/nselib/ipOps.lua
@@ -1,4 +1,6 @@
---- Utility functions for manipulating and comparing IP addresses.
+---
+-- Utility functions for manipulating and comparing IP addresses.
+--
-- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html
local type = type
diff --git a/nselib/json.lua b/nselib/json.lua
index 6176c5f13..499f1ae19 100644
--- a/nselib/json.lua
+++ b/nselib/json.lua
@@ -1,31 +1,22 @@
---- Library methods for handling Json data. It handles
--- json encoding and decoding
+---
+-- Library methods for handling JSON data. It handles JSON encoding and
+-- decoding according to RFC 4627.
--
--- There is a test-section at the bottom which shows some example
--- parsing. If you want to parse json, you can test it by pasting sample json
--- into the TESTS table and run the test() method
-
--- More info about Json at http://www.ietf.org/rfc/rfc4627.txt
-
--- !NOTE! Due to some differences between javascript and lua, there are some
--- conversion problems for null-values. Null-values in javascript are not equal to
--- nil values in lua. Nil is more corresponding to javascript 'undefined'.
-
--- As an example :
--- Executing the following javascript : var a= {b:null}; alert(a.b + " != " + a.c);
--- yields the string "null != undefined". Assigning a table a nil value in lua basically
--- removes it from the table, without leaving the key in place. I.e,
--- >a ={b=nil}
--- >print(a.b, a.c)
--- nil nil
-
--- !!!Therefore, javascript null values are represented by json.NULL.!!!
+-- There is a test section at the bottom which shows some example
+-- parsing. If you want to parse JSON, you can test it by pasting sample JSON
+-- into the TESTS table and run the test method
+--
+-- There is a straightforward mapping between JSON and Lua data types. One
+-- exception is JSON NULL, which is not the same as Lua
+-- nil. (A better match for Lua nil is JavaScript
+-- undefined.) NULL values in JSON are represented by
+-- the special value json.NULL.
--
-- @author Martin Holst Swende
-- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html
+
-- TODO: Unescape/escape unicode
-- Version 0.4
-
-- Created 01/25/2010 - v0.1 - created by Martin Holst Swende
-- Heavily modified 02/22/2010 - v0.3. Rewrote the parser into an OO-form, to not have to handle
-- all kinds of state with parameters and return values.
diff --git a/nselib/ldap.lua b/nselib/ldap.lua
index 319032c7c..6a47d440b 100644
--- a/nselib/ldap.lua
+++ b/nselib/ldap.lua
@@ -1,4 +1,5 @@
---- Library methods for handling LDAP.
+---
+-- Library methods for handling LDAP.
--
-- @author Patrik Karlsson
-- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html
diff --git a/nselib/listop.lua b/nselib/listop.lua
index 6a842b785..c38a58515 100644
--- a/nselib/listop.lua
+++ b/nselib/listop.lua
@@ -1,4 +1,5 @@
---- Functional-style list operations.
+---
+-- Functional-style list operations.
--
-- People used to programming in functional languages, such as Lisp
-- or Haskell, appreciate their handling of lists very much. The
diff --git a/nselib/match.lua b/nselib/match.lua
index f28cfafee..39d90b1d7 100644
--- a/nselib/match.lua
+++ b/nselib/match.lua
@@ -1,4 +1,5 @@
---- Buffered network I/O helper functions.
+---
+-- Buffered network I/O helper functions.
--
-- The functions in this module can be used for delimiting data received by the
-- nmap.receive_buf function in the Network I/O API (which see).
diff --git a/nselib/mongodb.lua b/nselib/mongodb.lua
index d3eaf5e2c..1a0c15a75 100644
--- a/nselib/mongodb.lua
+++ b/nselib/mongodb.lua
@@ -1,4 +1,5 @@
---- Library methods for handling MongoDB, creating and parsing packets
+---
+-- Library methods for handling MongoDB, creating and parsing packets.
--
-- @author Martin Holst Swende
-- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html
diff --git a/nselib/msrpc.lua b/nselib/msrpc.lua
index 79d9d29a7..dba0eb5d1 100644
--- a/nselib/msrpc.lua
+++ b/nselib/msrpc.lua
@@ -1,4 +1,5 @@
---- By making heavy use of the 'smb' library, this library will call various MSRPC
+---
+-- By making heavy use of the smb library, this library will call various MSRPC
-- functions. The functions used here can be accessed over TCP ports 445 and 139,
-- with an established session. A NULL session (the default) will work for some
-- functions and operating systems (or configurations), but not for others.
@@ -8,11 +9,11 @@
-- start_smb can be called. A session has to be created, then the IPC$
-- tree opened.
--
--- Next, the interface has to be bound. The bind() function will take care of that.
+-- Next, the interface has to be bound. The bind() function will take care of that.
--
-- After that, you're free to call any function that's part of that interface. In
--- other words, if you bind to the SAMR interface, you can only call the samr_
--- functions, for lsa_ functions, bind to the LSA interface, etc. Although functions
+-- other words, if you bind to the SAMR interface, you can only call the samr_
+-- functions, for lsa_ functions, bind to the LSA interface, etc. Although functions
-- can technically be called in any order, many functions depend on the
-- value returned by other functions. I indicate those in the function comments,
-- so keep an eye out. SAMR functions, for example, require a call to
@@ -21,8 +22,8 @@
-- Something to note is that these functions, for the most part, return a whole ton
-- of stuff in a table; basically, everything that is returned by the function.
-- Generally, if you want to know exactly what you have access to, either display the
--- returned data with a print_table-type function, or check the documentation (Samba 4.0's
--- .idl files (in samba_4.0/source/librpc/idl; see below for link) are what I based
+-- returned data with a print_table-type function, or check the documentation (Samba 4.0's
+-- .idl files (in samba_4.0/source/librpc/idl; see below for link) are what I based
-- the names on).
--
-- The parameters for each function are converted to a string of bytes in a process
@@ -37,8 +38,8 @@
-- deal with the returned values.
--
-- When implementing this, I used Wireshark's output significantly, as well as Samba's
--- "idl" files for reference:
--- http://websvn.samba.org/cgi-bin/viewcvs.cgi/branches/SAMBA_4_0/source/librpc/idl/
+-- .idl files for reference:
+-- http://websvn.samba.org/cgi-bin/viewcvs.cgi/branches/SAMBA_4_0/source/librpc/idl/.
-- I'm not a lawyer, but I don't expect that this is a breach of Samba's copyright --
-- if it is, please talk to me and I'll make arrangements to re-license this or to
-- remove references to Samba.
diff --git a/nselib/msrpcperformance.lua b/nselib/msrpcperformance.lua
index c53c51eab..6abc7ba6f 100644
--- a/nselib/msrpcperformance.lua
+++ b/nselib/msrpcperformance.lua
@@ -1,16 +1,17 @@
----This module is designed to parse the PERF_DATA_BLOCK structure, which is
+---
+-- This module is designed to parse the PERF_DATA_BLOCK structure, which is
-- stored in the registry under HKEY_PERFORMANCE_DATA. By querying this structure, you can
-- get a whole lot of information about what's going on.
--
-- To use this from a script, see get_performance_data, it is the only
--- 'public' function in this module.
+-- "public" function in this module.
--
-- My primary sources of information were:
-- * This 1996 journal by Matt Pietrek:
-- * The followup article:
-- * The WinPerf.h header file
--
--- And my primary inspiration was PsTools, specifically, pstasklist.exe.
+-- And my primary inspiration was PsTools, specifically, pstasklist.exe.
--
--@author Ron Bowes
--@copyright Same as Nmap--See http://nmap.org/book/man-legal.html
diff --git a/nselib/msrpctypes.lua b/nselib/msrpctypes.lua
index 536ee636c..6f4495f08 100644
--- a/nselib/msrpctypes.lua
+++ b/nselib/msrpctypes.lua
@@ -1,10 +1,11 @@
----This module was written to marshall parameters for Microsoft RPC (MSRPC) calls. The values passed in and out are based
+---
+-- This module was written to marshall parameters for Microsoft RPC (MSRPC) calls. The values passed in and out are based
-- on structs defined by the protocol, and documented by Samba developers. For detailed breakdowns of the types, take a
--- look at Samba 4.0's .idl files.
+-- look at Samba 4.0's .idl files.
--
-- There is nothing simple about how this all comes together, so I'll take some time to explain how it's done. This
-- is fairly technical and, when it comes right down to it, unnecessary for how to use these functions (although if you
--- want to WRITE one of these, you best understand it).
+-- want to write one of these, you best understand it).
--
-- There are base types, like int32 and int16. These are marshalled the way you'd expect (converted to a 4- or
-- 2-byte little endian string). The only trick with these is that they have to end up aligned on 4-byte boundaries.
@@ -12,7 +13,7 @@
-- marshall_int32, marshall_int16, etc. will marshall the base types, and unmarshall_int32,
-- unmarshall_int16, etc. will unmarshall them.
--
--- Strings are a little bit tricker. A string is preceded by three 32-bit values: the max length, the offset, and
+-- Strings are a little bit trickier. A string is preceded by three 32-bit values: the max length, the offset, and
-- the length. Additionally, strings may or may not be null terminated, depending on where they're being used. For
-- more information on strings, see the comments on marshall_unicode. The functions marshall_unicode
-- and unmarshall_unicode can be used to mashall/unmarshall strings.
@@ -24,7 +25,7 @@
-- itself is 0x00000004). If the integer is nil, then it's marshalled as 00 00 00 00, which is simply
-- a referent_id of 0.
--
--- From the perspective of the program, pointers can be marshalled by using the "_ptr" versions of normal functions
+-- From the perspective of the program, pointers can be marshalled by using the "_ptr" versions of normal functions
-- (for example, marshall_int32_ptr and unmarshall_unicode_ptr. From the perspective
-- of functions within this module, especially functions for marshalling structs and arrays, the marshall_ptr
-- and unmarshall_ptr functions should be used. These can marshall any data type; the marshalling function
@@ -64,10 +65,10 @@
-- left up to functions within this module. Functions within this module should use marshall_array and
-- unmarshall_array to interact with arrays. These take callback functions for the datatype being stored
-- in the array; these callback functions have to be in a particular format, so care should be taken when writing them.
--- In particular, the first parameter has to be 'location', which is used to separate the header (the part with the
+-- In particular, the first parameter has to be location, which is used to separate the header (the part with the
-- referent_ids) and the body (the part with the pointer data). These are explained more thoroughly in the function headers.
--
--- Structs are handled the same as arrays -- the referent_ids and base types go at the top, and the values being pointed to
+-- Structs are handled the same as arrays. The referent_ids and base types go at the top, and the values being pointed to
-- go at the bottom. An array of struct, as has already been shown, will have all the base types and referent_ids for all the
-- members at the top, and all the values for all the pointers at the bottom.
--
@@ -82,8 +83,8 @@
-- function the same way unmarshall_array would. This is a bit of a kludge, but it's the best I could come up
-- with.
--
--- There are different sections in here, which correspond to "families" of types. I modelled these after Samba's .idl files.
--- MISC corresponds to misc.idl, LSA to lsa.idl, etc. Each of these sections has possible dependencies; for example, SAMR
+-- There are different sections in here, which correspond to "families" of types. I modelled these after Samba's .idl files.
+-- MISC corresponds to misc.idl, LSA to lsa.idl, etc. Each of these sections has possible dependencies; for example, SAMR
-- functions use LSA strings, and everything uses SECURITY and MISC. So the order is important -- dependencies have to go
-- above the module.
--
diff --git a/nselib/mssql.lua b/nselib/mssql.lua
index 6bef88a5d..1d47d83d3 100644
--- a/nselib/mssql.lua
+++ b/nselib/mssql.lua
@@ -1,8 +1,6 @@
---
--- MSSQL Library supporting a very limited subset of operations
+-- MSSQL Library supporting a very limited subset of operations.
--
--- Summary
--- -------
-- The library was designed and tested against Microsoft SQL Server 2005.
-- However, it should work with versions 7.0, 2000, 2005 and 2008.
-- Only a minimal amount of parsers have been added for tokens, column types
@@ -10,45 +8,18 @@
--
-- The code has been implemented based on traffic analysis and the following
-- documentation:
--- o TDS Protocol Documentation
--- http://www.freetds.org/tds.html
+-- * TDS Protocol Documentation: http://www.freetds.org/tds.html.
+-- * The JTDS source code: http://jtds.sourceforge.net/index.html.
--
--- o The JTDS source code
--- http://jtds.sourceforge.net/index.html
+-- * ColumnInfo: Class containing parsers for column types which are present before the row data in all query response packets. The column information contains information relevant to the data type used to hold the data eg. precision, character sets, size etc.
+-- * ColumnData: Class containing parsers for the actual column information.
+-- * Token: Class containing parsers for tokens returned in all TDS responses. A server response may hold one or more tokens with information from the server. Each token has a type which has a number of type specific fields.
+-- * QueryPacket: Class used to hold a query and convert it to a string suitable for transmission over a socket.
+-- * LoginPacket: Class used to hold login specific data which can easily be converted to a string suitable for transmission over a socket.
+-- * TDSStream: Class that handles communication over the Tabular Data Stream protocol used by SQL serve. It is used to transmit the the Query- and Login-packets to the server.
+-- * Helper: Class which facilitates the use of the library by through action oriented functions with descriptive names.
+-- * Util: A "static" class containing mostly character and type conversion functions.
--
--- Overview
--- --------
--- o ColumInfo - Class containing parsers for column types which are present
--- before the row data in all query response packets. The column
--- information contains information relevant to the data type
--- used to hold the data eg. precision, character sets, size etc.
---
--- o ColumnData - Class containing parsers for the actual column information
---
--- o Token - Class containing parsers for tokens returned in all TDS responses.
--- A server response may hold one or more tokens with information
--- from the server. Each token has a type which has a number of
--- type specific fields.
---
--- o QueryPacket - Class used to hold a query and convert it to a string
--- suitable for transmission over a socket.
---
--- o LoginPacket - Class used to hold login specific data which can easily
--- be converted to a string suitable for transmission over
--- a socket.
---
--- o TDSStream - Class that handles communication over the Tabular Data Stream
--- protocol used by SQL serve. It is used to transmit the the
--- Query- and Login-packets to the server.
---
--- o Helper - Class which facilitates the use of the library by through action
--- oriented functions with descriptive names.
---
--- o Util - "static" class containing mostly character and type conversion
--- functions.
---
--- Example
--- -------
-- The following sample code illustrates how scripts can use the Helper class
-- to interface the library:
--
@@ -59,36 +30,14 @@
-- helper:Disconnect()
--
--
--- Known limitations
--- -----------------
--- o The library does not support SSL. The foremost reason being the akward
--- choice of implementation where the SSL handshake is performed within
--- the TDS data block. By default, servers support connections over non
--- SSL connections though.
---
--- o Version 7 and ONLY version 7 of the protocol is supported. This should
--- cover Microsoft SQL Server 7.0 and later.
---
--- o TDS Responses contain one or more response tokens which are parsed based
--- on their type. The supported tokens are listed in the TokenType table and
--- their respective parsers can be found in the Token class. Note that some
--- token parsers are not fully implemented and simply move the offset the
--- right number of bytes to continue processing of the response.
---
--- o The library only supports a limited subsets of datatypes and will abort
--- execution and return an error if it detects an unsupported type. The
--- supported data types are listed in the DataTypes table. In order to add
--- additional data types a parser function has to be added to both the
--- ColumnInfo and ColumnData class.
---
--- o No functionality for languages, localization or characted codepages has
--- been considered or implemented.
---
--- o The library does database authentication only. No OS authentication or
--- use of the integrated security model is supported.
---
--- o Queries using SELECT, INSERT, DELETE and EXEC of procedures have been
--- tested while developing scripts.
+-- Known limitations:
+-- * The library does not support SSL. The foremost reason being the akward choice of implementation where the SSL handshake is performed within the TDS data block. By default, servers support connections over non SSL connections though.
+-- * Version 7 and ONLY version 7 of the protocol is supported. This should cover Microsoft SQL Server 7.0 and later.
+-- * TDS Responses contain one or more response tokens which are parsed based on their type. The supported tokens are listed in the TokenType table and their respective parsers can be found in the Token class. Note that some token parsers are not fully implemented and simply move the offset the right number of bytes to continue processing of the response.
+-- * The library only supports a limited subsets of datatypes and will abort execution and return an error if it detects an unsupported type. The supported data types are listed in the DataTypes table. In order to add additional data types a parser function has to be added to both the ColumnInfo and ColumnData class.
+-- * No functionality for languages, localization or characted codepages has been considered or implemented.
+-- * The library does database authentication only. No OS authentication or use of the integrated security model is supported.
+-- * Queries using SELECT, INSERT, DELETE and EXEC of procedures have been tested while developing scripts.
--
-- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html
--
diff --git a/nselib/mysql.lua b/nselib/mysql.lua
index a9630ff98..148b77cb4 100644
--- a/nselib/mysql.lua
+++ b/nselib/mysql.lua
@@ -1,5 +1,6 @@
---
--- Simple MySQL Library supporting a very limited subset of operations
+-- Simple MySQL Library supporting a very limited subset of operations.
+--
-- http://forge.mysql.com/wiki/MySQL_Internals_ClientServer_Protocol
--
-- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html
diff --git a/nselib/netbios.lua b/nselib/netbios.lua
index 7ff877bfb..7e47f2e75 100644
--- a/nselib/netbios.lua
+++ b/nselib/netbios.lua
@@ -1,9 +1,9 @@
---- Creates and parses NetBIOS traffic. The primary use for this is to send
--- NetBIOS name requests.
+---
+-- Creates and parses NetBIOS traffic. The primary use for this is to send
+-- NetBIOS name requests.
--
---@author Ron Bowes
---@copyright Same as Nmap--See http://nmap.org/book/man-legal.html
------------------------------------------------------------------------
+-- @author Ron Bowes
+-- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html
module(... or "netbios", package.seeall)
diff --git a/nselib/nmap.luadoc b/nselib/nmap.luadoc
index 1cd705322..d8fa03137 100644
--- a/nselib/nmap.luadoc
+++ b/nselib/nmap.luadoc
@@ -1,4 +1,5 @@
---- Interface with Nmap internals.
+---
+-- Interface with Nmap internals.
--
-- The nmap module is an interface with Nmap's internal functions
-- and data structures. The API provides target host details such as port
diff --git a/nselib/nsedebug.lua b/nselib/nsedebug.lua
index 8f3c2cabc..9f1f08db7 100644
--- a/nselib/nsedebug.lua
+++ b/nselib/nsedebug.lua
@@ -1,3 +1,4 @@
+---
-- Debugging functions for Nmap scripts.
--
-- This module contains various handy functions for debugging. These should
@@ -11,7 +12,8 @@ local EMPTY = {}; -- Empty constant table
module(... or "nsedebug", package.seeall);
----Converts an arbitrary data type into a string. Will recursively convert
+---
+-- Converts an arbitrary data type into a string. Will recursively convert
-- tables. This can be very useful for debugging.
--
--@param data The data to convert.
diff --git a/nselib/openssl.luadoc b/nselib/openssl.luadoc
index 5d4efb1e1..1dea1c438 100644
--- a/nselib/openssl.luadoc
+++ b/nselib/openssl.luadoc
@@ -1,4 +1,5 @@
---- OpenSSL bindings.
+---
+-- OpenSSL bindings.
--
-- This module is a wrapper for OpenSSL functions that provide encryption and
-- decryption, hashing, and multiprecision integers.
diff --git a/nselib/packet.lua b/nselib/packet.lua
index 791bd3ad2..b5fdbc7f6 100644
--- a/nselib/packet.lua
+++ b/nselib/packet.lua
@@ -1,4 +1,6 @@
---- Facilities for manipulating raw packets.
+---
+-- Facilities for manipulating raw packets.
+--
-- @author Marek Majkowski
-- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html
diff --git a/nselib/pcre.luadoc b/nselib/pcre.luadoc
index 7da1ecc1d..c442a9669 100644
--- a/nselib/pcre.luadoc
+++ b/nselib/pcre.luadoc
@@ -1,4 +1,5 @@
---- Perl Compatible Regular Expressions.
+---
+-- Perl Compatible Regular Expressions.
--
-- One of Lua's quirks is its string patterns. While they have great performance
-- and are tightly integrated into the Lua interpreter, they are very different
diff --git a/nselib/pgsql.lua b/nselib/pgsql.lua
index d2ced87fb..bc76876ab 100644
--- a/nselib/pgsql.lua
+++ b/nselib/pgsql.lua
@@ -1,13 +1,13 @@
---
--- PostgreSQL library supporting both version 2 and version 3 of the protocol
--- The library currently contains the bare minimum to perform authentication
+-- PostgreSQL library supporting both version 2 and version 3 of the protocol.
+-- The library currently contains the bare minimum to perform authentication.
-- Authentication is supported with or without SSL enabled and using the
--- plain-text or MD5 authentication mechanisms
+-- plain-text or MD5 authentication mechanisms.
--
--- The PGSQL protocol is explained in detail in the following reference
--- ref: http://developer.postgresql.org/pgdocs/postgres/protocol.html
--- ref: http://developer.postgresql.org/pgdocs/postgres/protocol-flow.html
--- ref: http://developer.postgresql.org/pgdocs/postgres/protocol-message-formats.html
+-- The PGSQL protocol is explained in detail in the following references.
+-- * http://developer.postgresql.org/pgdocs/postgres/protocol.html
+-- * http://developer.postgresql.org/pgdocs/postgres/protocol-flow.html
+-- * http://developer.postgresql.org/pgdocs/postgres/protocol-message-formats.html
--
-- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html
-- @author "Patrik Karlsson "
diff --git a/nselib/pop3.lua b/nselib/pop3.lua
index 566504c66..c6b30db55 100644
--- a/nselib/pop3.lua
+++ b/nselib/pop3.lua
@@ -1,4 +1,6 @@
---- POP3 functions.
+---
+-- POP3 functions.
+--
-- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html
module(... or "pop3",package.seeall)
diff --git a/nselib/proxy.lua b/nselib/proxy.lua
index 335f32d44..e9dd01606 100644
--- a/nselib/proxy.lua
+++ b/nselib/proxy.lua
@@ -1,6 +1,8 @@
---- Functions for proxy testing
--- @author Joao Correa
--- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html
+---
+-- Functions for proxy testing.
+--
+-- @author Joao Correa
+-- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html
module(... or "proxy",package.seeall)
diff --git a/nselib/rpc.lua b/nselib/rpc.lua
index 8c4a40326..ea35dce18 100644
--- a/nselib/rpc.lua
+++ b/nselib/rpc.lua
@@ -1,41 +1,35 @@
---
--- RPC Library supporting a very limited subset of operations
+-- RPC Library supporting a very limited subset of operations.
--
--- Summary
--- -------
--- o The library works over both the UDP and TCP protocols
--- o A subset of nfs and mountd procedures are supported
--- o The versions 1 through 3 are supported for the nfs and mountd program
--- o Authentication is supported using the NULL RPC Authentication protocol
+-- The library works over both the UDP and TCP protocols. A subset of nfs and
+-- mountd procedures are supported. The nfs and mountd programs support
+-- versions 1 through 3. Authentication is supported using the NULL RPC
+-- Authentication protocol
--
--- Overview
--- --------
-- The library contains the following classes:
--- o Comm
--- - Handles network connections
--- - Handles low-level packet sending, recieving, decoding and encoding
--- - Stores rpc programs info: socket, protocol, program name, id and version
--- - Used by Mount, NFS, RPC and Portmap
--- o Portmap
--- - Containes RPC constants
--- - Handles communication with the portmap RPC program
--- o Mount
--- - Handles communication with the mount RPC program
--- o NFS
--- - Handles communication with the nfs RPC program
--- o Helper
--- - Provides easy access to common RPC functions
--- - Implemented as a static class where most functions accept host
--- and port parameters
--- o Util
--- - Mostly static conversion routines
+-- * Comm
+-- ** Handles network connections.
+-- ** Handles low-level packet sending, recieving, decoding and encoding.
+-- ** Stores rpc programs info: socket, protocol, program name, id and version.
+-- ** Used by Mount, NFS, RPC and Portmap.
+-- * Portmap
+-- ** Contains RPC constants.
+-- ** Handles communication with the portmap RPC program.
+-- * Mount
+-- ** Handles communication with the mount RPC program.
+-- * NFS
+-- ** Handles communication with the nfs RPC program.
+-- * Helper
+-- ** Provides easy access to common RPC functions.
+-- ** Implemented as a static class where most functions accept host and port parameters.
+-- * Util
+-- ** Mostly static conversion routines.
--
--- The portmapper dynamically allocates tcp/udp ports to RPC programs. So in
+-- The portmapper dynamically allocates TCP/UDP ports to RPC programs. So in
-- in order to request a list of NFS shares from the server we need to:
--- o Make sure that we can talk to the portmapper on port 111 tcp or udp
--- o Query the portmapper for the ports allocated to the NFS program
--- o Query the NFS program for a list of shares on the ports returned by the
--- portmap program.
+-- * Make sure that we can talk to the portmapper on port 111 TCP or UDP.
+-- * Query the portmapper for the ports allocated to the NFS program.
+-- * Query the NFS program for a list of shares on the ports returned by the portmap program.
--
-- The Helper class contains functions that facilitate access to common
-- RPC program procedures through static class methods. Most functions accept
@@ -43,9 +37,7 @@
-- get the correct RPC program port, the port supplied to these functions
-- should be the rpcbind port 111/tcp or 111/udp.
--
--- Example
--- -------
--- The following sample code illustrates how scripts can use the Helper class
+-- The following sample code illustrates how scripts can use the Helper class
-- to interface the library:
--
--
@@ -58,12 +50,10 @@
-- -- get the NFS attributes for the share
-- status, attribs = rpc.Helper.GetAttributes( host, port, mount.name )
-- .... process NFS attributes here ....
--- end
+-- end
--
--
--- Additional information
--- ----------------------
--- RPC transaction ID's (XID) are not properly implemented as a random ID is
+-- RPC transaction IDs (XID) are not properly implemented as a random ID is
-- generated for each client call. The library makes no attempt to verify
-- whether the returned XID is valid or not.
--
diff --git a/nselib/shortport.lua b/nselib/shortport.lua
index 00bcb9af2..e6b75bc29 100644
--- a/nselib/shortport.lua
+++ b/nselib/shortport.lua
@@ -1,7 +1,9 @@
---- Functions for building short portrules.
+---
+-- Functions for building short portrules.
--
-- Since portrules are mostly the same for many scripts, this
-- module provides functions for the most common tests.
+--
-- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html
module(... or "shortport", package.seeall)
diff --git a/nselib/smb.lua b/nselib/smb.lua
index 944206006..419da0b5d 100644
--- a/nselib/smb.lua
+++ b/nselib/smb.lua
@@ -1,4 +1,5 @@
----Implements functionality related to Server Message Block (SMB, also known
+---
+-- Implements functionality related to Server Message Block (SMB, also known
-- as CIFS) traffic, which is a Windows protocol.
--
-- SMB traffic is normally sent to/from ports 139 or 445 of Windows systems. Other systems
@@ -21,7 +22,7 @@
-- although a lot isn't necessary. You can pick up a lot by looking at the code. The basic
-- login/logoff is this:
--
---
+--
-- [connect]
-- C->S SMB_COM_NEGOTIATE
-- S->C SMB_COM_NEGOTIATE
@@ -35,11 +36,11 @@
-- C->S SMB_COM_LOGOFF_ANDX
-- S->C SMB_COM_LOGOFF_ANDX
-- [disconnect]
---
+--
--
-- In terms of functions here, the protocol is:
--
---
+--
-- status, smbstate = smb.start(host)
-- status, err = smb.negotiate_protocol(smbstate, {})
-- status, err = smb.start_session(smbstate, {})
@@ -48,7 +49,7 @@
-- status, err = smb.tree_disconnect(smbstate)
-- status, err = smb.logoff(smbstate)
-- status, err = smb.stop(smbstate)
---
+--
--
-- The stop function will automatically call tree_disconnect and logoff,
-- cleaning up the session, if it hasn't been done already.
@@ -96,11 +97,11 @@
-- nmap --script=smb-