1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-06 14:39:03 +00:00

Remove some openssl deps when only used for random strings

This commit is contained in:
dmiller
2018-09-08 17:07:07 +00:00
parent 26ef852a28
commit e1cbd13f82
3 changed files with 8 additions and 10 deletions

View File

@@ -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,
}

View File

@@ -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

View File

@@ -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)