diff --git a/nselib/base32.lua b/nselib/base32.lua index 5199e6986..3936b574b 100644 --- a/nselib/base32.lua +++ b/nselib/base32.lua @@ -25,8 +25,6 @@ -- @author Patrick Donnelly -- @copyright The MIT License (MIT); Copyright (c) 2016 Patrick Joseph Donnelly (batrick@batbytes.com) -local debug1 = require "stdnse".debug1 - local assert = assert local error = error local ipairs = ipairs diff --git a/nselib/bin.lua b/nselib/bin.lua index d96cd9542..659a9c758 100644 --- a/nselib/bin.lua +++ b/nselib/bin.lua @@ -58,7 +58,6 @@ local tointeger = require "math".tointeger local char = require "string".char local insert = require "table".insert -local move = require "table".move local pack = require "table".pack local unpack = require "table".unpack diff --git a/nselib/bit.lua b/nselib/bit.lua index 967c64186..5b91790c4 100644 --- a/nselib/bit.lua +++ b/nselib/bit.lua @@ -10,8 +10,6 @@ local select = select -local mininteger = require "math".mininteger - local _ENV = {} --- Returns the one's complement of a. diff --git a/nselib/data/http-devframework-fingerprints.lua b/nselib/data/http-devframework-fingerprints.lua index a4d85deeb..39ce30ed2 100644 --- a/nselib/data/http-devframework-fingerprints.lua +++ b/nselib/data/http-devframework-fingerprints.lua @@ -1,7 +1,5 @@ local http = require "http" -local io = require "io" local string = require "string" -local table = require "table" --- -- http-devframework-fingerprints.lua diff --git a/nselib/ipmi.lua b/nselib/ipmi.lua index 210196957..0d8370118 100644 --- a/nselib/ipmi.lua +++ b/nselib/ipmi.lua @@ -7,10 +7,8 @@ -- @author "Claudiu Perta " local bin = require "bin" local bit = require "bit" -local math = require "math" local stdnse = require "stdnse" local string = require "string" -local table = require "table" _ENV = stdnse.module("ipmi", stdnse.seeall) diff --git a/nselib/multicast.lua b/nselib/multicast.lua index aacaffd81..8d9c5ba8e 100644 --- a/nselib/multicast.lua +++ b/nselib/multicast.lua @@ -8,7 +8,6 @@ local nmap = require "nmap" local ipOps = require "ipOps" local packet = require "packet" local stdnse = require "stdnse" -local string = require "string" local table = require "table" _ENV = stdnse.module("multicast", stdnse.seeall) diff --git a/nselib/smb2.lua b/nselib/smb2.lua index 4808eafd0..abf4ebd7d 100644 --- a/nselib/smb2.lua +++ b/nselib/smb2.lua @@ -1,6 +1,6 @@ --- -- Implements the Server Message Block (SMB) protocol version 2 and 3. --- +-- -- The implementation extends smb.lua to support SMB dialects 2.02, 2.10, 3.0, -- 3.02 and 3.11. This is a work in progress and not all commands are -- implemented yet. Features/functionality will be added as the scripts @@ -8,16 +8,14 @@ -- smb.lua but some fields may have changed name or don't exist anymore. -- -- @author Paulino Calderon --- @copyright Same as Nmap--See https://nmap.org/book/man-legal.html +-- @copyright Same as Nmap--See https://nmap.org/book/man-legal.html --- local string = require "string" local stdnse = require "stdnse" -local netbios = require "netbios" local nmap = require "nmap" local table = require "table" local match = require "match" -local math = require "math" local os = require "os" _ENV = stdnse.module("smb2", stdnse.seeall) @@ -74,7 +72,7 @@ end --- -- Creates a SMB2 SYNC header packet. -- --- SMB2 Packet Header - SYNC: +-- SMB2 Packet Header - SYNC: -- * https://msdn.microsoft.com/en-us/library/cc246529.aspx -- -- @param smb The SMB object associated with the connection. @@ -85,7 +83,7 @@ end function smb2_encode_header_sync(smb, command, overrides) overrides = overrides or {} - local sig = "\xFESMB" -- SMB2 packet + local sig = "\xFESMB" -- SMB2 packet local structureSize = 64 -- SYNC header structure size local flags = 0 -- TODO: Set flags that will work for all dialects @@ -98,8 +96,8 @@ function smb2_encode_header_sync(smb, command, overrides) local header = string.pack("smb_encode_sync_header. -- @param data The data. @@ -235,7 +233,7 @@ end --- -- Sends SMB2_COM_NEGOTIATE command for a SMB2/SMB3 connection. -- This function works for dialects 2.02, 2.10, 3.0, 3.02 and 3.11. --- +-- -- Packet structure: https://msdn.microsoft.com/en-us/library/cc246543.aspx -- -- @param smb The associated SMB connection object. @@ -251,17 +249,17 @@ function negotiate_v2(smb, overrides) else DialectCount = 1 end - -- The client MUST set SecurityMode bit to 0x01 if the SMB2_NEGOTIATE_SIGNING_REQUIRED bit is not set, - -- and MUST NOT set this bit if the SMB2_NEGOTIATE_SIGNING_REQUIRED bit is set. + -- The client MUST set SecurityMode bit to 0x01 if the SMB2_NEGOTIATE_SIGNING_REQUIRED bit is not set, + -- and MUST NOT set this bit if the SMB2_NEGOTIATE_SIGNING_REQUIRED bit is set. -- The server MUST ignore this bit. - local SecurityMode = overrides["SecurityMode"] or smb2_values['SMB2_NEGOTIATE_SIGNING_ENABLED'] + local SecurityMode = overrides["SecurityMode"] or smb2_values['SMB2_NEGOTIATE_SIGNING_ENABLED'] local Capabilities = overrides["Capabilities"] or 0 -- SMB 3.x dialect requires capabilities to be constructed local GUID = overrides["GUID"] or "1234567890123456" local ClientStartTime = overrides["ClientStartTime"] or 0 -- ClientStartTime only used in dialects > 3.11 local total_data = 0 -- Data counter local padding_data = "" -- Padding string to align contexts - local context_data -- Holds Context data - local is_0311 = false -- Flag for SMB 3.11 + local context_data -- Holds Context data + local is_0311 = false -- Flag for SMB 3.11 local status, err if not( overrides['Dialects'] ) then -- Set 2.02 as default dialect if user didn't select one @@ -271,7 +269,7 @@ function negotiate_v2(smb, overrides) header = smb2_encode_header_sync(smb, command_codes['SMB2_COM_NEGOTIATE'], overrides) -- We construct the first block that works for dialects 2.02 up to 3.11. - data = string.pack("