diff --git a/nselib/afp.lua b/nselib/afp.lua index 97775107f..f5ca363d2 100644 --- a/nselib/afp.lua +++ b/nselib/afp.lua @@ -1065,7 +1065,7 @@ Proto = { local response,records = {}, {} local data = bin.pack( "CC>S>I>S>S", COMMAND.FPEnumerateExt2, pad, volume_id, did, file_bitmap, dir_bitmap ) - data = data .. bin.pack( ">S>I>ICCA", req_count, start_index, reply_size, path.type, path.len, path.name ) + .. bin.pack( ">S>I>ICCA", req_count, start_index, reply_size, path.type, path.len, path.name ) packet = self:create_fp_packet( REQUEST.Command, data_offset, data ) self:send_fp_packet( packet ) diff --git a/nselib/msrpc.lua b/nselib/msrpc.lua index c598e23af..529b1d529 100644 --- a/nselib/msrpc.lua +++ b/nselib/msrpc.lua @@ -259,9 +259,7 @@ function bind(smbstate, interface_uuid, interface_version, transfer_syntax) 0x00, -- Padding/alignment 0x00, -- Padding/alignment 0x00 -- Padding/alignment - ) - - data = data .. bin.pack("data. --@return A string representing the marshalled data. function marshall_int8_array(data, max_length) - local result = "" - stdnse.debug4("MSRPC: Entering marshall_int8_array()") if(max_length == nil) then max_length = #data end - result = result .. bin.pack("S", self.length) end - if ( self.subfunc ) then data = data .. bin.pack("C", self.subfunc) end - if ( self.data ) then data = data .. bin.pack("A", self.data) end + .. (self.length and bin.pack(">S", self.length) or "") + .. (self.subfunc and bin.pack("C", self.subfunc) or "") + .. (self.data or "") return data end, @@ -944,10 +943,10 @@ NCP = { unknown, iter_handle, entry.id, info_flags ) -- no name filter - data = data .. "\0\0\0\0" + .. "\0\0\0\0" -- no class filter - data = data .. "\0\0\0\0" + .. "\0\0\0\0" p:setData(data) local status, entries = self:Exch( p ) diff --git a/nselib/ospf.lua b/nselib/ospf.lua index 4bd4dcdf2..9bb3f6f22 100644 --- a/nselib/ospf.lua +++ b/nselib/ospf.lua @@ -98,15 +98,17 @@ OSPF = { end, __tostring = function(self) - local hdr = bin.pack(">CCS", self.ver, self.type, self.length ) - hdr = hdr .. bin.pack(">IISS", ipOps.todword(self.router_id), self.area_id, self.chksum, self.auth_type) + local auth if self.auth_type == 0x00 then - hdr = hdr .. bin.pack(">L", 0x00) + auth = bin.pack(">L", 0x00) elseif self.auth_type == 0x01 then - hdr = hdr .. bin.pack(">A8", self.auth_data.password) + auth = bin.pack(">A8", self.auth_data.password) elseif self.auth_type == 0x02 then - hdr = hdr .. bin.pack(">A".. self.auth_data.length, self.auth_data.hash) + auth = bin.pack(">A".. self.auth_data.length, self.auth_data.hash) end + local hdr = bin.pack(">CCS", self.ver, self.type, self.length ) + .. bin.pack(">IISS", ipOps.todword(self.router_id), self.area_id, self.chksum, self.auth_type) + .. auth return hdr end, diff --git a/nselib/sasl.lua b/nselib/sasl.lua index a2dadf3c3..f7fb47842 100644 --- a/nselib/sasl.lua +++ b/nselib/sasl.lua @@ -143,14 +143,14 @@ if HAVE_SSL then end local response = "username=\"" .. self.username .. "\"" - response = response .. (",%s=\"%s\""):format("realm", realm) - response = response .. (",%s=\"%s\""):format("nonce", self.challnvs.nonce) - response = response .. (",%s=\"%s\""):format("cnonce", cnonce) - response = response .. (",%s=%08d"):format("nc", self.nc) - response = response .. (",%s=%s"):format("qop", "auth") - response = response .. (",%s=\"%s\""):format("digest-uri", uri) - response = response .. (",%s=%s"):format("response", digest) - response = response .. (",%s=%s"):format("charset", "utf-8") + .. (",%s=\"%s\""):format("realm", realm) + .. (",%s=\"%s\""):format("nonce", self.challnvs.nonce) + .. (",%s=\"%s\""):format("cnonce", cnonce) + .. (",%s=%08d"):format("nc", self.nc) + .. (",%s=%s"):format("qop", "auth") + .. (",%s=\"%s\""):format("digest-uri", uri) + .. (",%s=%s"):format("response", digest) + .. (",%s=%s"):format("charset", "utf-8") -- response_table is used in http library because the request should -- be a little bit different then the string generated above diff --git a/nselib/smb.lua b/nselib/smb.lua index 4aaa6b82e..c46634e0b 100644 --- a/nselib/smb.lua +++ b/nselib/smb.lua @@ -2150,7 +2150,7 @@ local function send_transaction2(smb, sub_command, function_parameters, function ) local data = "\0\0\0" .. (function_parameters or '') - data = data .. (function_data or '') + .. (function_data or '') -- Send the transaction request stdnse.debug2("SMB: Sending SMB_COM_TRANSACTION2") @@ -2262,8 +2262,23 @@ function send_transaction_named_pipe(smb, function_parameters, function_data, pi data_size = #function_data end + local setup + if(no_setup) then + setup = bin.pack("cAaa", SSH2.SSH_MSG_KEXINIT, cookie, kex_algorithms, host_key_algorithms ) - payload = payload .. bin.pack( ">aa", encryption_algorithms, encryption_algorithms ) - payload = payload .. bin.pack( ">aa", mac_algorithms, mac_algorithms ) - payload = payload .. bin.pack( ">aa", compression_algorithms, compression_algorithms ) - payload = payload .. bin.pack( ">aa", languages, languages ) - payload = payload .. bin.pack( ">cI", 0, 0 ) + .. bin.pack( ">aa", encryption_algorithms, encryption_algorithms ) + .. bin.pack( ">aa", mac_algorithms, mac_algorithms ) + .. bin.pack( ">aa", compression_algorithms, compression_algorithms ) + .. bin.pack( ">aa", languages, languages ) + .. bin.pack( ">cI", 0, 0 ) return payload end diff --git a/nselib/url.lua b/nselib/url.lua index 15ebf65c6..afa4d8d60 100644 --- a/nselib/url.lua +++ b/nselib/url.lua @@ -81,7 +81,7 @@ end local function absolute_path(base_path, relative_path) if string.sub(relative_path, 1, 1) == "/" then return relative_path end local path = string.gsub(base_path, "[^/]*$", "") - path = path .. relative_path + .. relative_path path = string.gsub(path, "([^/]*%./)", function (s) if s ~= "./" then return s else return "" end end) diff --git a/nselib/vuzedht.lua b/nselib/vuzedht.lua index ffc01ea06..b48ba2298 100644 --- a/nselib/vuzedht.lua +++ b/nselib/vuzedht.lua @@ -122,7 +122,7 @@ Request = { -- Converts a FindNode Request to a string __tostring = function(self) local data = tostring(self.header) - data = data .. bin.pack(">CAII", self.id_length, self.node_id, self.status, self.dht_size) + .. bin.pack(">CAII", self.id_length, self.node_id, self.status, self.dht_size) return data end, } diff --git a/nselib/wsdd.lua b/nselib/wsdd.lua index 8a313e434..cf55e12c6 100644 --- a/nselib/wsdd.lua +++ b/nselib/wsdd.lua @@ -165,9 +165,9 @@ Decoders = { -- @return status true on success, false on failure -- @return err string containing the error message ['error'] = function( data ) - local response = "Failed to decode response from device: " local err = data:match("(.-)<") - response = response .. (err or "Unknown error") + local response = "Failed to decode response from device: " + .. (err or "Unknown error") return true, response end,