mirror of
https://github.com/nmap/nmap.git
synced 2025-12-24 00:19:01 +00:00
Updated stdnse.tohex() to coerce strings to numbers if possible for the first
argument. That is, the first argument is interpretted as a number if possible.
This commit is contained in:
@@ -163,7 +163,7 @@ function tohex( s, options )
|
||||
local separator = options.separator
|
||||
local hex
|
||||
|
||||
if type( s ) == 'number' then
|
||||
if tonumber( s ) then
|
||||
hex = ("%x"):format(s)
|
||||
elseif type( s ) == 'string' then
|
||||
hex = ("%02x"):rep(#s):format(s:byte(1,#s))
|
||||
|
||||
Reference in New Issue
Block a user