diff --git a/nselib/vuzedht.lua b/nselib/vuzedht.lua index cb655b231..3900b3482 100644 --- a/nselib/vuzedht.lua +++ b/nselib/vuzedht.lua @@ -29,7 +29,7 @@ local os = require "os" local stdnse = require "stdnse" local string = require "string" local table = require "table" -local openssl = stdnse.silent_require "openssl" +local rand = require "rand" _ENV = stdnse.module("vuzedht", stdnse.seeall) @@ -49,7 +49,7 @@ Request = { -- @return o new instance of Header new = function(self, action, session) local o = { - conn_id = string.char(255) .. openssl.rand_pseudo_bytes(7), + conn_id = string.char(255) .. rand.random_string(7), -- we need to handle this one like this, due to a bug in nsedoc -- it used to be action = action, but that breaks parsing ["action"] = action, @@ -110,7 +110,7 @@ Request = { local o = { header = Request.Header:new(Request.Actions.FIND_NODE, session), id_length = 20, - node_id = '\xA7' .. openssl.rand_pseudo_bytes(19), + node_id = '\xA7' .. rand.random_string(19), status = 0xFFFFFFFF, dht_size = 0, } diff --git a/scripts/ipv6-node-info.nse b/scripts/ipv6-node-info.nse index dfea6851b..ebc4dccfe 100644 --- a/scripts/ipv6-node-info.nse +++ b/scripts/ipv6-node-info.nse @@ -4,8 +4,7 @@ local nmap = require "nmap" local packet = require "packet" local stdnse = require "stdnse" local string = require "string" - -local openssl = stdnse.silent_require "openssl" +local rand = require "rand" description = [[ Obtains hostnames, IPv4 and IPv6 addresses through IPv6 Node Information Queries. @@ -69,7 +68,7 @@ local QTYPE_STRINGS = { local function build_ni_query(src, dst, qtype) local flags - local nonce = openssl.rand_pseudo_bytes(8) + local nonce = rand.random_string(8) if qtype == QTYPE_NODENAME then flags = 0x0000 elseif qtype == QTYPE_NODEADDRESSES then diff --git a/scripts/lltd-discovery.nse b/scripts/lltd-discovery.nse index 37c7efd1f..9a40ddf03 100644 --- a/scripts/lltd-discovery.nse +++ b/scripts/lltd-discovery.nse @@ -8,8 +8,7 @@ local table = require "table" local target = require "target" local unicode = require "unicode" local ipOps = require "ipOps" - -local openssl = stdnse.silent_require "openssl" +local rand = require "rand" description = [[ Uses the Microsoft LLTD protocol to discover hosts on a local network. @@ -177,12 +176,12 @@ local QuickDiscoveryPacket = function(mac_src) demultiplex_hdr = string.pack("BBBB", lltd_version, lltd_type_of_service, lltd_reserved, lltd_function ) -- set up LLTD base header = [ mac_dst, mac_src, seq_num(xid) ] - local lltd_seq_num = openssl.rand_bytes(2) + local lltd_seq_num = rand.random_string(2) base_hdr = mac_dst .. mac_src .. lltd_seq_num -- set up LLTD Upper Level Header = [ generation_number, number_of_stations, station_list ] - local generation_number = openssl.rand_bytes(2) + local generation_number = rand.random_string(2) local number_of_stations = 0 local station_list = string.rep("\0", 6*4)