mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 12:41:29 +00:00
Set the math.randomseed value in nse_main.lua on behalf of scripts.
Since Lua uses the C rand and srand functions, which have a static seed for the entire program, we don't want scripts doing this themselves.
This commit is contained in:
@@ -79,13 +79,6 @@ local function get_random_string(length, set)
|
||||
|
||||
local str = ""
|
||||
|
||||
-- Seed the random number, if we haven't already
|
||||
if (not(nmap.registry.oracle_enum_users) or not(nmap.registry.oracle_enum_users.seeded)) then
|
||||
math.randomseed(os.time())
|
||||
nmap.registry.oracle_enum_users = {}
|
||||
nmap.registry.oracle_enum_users.seeded = true
|
||||
end
|
||||
|
||||
for i = 1, length, 1 do
|
||||
local random = math.random(#set)
|
||||
str = str .. string.sub(set, random, random)
|
||||
|
||||
Reference in New Issue
Block a user