mirror of
https://github.com/nmap/nmap.git
synced 2026-01-04 13:49:03 +00:00
Replace msrpc.random_crap with stdnse.generate_random_string
This commit is contained in:
@@ -5083,21 +5083,4 @@ function get_pad(data, align, pad_byte)
|
||||
return string.rep(pad_byte, (align-#data%align)%align)
|
||||
end
|
||||
|
||||
--####################################################################--
|
||||
---Generates a random string of the requested length.
|
||||
--@param length The length of the string to return.
|
||||
--@param charset The set of letters to choose from. Default: ASCII letters and numbers
|
||||
--@return The random string.
|
||||
--####################################################################--
|
||||
function random_crap(length, charset)
|
||||
charset = charset or "0123456789abcdefghijklmnoprstuvzxwyABCDEFGHIJKLMNOPRSTUVZXWY"
|
||||
local random_str = ""
|
||||
for i = 1, length, 1 do
|
||||
local random = math.random(#charset)
|
||||
random_str = random_str .. string.sub(charset, random, random)
|
||||
end
|
||||
return random_str
|
||||
end
|
||||
|
||||
|
||||
return _ENV;
|
||||
|
||||
@@ -168,14 +168,10 @@ local function empty(t)
|
||||
return not next(t)
|
||||
end
|
||||
|
||||
local function random_string()
|
||||
return msrpc.random_crap(8,"etaoinshrdlucmfw")
|
||||
end
|
||||
|
||||
-- generate a random hash with domains suffix
|
||||
-- return both domain and its hash
|
||||
local function generate_hash(domain, iter, salt)
|
||||
local rand_str = random_string()
|
||||
local rand_str = stdnse.generate_random_string(8, "etaoinshrdlucmfw")
|
||||
local random_domain = rand_str .. "." .. domain
|
||||
local packed_domain = {}
|
||||
for word in string.gmatch(random_domain, "[^%.]+") do
|
||||
@@ -239,7 +235,7 @@ local function enum(host, port, domain)
|
||||
local todo = {}
|
||||
local dnssec, status, result = false, false, "No Answer"
|
||||
local result = {}
|
||||
local subdomain = msrpc.random_crap(8,"etaoinshrdlucmfw")
|
||||
local subdomain = stdnse.generate_random_string(8, "etaoinshrdlucmfw")
|
||||
local full_domain = join({subdomain, domain})
|
||||
local iter
|
||||
local salt
|
||||
|
||||
@@ -474,9 +474,9 @@ function check_ms06_025(host)
|
||||
end
|
||||
local req, buff, sr_result
|
||||
req = msrpc.RRAS_marshall_RequestBuffer(
|
||||
0x01,
|
||||
msrpc.RRAS_RegTypes['GETDEVCONFIG'],
|
||||
msrpc.random_crap(3000))
|
||||
0x01,
|
||||
msrpc.RRAS_RegTypes['GETDEVCONFIG'],
|
||||
stdnse.generate_random_string(3000, "0123456789abcdefghijklmnoprstuvzxwyABCDEFGHIJKLMNOPRSTUVZXWY"))
|
||||
status, sr_result = msrpc.RRAS_SubmitRequest(smbstate, req)
|
||||
msrpc.stop_smb(smbstate)
|
||||
--sanity check
|
||||
|
||||
Reference in New Issue
Block a user