From d79e431e7aa45b8df923a4f24700ba41d7b5c9bc Mon Sep 17 00:00:00 2001 From: patrik Date: Mon, 28 Jan 2013 04:28:38 +0000 Subject: [PATCH] nse_check_globals cleanup --- nselib/ike.lua | 12 +++++++----- scripts/ventrilo-info.nse | 6 ++++-- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/nselib/ike.lua b/nselib/ike.lua index d14821880..8ab731dd4 100644 --- a/nselib/ike.lua +++ b/nselib/ike.lua @@ -1,6 +1,8 @@ local _G = require "_G" +local bin = require "bin" local nmap = require "nmap" local stdnse = require "stdnse" +local string = require "string" local table = require "table" local math = require "math" local io = require "io" @@ -91,7 +93,7 @@ local function load_fingerprints() -- Check there are fingerprints to use if(#fingerprints == 0 ) then - return false, "No fingerprints were loaded after processing ".. filename + return false, "No fingerprints were loaded after processing ".. filename_full end return true, fingerprints @@ -135,7 +137,7 @@ local function extract_payloads(packet) -- loop over packet while payloads[np] ~= "None" and index <= packet:len() do - payload_length = tonumber("0x"..packet:sub(index, index+3)) * 2 + local payload_length = tonumber("0x"..packet:sub(index, index+3)) * 2 payload = string.lower(packet:sub(index+4, index+payload_length-5)) -- debug @@ -325,7 +327,7 @@ end function send_request( host, port, packet ) local socket = nmap.new_socket() - local s_status, r_status, data, i, hexstring + local s_status, r_status, data, i, hexstring, _ -- send the request packet socket:set_timeout(1000) @@ -395,7 +397,7 @@ end -- Currently only DES, 3DES and AES encryption is supported -- local function generate_transform(auth, encryption, hash, group, number, total) - local key_length, trans_length, aes_enc, sep + local key_length, trans_length, aes_enc, sep, enc local next_payload, payload_number -- handle special case of aes @@ -403,7 +405,7 @@ local function generate_transform(auth, encryption, hash, group, number, total) trans_length = "0028" aes_enc = enc_methods[encryption] sep = aes_enc:find("/") - enc = aes_enc:sub(1,sep-1) + enc = aes_enc:sub(1,sep-1) key_length = aes_enc:sub(sep+1, aes_enc:len()) else trans_length = "0024" diff --git a/scripts/ventrilo-info.nse b/scripts/ventrilo-info.nse index d2c1fbec7..d7dc90dce 100644 --- a/scripts/ventrilo-info.nse +++ b/scripts/ventrilo-info.nse @@ -1,7 +1,9 @@ local bit = require "bit" local stdnse = require "stdnse" +local math = require "math" local nmap = require "nmap" local strbuf = require "strbuf" +local string = require "string" local table = require "table" local shortport = require "shortport" @@ -310,11 +312,11 @@ local dec_data = function(str, len, key) -- skip the header (first 20 bytes) local data = { string.byte(str, 21, 20 + len) } - a1 = bit.band(key, 0xFF) + local a1 = bit.band(key, 0xFF) if a1 == 0 then return table.concat(data) end - a2 = bit.rshift(key, 8) + local a2 = bit.rshift(key, 8) for i = 1,len do data[i] = bit.band(data[i] - (crypt_data[a2 + 1] + ((i - 1) % 72)), 0xFF)