mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 21:21:31 +00:00
more stdnse.print_debug -> stdnse.debug
This one also fixes format string bugs:
stdnse.print_debug(foo) --> stdnse.debug1("%s", foo)
$ sed -i 's/stdnse.print_debug( *\([a-zA-Z0-9][a-zA-Z0-9_]*\) *)/stdnse.debug1("%s", \1)/' *.nse
$ sed -i 's/stdnse.print_debug( *\([0-9]*\) *, *\([a-zA-Z0-9][a-zA-Z0-9_]*\) *)/stdnse.debug\1("%s", \2)/' *.nse
This commit is contained in:
@@ -97,7 +97,7 @@ action = function(host, port)
|
||||
|
||||
local status, response = afpHelper:OpenSession(host, port)
|
||||
if ( not status ) then
|
||||
stdnse.print_debug(response)
|
||||
stdnse.debug1("%s", response)
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ Directory traversal vulnerability in AFP Server in Apple Mac OS X before
|
||||
|
||||
status, response = afp_helper:OpenSession(host, port)
|
||||
if ( not(status) ) then
|
||||
stdnse.print_debug(response)
|
||||
stdnse.debug1("%s", response)
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ action = function(host, port)
|
||||
|
||||
status, response = afpHelper:OpenSession(host, port)
|
||||
if ( not status ) then
|
||||
stdnse.print_debug(response)
|
||||
stdnse.debug1("%s", response)
|
||||
return
|
||||
end
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ action = function(host, port)
|
||||
if ( status ) then
|
||||
table.insert(result, ("Successfully stored \"%s\" in %s"):format(username, filename) )
|
||||
else
|
||||
stdnse.print_debug( err )
|
||||
stdnse.debug1("%s", err)
|
||||
table.insert(result, ("Failed to store \"%s\" to %s"):format(username, filename) )
|
||||
end
|
||||
elseif( status and data ) then
|
||||
|
||||
@@ -303,7 +303,7 @@ action = function( host, port )
|
||||
local output_file = output_prefix .. "_" .. host.ip .. "_" .. port.number
|
||||
status, err = credTable:saveToFile(output_file,output_type)
|
||||
if not status then
|
||||
stdnse.print_debug(err)
|
||||
stdnse.debug1("%s", err)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -251,7 +251,7 @@ function action(host,port)
|
||||
local output_file = saveFile .. "_" .. host.ip .. "_" .. port.number .. ".csv"
|
||||
local save_status, save_err = ldap.searchResultToFile(searchResEntries,output_file)
|
||||
if not save_status then
|
||||
stdnse.print_debug(save_err)
|
||||
stdnse.debug1("%s", save_err)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -153,7 +153,7 @@ local get_version = function(host, port, token)
|
||||
else -- mingw compiler means it's a windows build
|
||||
os_type = "windows"
|
||||
end
|
||||
stdnse.print_debug(info)
|
||||
stdnse.debug1("%s", info)
|
||||
return info
|
||||
end
|
||||
end
|
||||
@@ -247,7 +247,7 @@ action = function( host, port )
|
||||
local console_id = create_console(host,port,token)
|
||||
if console_id then
|
||||
local read_data = read_console(host,port,token,console_id) -- first read the banner/ascii art
|
||||
stdnse.print_debug(2,read_data) -- print the nice looking banner if dbg level high enough :)
|
||||
stdnse.debug2("%s", read_data) -- print the nice looking banner if dbg level high enough :)
|
||||
if read_data then
|
||||
if os_type == "linux" then
|
||||
read_data = write_read_console(host,port,token,console_id, "uname -a")
|
||||
@@ -261,7 +261,7 @@ action = function( host, port )
|
||||
elseif os_type == "windows" then
|
||||
read_data = write_read_console(host,port,token,console_id, "systeminfo")
|
||||
if read_data then
|
||||
stdnse.print_debug(2,read_data) -- print whole info if dbg level high enough
|
||||
stdnse.debug2("%s", read_data) -- print whole info if dbg level high enough
|
||||
local stop = string.find(read_data,"Hotfix") -- trim data down , systeminfo return A LOT
|
||||
read_data = string.sub(read_data,1,stop-2)
|
||||
info = info .. "\nAdditional info: \n" .. read_data
|
||||
|
||||
@@ -186,7 +186,7 @@ local function process_instance( instance )
|
||||
query = query:format( v[1], v[1], v[1], tbl_limit, v[1], keywords_filter)
|
||||
status, tables = helper:Query( query )
|
||||
if ( not(status) ) then
|
||||
stdnse.print_debug(tables)
|
||||
stdnse.debug1("%s", tables)
|
||||
else
|
||||
local item = {}
|
||||
item = mssql.Util.FormatOutputTable( tables, true )
|
||||
|
||||
@@ -44,7 +44,7 @@ action = function( host, port )
|
||||
|
||||
status, response = mysql.receiveGreeting( socket )
|
||||
if ( not(status) ) then
|
||||
stdnse.print_debug(3, SCRIPT_NAME)
|
||||
stdnse.debug3("%s", SCRIPT_NAME)
|
||||
socket:close()
|
||||
return response
|
||||
end
|
||||
|
||||
@@ -64,7 +64,7 @@ categories = {"discovery", "safe"}
|
||||
|
||||
hostrule = function(host) return smb.get_port(host) ~= nil end
|
||||
|
||||
local function log(msg) stdnse.print_debug(3, msg) end
|
||||
local function log(msg) stdnse.debug3("%s", msg) end
|
||||
|
||||
ServerTypes = {
|
||||
SV_TYPE_WORKSTATION = 0x00000001,
|
||||
|
||||
@@ -111,7 +111,7 @@ action = function(host, port)
|
||||
local path = stdnse.get_script_args("ssl-known-key.fingerprintfile") or FINGERPRINT_FILE
|
||||
local status, result = get_fingerprints(path)
|
||||
if not status then
|
||||
stdnse.print_debug(1, result)
|
||||
stdnse.debug1("%s", result)
|
||||
return
|
||||
end
|
||||
local fingerprints = result
|
||||
|
||||
Reference in New Issue
Block a user