From a084340b6d3c2975baa9a43a5a05b69be9637149 Mon Sep 17 00:00:00 2001 From: dmiller Date: Thu, 13 Feb 2014 15:47:41 +0000 Subject: [PATCH] Remove useless calls to string.format stdnse.print_debug accepts a format string and arguments, making string.format redundant in calls of this form: stdnse.print_debug(1, string.format("%s: error", SCRIPT_NAME)) stdnse.print_debug(("length %d"):format(#tab)) These can be rewritten as: stdnse.print_debug(1, "%s: error", SCRIPT_NAME) stdnse.print_debug("length %d", #tab) --- nselib/dnsbl.lua | 7 +- nselib/ldap.lua | 6 +- nselib/mongodb.lua | 2 +- nselib/msrpc.lua | 4 +- nselib/msrpctypes.lua | 564 ++++++++++----------- nselib/pgsql.lua | 6 +- nselib/smb.lua | 4 +- scripts/acarsd-info.nse | 8 +- scripts/afp-brute.nse | 2 +- scripts/daap-get-library.nse | 4 +- scripts/db2-das-info.nse | 16 +- scripts/flume-master-info.nse | 39 +- scripts/ganglia-info.nse | 8 +- scripts/hadoop-datanode-info.nse | 8 +- scripts/hadoop-jobtracker-info.nse | 40 +- scripts/hadoop-namenode-info.nse | 34 +- scripts/hadoop-secondary-namenode-info.nse | 24 +- scripts/hadoop-tasktracker-info.nse | 12 +- scripts/hbase-master-info.nse | 28 +- scripts/hbase-region-info.nse | 16 +- scripts/http-barracuda-dir-traversal.nse | 4 +- scripts/http-qnap-nas-info.nse | 4 +- scripts/ldap-search.nse | 4 +- scripts/modbus-discover.nse | 4 +- scripts/pgsql-brute.nse | 2 +- scripts/qconn-exec.nse | 10 +- scripts/tftp-enum.nse | 10 +- 27 files changed, 440 insertions(+), 430 deletions(-) diff --git a/nselib/dnsbl.lua b/nselib/dnsbl.lua index ab4d2ee39..833ca4291 100644 --- a/nselib/dnsbl.lua +++ b/nselib/dnsbl.lua @@ -385,8 +385,9 @@ SERVICES = { if ( octet1 ~= 127 ) then -- This should'nt happen :P - stdnse.print_debug(string.format( - "The request made to dnsbl.httpbl.org was considered invalid (%i)", octet1)) + stdnse.print_debug( + "The request made to dnsbl.httpbl.org was considered invalid (%i)", + octet1) elseif ( "short" == self.mode ) then return { state = "ATTACK" } else @@ -625,7 +626,7 @@ Helper = { local svc_result = svc:resp_parser(answer) if ( not(svc_result) ) then local resp = ( #answer > 0 and ("UNKNOWN (%s)"):format(answer[1]) or "UNKNOWN" ) - stdnse.print_debug(2, ("%s received %s"):format(name, resp)) + stdnse.print_debug(2, "%s received %s", name, resp) end if ( svc_result ) then diff --git a/nselib/ldap.lua b/nselib/ldap.lua index 9ece48ef4..3102d2940 100644 --- a/nselib/ldap.lua +++ b/nselib/ldap.lua @@ -222,7 +222,7 @@ end function searchRequest( socket, params ) local searchResEntries = { errorMessage="", resultCode = 0} - local catch = function() socket:close() stdnse.print_debug(string.format("SearchRequest failed")) end + local catch = function() socket:close() stdnse.print_debug("SearchRequest failed") end local try = nmap.new_try(catch) local attributes = params.attributes local request = encode(params.baseObject) @@ -340,7 +340,7 @@ end -- @return err string containing error message function bindRequest( socket, params ) - local catch = function() socket:close() stdnse.print_debug(string.format("bindRequest failed")) end + local catch = function() socket:close() stdnse.print_debug("bindRequest failed") end local try = nmap.new_try(catch) local ldapAuth = encode( { _ldaptype = 80, params.password } ) local bindReq = encode( params.version ) .. encode( params.username ) .. ldapAuth @@ -393,7 +393,7 @@ end function unbindRequest( socket ) local ldapMsg, packet - local catch = function() socket:close() stdnse.print_debug(string.format("bindRequest failed")) end + local catch = function() socket:close() stdnse.print_debug("bindRequest failed") end local try = nmap.new_try(catch) local encoder = asn1.ASN1Encoder:new() diff --git a/nselib/mongodb.lua b/nselib/mongodb.lua index cd00ed9f1..d98c21c11 100644 --- a/nselib/mongodb.lua +++ b/nselib/mongodb.lua @@ -558,7 +558,7 @@ function query(socket, data) --Create an error handler local catch = function() socket:close() - stdnse.print_debug(string.format("Query failed")) + stdnse.print_debug("Query failed") end local try = nmap.new_try(catch) diff --git a/nselib/msrpc.lua b/nselib/msrpc.lua index 5b3ea084b..8dc42c715 100644 --- a/nselib/msrpc.lua +++ b/nselib/msrpc.lua @@ -3926,7 +3926,7 @@ function lsa_enum_users(host) status, lookupsids2_result = lsa_lookupsids2(smbstate, openpolicy2_result['policy_handle'], sids) if(status == false) then - stdnse.print_debug(1, string.format("Error looking up RIDs: %s", lookupsids2_result)) + stdnse.print_debug(1, "Error looking up RIDs: %s", lookupsids2_result) else -- Put the details for each name into an array -- NOTE: Be sure to mirror any changes here in the next bit! @@ -3960,7 +3960,7 @@ function lsa_enum_users(host) -- Try converting this group of RIDs into names status, lookupsids2_result = lsa_lookupsids2(smbstate, openpolicy2_result['policy_handle'], sids) if(status == false) then - stdnse.print_debug(1, string.format("Error looking up RIDs: %s", lookupsids2_result)) + stdnse.print_debug(1, "Error looking up RIDs: %s", lookupsids2_result) else -- Put the details for each name into an array for j = 1, #lookupsids2_result['names']['names'], 1 do diff --git a/nselib/msrpctypes.lua b/nselib/msrpctypes.lua index 8005d67cd..2d752424d 100644 --- a/nselib/msrpctypes.lua +++ b/nselib/msrpctypes.lua @@ -176,7 +176,7 @@ function unicode_to_string(buffer, pos, length, do_null) local i, j, ch, dummy local string = "" - stdnse.print_debug(4, string.format("MSRPC: Entering unicode_to_string(pos = %d, length = %d)", pos, length)) + stdnse.print_debug(4, "MSRPC: Entering unicode_to_string(pos = %d, length = %d)", pos, length) if(do_null == nil) then do_null = false @@ -260,7 +260,7 @@ end local function marshall_ptr(location, func, args, value) local result = "" - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_ptr(location = %s)", location)) + stdnse.print_debug(4, "MSRPC: Entering marshall_ptr(location = %s)", location) -- If we're marshalling the HEAD section, add a REFERENT_ID. if(location == HEAD or location == ALL) then @@ -280,7 +280,7 @@ local function marshall_ptr(location, func, args, value) end end - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_ptr()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_ptr()") return result end @@ -314,7 +314,7 @@ end -- for valid pointers or false for null pointers. For BODY or ALL, the result is -- nil for null pointers, or the data for valid pointers. local function unmarshall_ptr(location, data, pos, func, args, result) - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_ptr()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_ptr()") if(args == nil) then args = {} end @@ -372,7 +372,7 @@ end --@return A string representing the marshalled data. local function marshall_basetype(location, func, args) local result - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_basetype()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_basetype()") if(location == HEAD or location == ALL) then result = bin.pack("data, and a table representing the datatype. local function unmarshall_guid(data, pos) local guid = {} - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_guid()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_guid()") pos, guid['time_low'], guid['time_high'], guid['time_hi_and_version'], guid['clock_seq'], guid['node'] = bin.unpack("data, and a table representing the datatype. function unmarshall_policy_handle(data, pos) local policy_handle = {} - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_policy_handle()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_policy_handle()") pos, policy_handle['handle_type'] = unmarshall_int32(data, pos) pos, policy_handle['uuid'] = unmarshall_guid(data, pos) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_policy_handle()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_policy_handle()") return pos, policy_handle end @@ -1568,7 +1568,7 @@ function marshall_dom_sid2(sid) local pos_next local sid_array = {} local result = "" - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_dom_sid2()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_dom_sid2()") if(string.find(sid, "^S%-") == nil) then @@ -1610,7 +1610,7 @@ function marshall_dom_sid2(sid) result = result .. bin.pack("nil if it wasn't found. function lsa_SidType_tostr(val) local result - stdnse.print_debug(4, string.format("MSRPC: Entering lsa_SidType_tostr()")) + stdnse.print_debug(4, "MSRPC: Entering lsa_SidType_tostr()") result = lsa_SidType_str[val] - stdnse.print_debug(4, string.format("MSRPC: Leaving lsa_SidType_tostr()")) + stdnse.print_debug(4, "MSRPC: Leaving lsa_SidType_tostr()") return result end @@ -1879,11 +1879,11 @@ local lsa_LookupNamesLevel_str = -- found. function marshall_lsa_LookupNamesLevel(names_level) local result - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_lsa_LookupNamesLevel()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_lsa_LookupNamesLevel()") result = marshall_Enum32(names_level, lsa_LookupNamesLevel) - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_lsa_LookupNamesLevel()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_lsa_LookupNamesLevel()") return result end @@ -1894,11 +1894,11 @@ end --@return (pos, str) The new position, and the string representing the datatype. function unmarshall_lsa_LookupNamesLevel(data, pos) local str - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_lsa_LookupNamesLevel()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_lsa_LookupNamesLevel()") pos, str = unmarshall_Enum32(data, pos, lsa_LookupNamesLevel) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_lsa_LookupNamesLevel()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_lsa_LookupNamesLevel()") return pos, str end @@ -1909,11 +1909,11 @@ end --@return A string suitable for displaying to the user, or nil if it wasn't found. function lsa_LookupNamesLevel_tostr(val) local result - stdnse.print_debug(4, string.format("MSRPC: Entering lsa_LookupNamesLevel_tostr()")) + stdnse.print_debug(4, "MSRPC: Entering lsa_LookupNamesLevel_tostr()") result = lsa_LookupNamesLevel_str[val] - stdnse.print_debug(4, string.format("MSRPC: Leaving lsa_LookupNamesLevel_tostr()")) + stdnse.print_debug(4, "MSRPC: Leaving lsa_LookupNamesLevel_tostr()") return result end @@ -1939,7 +1939,7 @@ end --@return A string representing the marshalled data. local function marshall_lsa_TranslatedSid2(location, sid_type, rid, sid_index, unknown) local result = "" - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_lsa_TranslatedSid2()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_lsa_TranslatedSid2()") -- Set some default values if(sid_type == nil) then sid_type = "SID_NAME_USE_NONE" end @@ -1957,7 +1957,7 @@ local function marshall_lsa_TranslatedSid2(location, sid_type, rid, sid_index, u if(location == BODY or location == ALL) then end - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_lsa_TranslatedSid2()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_lsa_TranslatedSid2()") return result end @@ -2024,7 +2024,7 @@ end --@return A string representing the marshalled data. local function marshall_lsa_TranslatedName2(location, sid_type, name, sid_index, unknown) local result = "" - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_lsa_TranslatedName2()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_lsa_TranslatedName2()") -- Set some default values if(sid_type == nil) then sid_type = "SID_NAME_USE_NONE" end @@ -2043,7 +2043,7 @@ local function marshall_lsa_TranslatedName2(location, sid_type, name, sid_index, result = result .. marshall_lsa_String_internal(BODY, name) end - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_lsa_TranslatedName2()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_lsa_TranslatedName2()") return result end @@ -2059,7 +2059,7 @@ end -- anything. --@return (pos, result) The new position in data, and a table representing the datatype. local function unmarshall_lsa_TranslatedName2(location, data, pos, result) - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_lsa_TranslatedName2()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_lsa_TranslatedName2()") if(result == nil) then result = {} end @@ -2076,7 +2076,7 @@ local function unmarshall_lsa_TranslatedName2(location, data, pos, result) pos, result['name'] = unmarshall_lsa_String_internal(BODY, data, pos, result['name']) end - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_lsa_TranslatedName2()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_lsa_TranslatedName2()") return pos, result end @@ -2095,7 +2095,7 @@ end function marshall_lsa_TransSidArray2(sids) local result = "" local array = {} - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_lsa_TransSidArray2()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_lsa_TransSidArray2()") result = result .. marshall_int32(#sids) @@ -2107,7 +2107,7 @@ function marshall_lsa_TransSidArray2(sids) result = result .. marshall_ptr(ALL, marshall_array, {array}, array) - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_lsa_TransSidArray2()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_lsa_TransSidArray2()") return result end @@ -2135,7 +2135,7 @@ end local function unmarshall_lsa_StringLarge(location, data, pos, result) local length, size local str - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_lsa_StringLarge()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_lsa_StringLarge()") if(location == HEAD or location == ALL) then pos, length = unmarshall_int16(data, pos, false) @@ -2148,7 +2148,7 @@ local function unmarshall_lsa_StringLarge(location, data, pos, result) pos, str = unmarshall_ptr(BODY, data, pos, unmarshall_unicode, {false}, result) end - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_lsa_StringLarge()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_lsa_StringLarge()") return pos, str end @@ -2173,7 +2173,7 @@ end -- anything. --@return (pos, result) The new position in data, and a table representing the datatype. local function unmarshall_lsa_DomainInfo(location, data, pos, result) - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_lsa_DomainInfo()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_lsa_DomainInfo()") if(result == nil) then result = {} end @@ -2188,7 +2188,7 @@ local function unmarshall_lsa_DomainInfo(location, data, pos, result) pos, result['sid'] = unmarshall_ptr(BODY, data, pos, unmarshall_dom_sid2, {}, result['sid']) end - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_lsa_DomainInfo()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_lsa_DomainInfo()") return pos, result end @@ -2207,7 +2207,7 @@ end --@return (pos, result) The new position in data, and a table representing the datatype. function unmarshall_lsa_RefDomainList(data, pos) local result = {} - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_lsa_RefDomainList()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_lsa_RefDomainList()") -- Head pos, result['count'] = unmarshall_int32(data, pos) @@ -2217,7 +2217,7 @@ function unmarshall_lsa_RefDomainList(data, pos) -- Body pos, result['domains'] = unmarshall_ptr(BODY, data, pos, unmarshall_array, {result['count'], unmarshall_lsa_DomainInfo, {}}, result['domains']) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_lsa_RefDomainList()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_lsa_RefDomainList()") return pos, result end @@ -2229,11 +2229,11 @@ end --@return (pos, result) The new position in data, and a table representing the datatype. function unmarshall_lsa_RefDomainList_ptr(data, pos) local result - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_lsa_RefDomainList_ptr()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_lsa_RefDomainList_ptr()") pos, result = unmarshall_ptr(ALL, data, pos, unmarshall_lsa_RefDomainList, nil) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_lsa_RefDomainList_ptr()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_lsa_RefDomainList_ptr()") return pos, result end @@ -2251,12 +2251,12 @@ end --@return (pos, result) The new position in data, and a table representing the datatype. function unmarshall_lsa_TransSidArray2(data, pos) local result = {} - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_lsa_TransSidArray2()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_lsa_TransSidArray2()") pos, result['count'] = unmarshall_int32(data, pos) pos, result['sid'] = unmarshall_ptr(ALL, data, pos, unmarshall_array, {result['count'], unmarshall_lsa_TranslatedSid2, {}}) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_lsa_TransSidArray2()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_lsa_TransSidArray2()") return pos, result end @@ -2277,14 +2277,14 @@ end --@return A string representing the marshalled data. function marshall_lsa_QosInfo() local result = "" - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_lsa_QosInfo()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_lsa_QosInfo()") result = result .. marshall_int32(12) result = result .. marshall_int16(2, false) result = result .. marshall_int8(1, false) result = result .. marshall_int8(0, false) - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_lsa_QosInfo()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_lsa_QosInfo()") return result end @@ -2307,7 +2307,7 @@ end --@return A string representing the marshalled data. function marshall_lsa_ObjectAttribute() local result = "" - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_lsa_ObjectAttribute()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_lsa_ObjectAttribute()") result = result .. marshall_int32(24) result = result .. marshall_int32(0) -- Null'ing out these pointers for now. Maybe we'll need them in the future... @@ -2316,7 +2316,7 @@ function marshall_lsa_ObjectAttribute() result = result .. marshall_int32(0) result = result .. marshall_ptr(ALL, marshall_lsa_QosInfo, {}) - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_lsa_ObjectAttribute()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_lsa_ObjectAttribute()") return result end @@ -2336,11 +2336,11 @@ end --@return A string representing the marshalled data. local function marshall_lsa_SidPtr(location, sid) local result - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_lsa_SidPtr()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_lsa_SidPtr()") result = marshall_ptr(location, marshall_dom_sid2, {sid}, sid) - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_lsa_SidPtr()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_lsa_SidPtr()") return result end @@ -2425,7 +2425,7 @@ end function marshall_lsa_TransNameArray2(names) local result = "" local array = {} - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_lsa_TransNameArray2()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_lsa_TransNameArray2()") if(names == nil) then result = result .. marshall_int32(0) @@ -2442,7 +2442,7 @@ function marshall_lsa_TransNameArray2(names) result = result .. marshall_ptr(ALL, marshall_array, {array}, array) - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_lsa_TransNameArray2()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_lsa_TransNameArray2()") return result end @@ -2454,12 +2454,12 @@ end --@return (pos, result) The new position in data, and a table representing the datatype. function unmarshall_lsa_TransNameArray2(data, pos) local result = {} - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_lsa_TransNameArray2()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_lsa_TransNameArray2()") pos, result['count'] = unmarshall_int32(data, pos) pos, result['names'] = unmarshall_ptr(ALL, data, pos, unmarshall_array, {result['count'], unmarshall_lsa_TranslatedName2, {}}) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_lsa_TransNameArray2()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_lsa_TransNameArray2()") return pos, result end @@ -2509,11 +2509,11 @@ local winreg_AccessMask_str = --@return A string representing the marshalled data. function marshall_winreg_AccessMask(accessmask) local result - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_winreg_AccessMask()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_winreg_AccessMask()") result = marshall_Enum32(accessmask, winreg_AccessMask) - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_winreg_AccessMask()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_winreg_AccessMask()") return result end @@ -2524,11 +2524,11 @@ end --@return (pos, str) The new position, and the string representing the datatype. function unmarshall_winreg_AccessMask(data, pos) local str - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_winreg_AccessMask()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_winreg_AccessMask()") pos, str = unmarshall_Enum32(data, pos, winreg_AccessMask) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_winreg_AccessMask()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_winreg_AccessMask()") return pos, str end @@ -2539,11 +2539,11 @@ end --@return A string suitable for displaying to the user, or nil if it wasn't found. function winreg_AccessMask_tostr(val) local result - stdnse.print_debug(4, string.format("MSRPC: Entering winreg_AccessMask_tostr()")) + stdnse.print_debug(4, "MSRPC: Entering winreg_AccessMask_tostr()") result = winreg_AccessMask_str[val] - stdnse.print_debug(4, string.format("MSRPC: Leaving winreg_AccessMask_tostr()")) + stdnse.print_debug(4, "MSRPC: Leaving winreg_AccessMask_tostr()") return result end @@ -2589,11 +2589,11 @@ winreg_Type_str = -- found. function marshall_winreg_Type(winregtype) local result - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_winreg_Type()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_winreg_Type()") result = marshall_Enum32(winregtype, winreg_Type) - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_winreg_Type()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_winreg_Type()") return result end @@ -2604,11 +2604,11 @@ end --@return (pos, str) The new position, and the string representing the datatype. function unmarshall_winreg_Type(data, pos) local str - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_winreg_Type()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_winreg_Type()") pos, str = unmarshall_Enum32(data, pos, winreg_Type) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_winreg_Type()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_winreg_Type()") return pos, str end @@ -2620,11 +2620,11 @@ end -- found. function marshall_winreg_Type_ptr(winreg_type) local result - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_winreg_Type_ptr()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_winreg_Type_ptr()") result = marshall_ptr(ALL, marshall_winreg_Type, {winreg_type}, winreg_type) - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_winreg_Type_ptr()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_winreg_Type_ptr()") return result end @@ -2635,11 +2635,11 @@ end --@return (pos, str) The new position, and the string representing the datatype. function unmarshall_winreg_Type_ptr(data, pos) local str - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_winreg_Type_ptr()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_winreg_Type_ptr()") pos, str = unmarshall_ptr(ALL, data, pos, unmarshall_winreg_Type, {}) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_winreg_Type_ptr()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_winreg_Type_ptr()") return pos, str end @@ -2650,11 +2650,11 @@ end --@return A string suitable for displaying to the user, or nil if it wasn't found. function winreg_Type_tostr(val) local result - stdnse.print_debug(4, string.format("MSRPC: Entering winreg_Type_tostr()")) + stdnse.print_debug(4, "MSRPC: Entering winreg_Type_tostr()") result = winreg_Type_str[val] - stdnse.print_debug(4, string.format("MSRPC: Leaving winreg_Type_tostr()")) + stdnse.print_debug(4, "MSRPC: Leaving winreg_Type_tostr()") return result end @@ -2677,7 +2677,7 @@ end --@return A string representing the marshalled data. function marshall_winreg_StringBuf(table, max_length) local result - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_winreg_StringBuf()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_winreg_StringBuf()") local name = table['name'] local length @@ -2705,7 +2705,7 @@ function marshall_winreg_StringBuf(table, max_length) result = bin.pack("nil if it wasn't found. function srvsvc_ShareType_tostr(val) local result - stdnse.print_debug(4, string.format("MSRPC: Entering srvsvc_ShareType_tostr()")) + stdnse.print_debug(4, "MSRPC: Entering srvsvc_ShareType_tostr()") result = srvsvc_ShareType_str[val] - stdnse.print_debug(4, string.format("MSRPC: Leaving srvsvc_ShareType_tostr()")) + stdnse.print_debug(4, "MSRPC: Leaving srvsvc_ShareType_tostr()") return result end @@ -2890,11 +2890,11 @@ end --@return A string representing the marshalled data. local function marshall_srvsvc_NetShareInfo0(location, name) local result - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_srvsvc_NetShareInfo0()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_srvsvc_NetShareInfo0()") result = marshall_ptr(location, marshall_unicode, {name, true}, name) - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_srvsvc_NetShareInfo0()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_srvsvc_NetShareInfo0()") return result end @@ -2912,7 +2912,7 @@ end -- anything. --@return (pos, result) The new position in data, and a table representing the datatype. local function unmarshall_srvsvc_NetShareInfo0(location, data, pos, result) - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_srvsvc_NetShareInfo0()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_srvsvc_NetShareInfo0()") if(result == nil) then result = {} end @@ -2925,7 +2925,7 @@ local function unmarshall_srvsvc_NetShareInfo0(location, data, pos, result) pos, result['name'] = unmarshall_ptr(BODY, data, pos, unmarshall_unicode, {true}, result['name']) end - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_srvsvc_NetShareInfo0()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_srvsvc_NetShareInfo0()") return pos, result end @@ -2949,14 +2949,14 @@ end --@return A string representing the marshalled data. local function marshall_srvsvc_NetShareInfo1(location, name, sharetype, comment) local result - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_srvsvc_NetShareInfo1()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_srvsvc_NetShareInfo1()") local name = marshall_ptr(location, marshall_unicode, {name, true}, name) local sharetype = marshall_basetype(location, marshall_srvsvc_ShareType, {sharetype}) local comment = marshall_ptr(location, marshall_unicode, {comment, true}, comment) result = bin.pack("data, and a table representing the datatype. local function unmarshall_srvsvc_NetShareInfo1(location, data, pos, result) - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_srvsvc_NetShareInfo1()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_srvsvc_NetShareInfo1()") if(result == nil) then result = {} end @@ -2991,7 +2991,7 @@ local function unmarshall_srvsvc_NetShareInfo1(location, data, pos, result) pos, result['comment'] = unmarshall_ptr(BODY, data, pos, unmarshall_unicode, {true}, result['comment']) end - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_srvsvc_NetShareInfo1()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_srvsvc_NetShareInfo1()") return pos, result end @@ -3026,7 +3026,7 @@ end --@return A string representing the marshalled data. local function marshall_srvsvc_NetShareInfo2(location, name, sharetype, comment, permissions, max_users, current_users, path, password) local result - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_srvsvc_NetShareInfo2()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_srvsvc_NetShareInfo2()") local name = marshall_ptr(location, marshall_unicode, {name, true}, name) local sharetype = marshall_basetype(location, marshall_srvsvc_ShareType, {sharetype}) local comment = marshall_ptr(location, marshall_unicode, {comment, true}, comment) @@ -3038,7 +3038,7 @@ local function marshall_srvsvc_NetShareInfo2(location, name, sharetype, comment, result = name .. sharetype .. comment .. permissions .. max_users .. current_users .. path .. password - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_srvsvc_NetShareInfo2()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_srvsvc_NetShareInfo2()") return result end @@ -3057,7 +3057,7 @@ end -- anything. --@return (pos, result) The new position in data, and a table representing the datatype. local function unmarshall_srvsvc_NetShareInfo2(location, data, pos, result) - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_srvsvc_NetShareInfo2()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_srvsvc_NetShareInfo2()") if(result == nil) then result = {} end @@ -3080,7 +3080,7 @@ local function unmarshall_srvsvc_NetShareInfo2(location, data, pos, result) pos, result['password'] = unmarshall_ptr(BODY, data, pos, unmarshall_unicode, {true}, result['password']) end - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_srvsvc_NetShareInfo2()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_srvsvc_NetShareInfo2()") return pos, result end @@ -3098,7 +3098,7 @@ end function marshall_srvsvc_NetShareCtr0(NetShareCtr0) local i local result = "" - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_srvsvc_NetShareCtr0()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_srvsvc_NetShareCtr0()") if(NetShareCtr0 == nil) then result = result .. bin.pack("data, and a table representing the datatype. local function unmarshall_srvsvc_NetSessInfo10(location, data, pos, result) - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_srvsvc_NetSessInfo10()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_srvsvc_NetSessInfo10()") if(result == nil) then result = {} end @@ -3414,7 +3414,7 @@ local function unmarshall_srvsvc_NetSessInfo10(location, data, pos, result) pos, result['user'] = unmarshall_ptr(BODY, data, pos, unmarshall_unicode, {true}, result['user']) end - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_srvsvc_NetSessInfo10()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_srvsvc_NetSessInfo10()") return pos, result end @@ -3432,7 +3432,7 @@ end function marshall_srvsvc_NetSessCtr10(NetSessCtr10) local i local result = "" - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_srvsvc_NetSessCtr10()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_srvsvc_NetSessCtr10()") if(NetSessCtr10 == nil) then result = result .. bin.pack("data, and a table representing the datatype. function unmarshall_srvsvc_Statistics(data, pos) local response = {} - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_srvsvc_Statistics()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_srvsvc_Statistics()") pos, response['start'] = unmarshall_int32(data, pos) pos, response['fopens'] = unmarshall_int32(data, pos) @@ -3590,7 +3590,7 @@ function unmarshall_srvsvc_Statistics(data, pos) pos, response['reqbufneed'] = unmarshall_int32(data, pos) pos, response['bigbufneed'] = unmarshall_int32(data, pos) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_srvsvc_Statistics()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_srvsvc_Statistics()") return pos, response end @@ -3604,11 +3604,11 @@ end --@return (pos, result) The new position in data, and a table representing the datatype. function unmarshall_srvsvc_Statistics_ptr(data, pos) local result - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_srvsvc_Statistics_ptr()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_srvsvc_Statistics_ptr()") pos, result = unmarshall_ptr(ALL, data, pos, unmarshall_srvsvc_Statistics, {}) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_srvsvc_Statistics_ptr()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_srvsvc_Statistics_ptr()") return pos, result end @@ -3646,11 +3646,11 @@ local samr_ConnectAccessMask_str = -- found. function marshall_samr_ConnectAccessMask(accessmask) local result - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_samr_ConnectAccessMask()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_samr_ConnectAccessMask()") result = marshall_Enum32(accessmask, samr_ConnectAccessMask) - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_samr_ConnectAccessMask()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_samr_ConnectAccessMask()") return result end @@ -3661,11 +3661,11 @@ end --@return (pos, result) The new position in data, and a table representing the datatype. function unmarshall_samr_ConnectAccessMask(data, pos) local result - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_samr_ConnectAccessMask()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_samr_ConnectAccessMask()") pos, result = unmarshall_Enum32(data, pos, samr_ConnectAccessMask) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_samr_ConnectAccessMask()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_samr_ConnectAccessMask()") return pos, result end @@ -3676,11 +3676,11 @@ end --@return A string suitable for displaying to the user, or nil if it wasn't found. function samr_ConnectAccessMask_tostr(val) local result - stdnse.print_debug(4, string.format("MSRPC: Entering samr_ConnectAccessMask_tostr()")) + stdnse.print_debug(4, "MSRPC: Entering samr_ConnectAccessMask_tostr()") result = samr_ConnectAccessMask_str[val] - stdnse.print_debug(4, string.format("MSRPC: Leaving samr_ConnectAccessMask_tostr()")) + stdnse.print_debug(4, "MSRPC: Leaving samr_ConnectAccessMask_tostr()") return result end @@ -3721,11 +3721,11 @@ local samr_DomainAccessMask_str = -- found. function marshall_samr_DomainAccessMask(accessmask) local result - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_samr_DomainAccessMask()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_samr_DomainAccessMask()") result = marshall_Enum32(accessmask, samr_DomainAccessMask) - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_samr_DomainAccessMask()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_samr_DomainAccessMask()") return result end @@ -3736,11 +3736,11 @@ end --@return (pos, result) The new position in data, and a table representing the datatype. function unmarshall_samr_DomainAccessMask(data, pos) local result - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_samr_DomainAccessMask()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_samr_DomainAccessMask()") pos, result = unmarshall_Enum32(data, pos, samr_DomainAccessMask) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_samr_DomainAccessMask()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_samr_DomainAccessMask()") return pos, result end @@ -3751,11 +3751,11 @@ end --@return A string suitable for displaying to the user, or nil if it wasn't found. function samr_DomainAccessMask_tostr(val) local result - stdnse.print_debug(4, string.format("MSRPC: Entering samr_DomainAccessMask_tostr()")) + stdnse.print_debug(4, "MSRPC: Entering samr_DomainAccessMask_tostr()") result = samr_DomainAccessMask_str[val] - stdnse.print_debug(4, string.format("MSRPC: Leaving samr_DomainAccessMask_tostr()")) + stdnse.print_debug(4, "MSRPC: Leaving samr_DomainAccessMask_tostr()") return result end @@ -3814,11 +3814,11 @@ local samr_AcctFlags_str = -- found. function marshall_samr_AcctFlags(flags) local result - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_samr_AcctFlags()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_samr_AcctFlags()") result = marshall_Enum32(flags, samr_AcctFlags) - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_samr_AcctFlags()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_samr_AcctFlags()") return result end @@ -3829,11 +3829,11 @@ end --@return (pos, str) The new position, and the string representing the datatype. function unmarshall_samr_AcctFlags(data, pos) local str - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_samr_AcctFlags()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_samr_AcctFlags()") pos, str = unmarshall_Enum32_array(data, pos, samr_AcctFlags) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_samr_AcctFlags()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_samr_AcctFlags()") return pos, str end @@ -3844,11 +3844,11 @@ end --@return A string suitable for displaying to the user, or nil if it wasn't found. function samr_AcctFlags_tostr(val) local result - stdnse.print_debug(4, string.format("MSRPC: Entering samr_AcctFlags_tostr()")) + stdnse.print_debug(4, "MSRPC: Entering samr_AcctFlags_tostr()") result = samr_AcctFlags_str[val] - stdnse.print_debug(4, string.format("MSRPC: Leaving samr_AcctFlags_tostr()")) + stdnse.print_debug(4, "MSRPC: Leaving samr_AcctFlags_tostr()") return result end @@ -3879,11 +3879,11 @@ local samr_PasswordProperties_str = -- found. function marshall_samr_PasswordProperties(properties) local result - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_samr_PasswordProperties()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_samr_PasswordProperties()") result = marshall_Enum32(properties, samr_PasswordProperties) - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_samr_PasswordProperties()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_samr_PasswordProperties()") return result end @@ -3894,11 +3894,11 @@ end --@return (pos, str) The new position, and the string representing the datatype. function unmarshall_samr_PasswordProperties(data, pos) local str - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_samr_PasswordProperties()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_samr_PasswordProperties()") pos, str = unmarshall_Enum32_array(data, pos, samr_PasswordProperties) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_samr_PasswordProperties()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_samr_PasswordProperties()") return pos, str end @@ -3909,11 +3909,11 @@ end --@return A string suitable for displaying to the user, or nil if it wasn't found. function samr_PasswordProperties_tostr(val) local result - stdnse.print_debug(4, string.format("MSRPC: Entering samr_PasswordProperties_tostr()")) + stdnse.print_debug(4, "MSRPC: Entering samr_PasswordProperties_tostr()") result = samr_PasswordProperties_str[val] - stdnse.print_debug(4, string.format("MSRPC: Leaving samr_PasswordProperties_tostr()")) + stdnse.print_debug(4, "MSRPC: Leaving samr_PasswordProperties_tostr()") return result end @@ -3939,7 +3939,7 @@ end -- anything. --@return (pos, result) The new position in data, and a table representing the datatype. local function unmarshall_samr_SamEntry(location, data, pos, result) - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_samr_SamEntry()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_samr_SamEntry()") if(result == nil) then result = {} end @@ -3954,7 +3954,7 @@ local function unmarshall_samr_SamEntry(location, data, pos, result) pos, result['name'] = unmarshall_lsa_String_internal(BODY, data, pos, result['name']) end - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_samr_SamEntry()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_samr_SamEntry()") return pos, result end @@ -3972,12 +3972,12 @@ end --@return (pos, result) The new position in data, and a table representing the datatype. function unmarshall_samr_SamArray(data, pos) local result = {} - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_samr_SamArray()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_samr_SamArray()") pos, result['count'] = unmarshall_int32(data, pos) pos, result['entries'] = unmarshall_ptr(ALL, data, pos, unmarshall_array, {result['count'], unmarshall_samr_SamEntry, {}}) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_samr_SamArray()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_samr_SamArray()") return pos, result end @@ -3989,11 +3989,11 @@ end --@return (pos, result) The new position in data, and a table representing the datatype. function unmarshall_samr_SamArray_ptr(data, pos) local result - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_samr_SamArray_ptr()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_samr_SamArray_ptr()") pos, result = unmarshall_ptr(ALL, data, pos, unmarshall_samr_SamArray, {}) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_samr_SamArray_ptr()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_samr_SamArray_ptr()") return pos, result end @@ -4022,7 +4022,7 @@ end -- anything. --@return (pos, result) The new position in data, and a table representing the datatype. local function unmarshall_samr_DispEntryGeneral(location, data, pos, result) - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_samr_DispEntryGeneral()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_samr_DispEntryGeneral()") if(result == nil) then result = {} end @@ -4043,7 +4043,7 @@ local function unmarshall_samr_DispEntryGeneral(location, data, pos, result) pos, result['full_name'] = unmarshall_lsa_String_internal(BODY, data, pos, result['full_name']) end - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_samr_DispEntryGeneral()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_samr_DispEntryGeneral()") return pos, result end @@ -4061,12 +4061,12 @@ end --@return (pos, result) The new position in data, and a table representing the datatype. function unmarshall_samr_DispInfoGeneral(data, pos) local result = {} - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_samr_DispInfoGeneral()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_samr_DispInfoGeneral()") pos, result['count'] = unmarshall_int32(data, pos) pos, result['entries'] = unmarshall_ptr(ALL, data, pos, unmarshall_array, {result['count'], unmarshall_samr_DispEntryGeneral, {}}) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_samr_DispInfoGeneral()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_samr_DispInfoGeneral()") return pos, result end @@ -4090,7 +4090,7 @@ end function unmarshall_samr_DispInfo(data, pos) local level local result - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_samr_DispInfo()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_samr_DispInfo()") pos, level = unmarshall_int16(data, pos) @@ -4101,7 +4101,7 @@ function unmarshall_samr_DispInfo(data, pos) pos, result = nil, nil end - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_samr_DispInfo()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_samr_DispInfo()") return pos, result end @@ -4123,7 +4123,7 @@ end --@return (pos, result) The new position in data, and a table representing the datatype. function unmarshall_samr_DomInfo1(data, pos) local result = {} - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_samr_DomInfo1()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_samr_DomInfo1()") pos, result['min_password_length'] = unmarshall_int16(data, pos, false) pos, result['password_history_length'] = unmarshall_int16(data, pos, false) @@ -4131,7 +4131,7 @@ function unmarshall_samr_DomInfo1(data, pos) pos, result['max_password_age'] = unmarshall_hyper(data, pos) pos, result['min_password_age'] = unmarshall_hyper(data, pos) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_samr_DomInfo1()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_samr_DomInfo1()") return pos, result end @@ -4149,12 +4149,12 @@ end --@return (pos, result) The new position in data, and a table representing the datatype. function unmarshall_samr_DomInfo8(data, pos) local result = {} - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_samr_DomInfo8()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_samr_DomInfo8()") pos, result['sequence_num'] = unmarshall_hyper(data, pos) pos, result['domain_create_time'] = unmarshall_NTTIME(data, pos) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_samr_DomInfo8()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_samr_DomInfo8()") return pos, result end @@ -4173,13 +4173,13 @@ end --@return (pos, result) The new position in data, and a table representing the datatype. function unmarshall_samr_DomInfo12(data, pos) local result = {} - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_samr_DomInfo12()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_samr_DomInfo12()") pos, result['lockout_duration'] = unmarshall_hyper(data, pos) pos, result['lockout_window'] = unmarshall_hyper(data, pos) pos, result['lockout_threshold'] = unmarshall_int16(data, pos) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_samr_DomInfo12()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_samr_DomInfo12()") return pos, result end @@ -4209,7 +4209,7 @@ end function unmarshall_samr_DomainInfo(data, pos) local level local result - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_samr_DomainInfo()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_samr_DomainInfo()") pos, level = unmarshall_int16(data, pos) @@ -4224,7 +4224,7 @@ function unmarshall_samr_DomainInfo(data, pos) pos, result = nil, nil end - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_samr_DomainInfo()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_samr_DomainInfo()") return pos, result end @@ -4237,11 +4237,11 @@ end -- nil if there was an error. function unmarshall_samr_DomainInfo_ptr(data, pos) local result - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_samr_DomainInfo_ptr()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_samr_DomainInfo_ptr()") pos, result = unmarshall_ptr(ALL, data, pos, unmarshall_samr_DomainInfo, {}) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_samr_DomainInfo_ptr()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_samr_DomainInfo_ptr()") return pos, result end @@ -4305,11 +4305,11 @@ local svcctl_ControlCode_str = -- found. function marshall_svcctl_ControlCode(flags) local result - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_svcctl_ControlCode()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_svcctl_ControlCode()") result = marshall_Enum32(flags, svcctl_ControlCode) - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_svcctl_ControlCode()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_svcctl_ControlCode()") return result end @@ -4320,11 +4320,11 @@ end --@return (pos, str) The new position, and the string representing the datatype. function unmarshall_svcctl_ControlCode(data, pos) local str - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_svcctl_ControlCode()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_svcctl_ControlCode()") pos, str = unmarshall_Enum32_array(data, pos, svcctl_ControlCode) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_svcctl_ControlCode()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_svcctl_ControlCode()") return pos, str end @@ -4335,11 +4335,11 @@ end --@return A string suitable for displaying to the user, or nil if it wasn't found. function svcctl_ControlCode_tostr(val) local result - stdnse.print_debug(4, string.format("MSRPC: Entering svcctl_ControlCode_tostr()")) + stdnse.print_debug(4, "MSRPC: Entering svcctl_ControlCode_tostr()") result = svcctl_ControlCode_str[val] - stdnse.print_debug(4, string.format("MSRPC: Leaving svcctl_ControlCode_tostr()")) + stdnse.print_debug(4, "MSRPC: Leaving svcctl_ControlCode_tostr()") return result end @@ -4363,11 +4363,11 @@ local svcctl_Type = -- found. function marshall_svcctl_Type(flags) local result - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_svcctl_Type()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_svcctl_Type()") result = marshall_Enum32(flags, svcctl_Type) - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_svcctl_Type()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_svcctl_Type()") return result end @@ -4378,11 +4378,11 @@ end --@return (pos, str) The new position, and the string representing the datatype. function unmarshall_svcctl_Type(data, pos) local str - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_svcctl_Type()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_svcctl_Type()") pos, str = unmarshall_Enum32_array(data, pos, svcctl_Type) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_svcctl_Type()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_svcctl_Type()") return pos, str end @@ -4393,11 +4393,11 @@ end --@return A string suitable for displaying to the user, or nil if it wasn't found. function svcctl_Type_tostr(val) local result - stdnse.print_debug(4, string.format("MSRPC: Entering svcctl_Type_tostr()")) + stdnse.print_debug(4, "MSRPC: Entering svcctl_Type_tostr()") result = svcctl_Type_str[val] - stdnse.print_debug(4, string.format("MSRPC: Leaving svcctl_Type_tostr()")) + stdnse.print_debug(4, "MSRPC: Leaving svcctl_Type_tostr()") return result end]]-- @@ -4417,11 +4417,11 @@ local svcctl_State = -- found. function marshall_svcctl_State(flags) local result - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_svcctl_State()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_svcctl_State()") result = marshall_Enum32(flags, svcctl_State) - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_svcctl_State()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_svcctl_State()") return result end @@ -4432,11 +4432,11 @@ end --@return (pos, str) The new position, and the string representing the datatype. function unmarshall_svcctl_State(data, pos) local str - stdnse.print_debug(4, string.format("MSRPC: Entering unmarshall_svcctl_State()")) + stdnse.print_debug(4, "MSRPC: Entering unmarshall_svcctl_State()") pos, str = unmarshall_Enum32_array(data, pos, svcctl_State) - stdnse.print_debug(4, string.format("MSRPC: Leaving unmarshall_svcctl_State()")) + stdnse.print_debug(4, "MSRPC: Leaving unmarshall_svcctl_State()") return pos, str end @@ -4447,11 +4447,11 @@ end --@return A string suitable for displaying to the user, or nil if it wasn't found. function svcctl_State_tostr(val) local result - stdnse.print_debug(4, string.format("MSRPC: Entering svcctl_State_tostr()")) + stdnse.print_debug(4, "MSRPC: Entering svcctl_State_tostr()") result = svcctl_State_str[val] - stdnse.print_debug(4, string.format("MSRPC: Leaving svcctl_State_tostr()")) + stdnse.print_debug(4, "MSRPC: Leaving svcctl_State_tostr()") return result end]]-- @@ -4533,11 +4533,11 @@ local atsvc_DaysOfMonth = -- found. function marshall_atsvc_DaysOfMonth(flags) local result - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_atsvc_DaysOfMonth()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_atsvc_DaysOfMonth()") result = marshall_Enum32(flags, atsvc_DaysOfMonth) - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_atsvc_DaysOfMonth()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_atsvc_DaysOfMonth()") return result end @@ -4558,11 +4558,11 @@ local atsvc_Flags = -- found. function marshall_atsvc_Flags(flags) local result - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_atsvc_Flags()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_atsvc_Flags()") result = marshall_Enum8(flags, atsvc_Flags, false) - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_atsvc_Flags()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_atsvc_Flags()") return result end @@ -4585,11 +4585,11 @@ local atsvc_DaysOfWeek = -- found. function marshall_atsvc_DaysOfWeek(flags) local result - stdnse.print_debug(4, string.format("MSRPC: Entering marshall_atsvc_DaysOfWeek()")) + stdnse.print_debug(4, "MSRPC: Entering marshall_atsvc_DaysOfWeek()") result = marshall_Enum8(flags, atsvc_DaysOfWeek, false) - stdnse.print_debug(4, string.format("MSRPC: Leaving marshall_atsvc_DaysOfWeek()")) + stdnse.print_debug(4, "MSRPC: Leaving marshall_atsvc_DaysOfWeek()") return result end diff --git a/nselib/pgsql.lua b/nselib/pgsql.lua index 183c8b024..dd5696ea7 100644 --- a/nselib/pgsql.lua +++ b/nselib/pgsql.lua @@ -89,7 +89,7 @@ v2 = elseif ( authtype == 0 ) then response.success = true else - stdnse.print_debug( ("unknown auth type: %d"):format(authtype) ) + stdnse.print_debug("unknown auth type: %d", authtype) end response.authtype = authtype @@ -138,7 +138,7 @@ v2 = return pos, response end else - stdnse.print_debug( ("Missing decoder for %d"):format(ptype) ) + stdnse.print_debug("Missing decoder for %d", ptype) return -1, ("Missing decoder for %d"):format(ptype) end return -1, "Decoding failed" @@ -601,7 +601,7 @@ function printErrorMessage( dberror ) return end for k, v in pairs(dberror) do - stdnse.print_debug( ("%s=%s"):format(k, v) ) + stdnse.print_debug("%s=%s", k, v) end end diff --git a/nselib/smb.lua b/nselib/smb.lua index 0e96ff261..cde2e47e3 100644 --- a/nselib/smb.lua +++ b/nselib/smb.lua @@ -1445,9 +1445,9 @@ local function start_session_extended(smb, log_errors, overrides) -- Check if they were logged in as a guest if(log_errors == nil or log_errors == true) then if(smb['is_guest'] == 1) then - stdnse.print_debug(1, string.format("SMB: Extended login to %s as %s\\%s failed, but was given guest access (username may be wrong, or system may only allow guest)", smb['ip'], domain, stdnse.string_or_blank(username))) + stdnse.print_debug(1, "SMB: Extended login to %s as %s\\%s failed, but was given guest access (username may be wrong, or system may only allow guest)", smb['ip'], domain, stdnse.string_or_blank(username)) else - stdnse.print_debug(2, string.format("SMB: Extended login to %s as %s\\%s succeeded", smb['ip'], domain, stdnse.string_or_blank(username))) + stdnse.print_debug(2, "SMB: Extended login to %s as %s\\%s succeeded", smb['ip'], domain, stdnse.string_or_blank(username)) end end diff --git a/scripts/acarsd-info.nse b/scripts/acarsd-info.nse index ca3405b73..a69034bd4 100644 --- a/scripts/acarsd-info.nse +++ b/scripts/acarsd-info.nse @@ -60,16 +60,16 @@ action = function(host, port) if not bytes then bytes = 512 else tonumber(bytes) end -- Connect and retrieve acarsd info in XML format over TCP - stdnse.print_debug(1, ("%s: Connecting to %s:%s [Timeout: %ss]"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, timeout)) + stdnse.print_debug(1, "%s: Connecting to %s:%s [Timeout: %ss]", SCRIPT_NAME, host.targetname or host.ip, port.number, timeout) local status, data = comm.get_banner(host, port, {timeout=timeout*1000,bytes=bytes}) if not status or not data then - stdnse.print_debug(1, ("%s: Retrieving data from %s:%s failed [Timeout expired]"):format(SCRIPT_NAME, host.targetname or host.ip, port.number)) + stdnse.print_debug(1, "%s: Retrieving data from %s:%s failed [Timeout expired]", SCRIPT_NAME, host.targetname or host.ip, port.number) return end -- Check if retrieved data is valid acarsd data if not string.match(data, "acarsd") then - stdnse.print_debug(1, ("%s: %s:%s is not an acarsd Daemon."):format(SCRIPT_NAME, host.targetname or host.ip, port.number)) + stdnse.print_debug(1, "%s: %s:%s is not an acarsd Daemon.", SCRIPT_NAME, host.targetname or host.ip, port.number) return end @@ -85,7 +85,7 @@ action = function(host, port) -- Check for unrestricted access -- Parse daemon info else - stdnse.print_debug(1, ("%s: Parsing data from %s:%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number)) + stdnse.print_debug(1, "%s: Parsing data from %s:%s", SCRIPT_NAME, host.targetname or host.ip, port.number) local vars = { {"Version","Version"}, {"API Version","APIVersion"}, diff --git a/scripts/afp-brute.nse b/scripts/afp-brute.nse index f2264121c..2a2883bea 100644 --- a/scripts/afp-brute.nse +++ b/scripts/afp-brute.nse @@ -75,7 +75,7 @@ action = function( host, port ) end - stdnse.print_debug( string.format("Trying %s/%s ...", username, password ) ) + stdnse.print_debug("Trying %s/%s ...", username, password) status, response = helper:Login( username, password ) -- if the response is "Parameter error." we're dealing with Netatalk diff --git a/scripts/daap-get-library.nse b/scripts/daap-get-library.nse index 9bf4ec837..65e513a69 100644 --- a/scripts/daap-get-library.nse +++ b/scripts/daap-get-library.nse @@ -93,7 +93,7 @@ local function getAttributeAsInt( data, name ) pos, len = bin.unpack( ">I", data, pos ) if ( len ~= 4 ) then - stdnse.print_debug( string.format("Unexpected length returned: %d", len ) ) + stdnse.print_debug("Unexpected length returned: %d", len ) return end @@ -199,7 +199,7 @@ parseItem = function( data, len ) if itemFetcher[name] then pos, item[name] = itemFetcher[name](data, pos ) else - stdnse.print_debug( string.format("No itemfetcher for: %s", name) ) + stdnse.print_debug("No itemfetcher for: %s", name) break end diff --git a/scripts/db2-das-info.nse b/scripts/db2-das-info.nse index 98440d474..26372fb2d 100644 --- a/scripts/db2-das-info.nse +++ b/scripts/db2-das-info.nse @@ -140,9 +140,9 @@ function parse_db2_packet(packet) response.info = packet.data:sub(info_offset, info_offset + response.info_length - (info_offset-info_length_offset)) if(nmap.debugging() > 3) then - stdnse.print_debug( string.format("db2-das-info: version: %s", response.version) ) - stdnse.print_debug( string.format("db2-das-info: info_length: %d", response.info_length) ) - stdnse.print_debug( string.format("db2-das-info: response.info:len(): %d", response.info:len())) + stdnse.print_debug("db2-das-info: version: %s", response.version) + stdnse.print_debug("db2-das-info: info_length: %d", response.info_length) + stdnse.print_debug("db2-das-info: response.info:len(): %d", response.info:len()) end return response @@ -198,20 +198,20 @@ function read_db2_packet(socket) total_len = header_len + packet.header.data_len if(nmap.debugging() > 3) then - stdnse.print_debug( string.format("db2-das-info: data_len: %d", packet.header.data_len) ) - stdnse.print_debug( string.format("db2-das-info: buf_len: %d", buf:len())) - stdnse.print_debug( string.format("db2-das-info: total_len: %d", total_len)) + stdnse.print_debug("db2-das-info: data_len: %d", packet.header.data_len) + stdnse.print_debug("db2-das-info: buf_len: %d", buf:len()) + stdnse.print_debug("db2-das-info: total_len: %d", total_len) end -- do we have all data as specified by data_len? while total_len > buf:len() do -- if not read additional bytes if(nmap.debugging() > 3) then - stdnse.print_debug( string.format("db2-das-info: Reading %d additional bytes", total_len - buf:len())) + stdnse.print_debug("db2-das-info: Reading %d additional bytes", total_len - buf:len()) end local tmp = try( socket:receive_bytes( total_len - buf:len() ) ) if(nmap.debugging() > 3) then - stdnse.print_debug( string.format("db2-das-info: Read %d bytes", tmp:len())) + stdnse.print_debug("db2-das-info: Read %d bytes", tmp:len()) end buf = buf .. tmp end diff --git a/scripts/flume-master-info.nse b/scripts/flume-master-info.nse index ff9aa9bde..f13db09af 100644 --- a/scripts/flume-master-info.nse +++ b/scripts/flume-master-info.nse @@ -20,7 +20,7 @@ Information gathered: If this script is run wth -v, it will output lots more info. Use the newtargets script argument to add discovered hosts to -the Nmap scan queue. +the Namp scan queue. ]] --- @@ -95,7 +95,7 @@ end function add_target(hostname) if target.ALLOW_NEW_TARGETS then - stdnse.print_debug(1, ("%s: Added target: %s"):format(SCRIPT_NAME, hostname)) + stdnse.print_debug(1, "%s: Added target: %s", SCRIPT_NAME, hostname) local status,err = target.add(hostname) end end @@ -113,11 +113,15 @@ end parse_page = function( host, port, uri, intresting_keys ) local result = {} local response = http.get( host, port, uri ) - stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response" )) - if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then + stdnse.print_debug(1, "%s: Status %s", + SCRIPT_NAME, response['status-line'] or "No Response") + if response['status-line'] and response['status-line']:match("200%s+OK") + and response['body'] then local body = response['body']:gsub("%%","%%%%") - for name,value in string.gmatch(body,"([^][<]+)%s*]+>([^][<]+)") do - stdnse.print_debug(1, ("%s: %s=%s "):format(SCRIPT_NAME,name,value:gsub("^%s*(.-)%s*$", "%1"))) + for name,value in string.gmatch(body, + "([^][<]+)%s*]+>([^][<]+)") do + stdnse.print_debug(1, "%s: %s=%s ", + SCRIPT_NAME, name, value:gsub("^%s*(.-)%s*$", "%1")) if nmap.verbosity() > 1 then result[#result+1] = ("%s: %s"):format(name,value:gsub("^%s*(.-)%s*$", "%1")) else @@ -169,31 +173,36 @@ action = function( host, port ) local nodes = { } local zookeepers = { } local hbasemasters = { } - stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri)) + stdnse.print_debug(1, "%s:HTTP GET %s:%s%s", + SCRIPT_NAME, host.targetname or host.ip, port.number, uri) local response = http.get( host, port, uri ) - stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response")) - if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then + stdnse.print_debug(1, "%s: Status %s", + SCRIPT_NAME, response['status-line'] or "No Response") + if response['status-line'] and response['status-line']:match("200%s+OK") + and response['body'] then local body = response['body']:gsub("%%","%%%%") local capacity = {} - stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body)) + stdnse.print_debug(2, "%s: Body %s\n", SCRIPT_NAME, body) if body:match("Version:%s*([^][,]+)") then local version = body:match("Version:%s*([^][,]+)") - stdnse.print_debug(1, ("%s: Version %s"):format(SCRIPT_NAME,version)) + stdnse.print_debug(1, "%s: Version %s", SCRIPT_NAME, version) result[#result+1] = ("Version: %s"):format(version) port.version.version = version end if body:match("Compiled:%s*([^][<]+)") then local compiled = body:match("Compiled:%s*([^][<]+)") - stdnse.print_debug(1, ("%s: Compiled %s"):format(SCRIPT_NAME,compiled)) + stdnse.print_debug(1, "%s: Compiled %s", SCRIPT_NAME, compiled) result[#result+1] = ("Compiled: %s"):format(compiled) end if body:match("ServerID:%s*([^][<]+)") then local upgrades = body:match("ServerID:%s*([^][<]+)") - stdnse.print_debug(1, ("%s: ServerID %s"):format(SCRIPT_NAME,upgrades)) + stdnse.print_debug(1, "%s: ServerID %s", SCRIPT_NAME, upgrades) result[#result] = ("ServerID: %s"):format(upgrades) end - for logical,physical,hostname in string.gmatch(body,"([%w%.-_:]+)([%w%.]+)([%w%.]+)") do - stdnse.print_debug(2, ("%s: %s (%s) %s"):format(SCRIPT_NAME,physical,logical,hostname)) + for logical,physical,hostname in string.gmatch(body, + "([%w%.-_:]+)([%w%.]+)([%w%.]+)") do + stdnse.print_debug(2, "%s: %s (%s) %s", + SCRIPT_NAME, physical, logical, hostname) if (table_count(nodes, hostname) == 0) then nodes[#nodes+1] = hostname add_target(hostname) diff --git a/scripts/ganglia-info.nse b/scripts/ganglia-info.nse index 712d475af..bc8d67d0b 100644 --- a/scripts/ganglia-info.nse +++ b/scripts/ganglia-info.nse @@ -108,16 +108,16 @@ action = function( host, port ) end -- Retrieve grid data in XML format over TCP - stdnse.print_debug(1, ("%s: Connecting to %s:%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number)) + stdnse.print_debug(1, "%s: Connecting to %s:%s", SCRIPT_NAME, host.targetname or host.ip, port.number) local status, data = comm.get_banner(host, port, {timeout=timeout*1000,bytes=bytes}) if not status then - stdnse.print_debug(1, ("%s: Timeout exceeded for %s:%s (Timeout: %ss)."):format(SCRIPT_NAME, host.targetname or host.ip, port.number, timeout)) + stdnse.print_debug(1, "%s: Timeout exceeded for %s:%s (Timeout: %ss).", SCRIPT_NAME, host.targetname or host.ip, port.number, timeout) return end -- Parse daemon info if not string.match(data, "Log") then port.version.name = "hadoop-datanode" port.version.product = "Apache Hadoop" nmap.set_port_version(host, port) local logs = body:match("([^][\"]+)\">Log") - stdnse.print_debug(1, ("%s: Logs %s"):format(SCRIPT_NAME,logs)) + stdnse.print_debug(1, "%s: Logs %s", SCRIPT_NAME,logs) table.insert(result, ("Logs: %s"):format(logs)) end return stdnse.format_output(true, result) diff --git a/scripts/hadoop-jobtracker-info.nse b/scripts/hadoop-jobtracker-info.nse index 9ecec188d..c6570c160 100644 --- a/scripts/hadoop-jobtracker-info.nse +++ b/scripts/hadoop-jobtracker-info.nse @@ -62,18 +62,18 @@ end get_userhistory = function( host, port ) local results = {} local uri = "/jobhistory.jsp?pageno=-1&search=" - stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri)) + stdnse.print_debug(1, "%s:HTTP GET %s:%s%s", SCRIPT_NAME, host.targetname or host.ip, port.number, uri) local response = http.get( host, port, uri ) - stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response")) + stdnse.print_debug(1, "%s: Status %s", SCRIPT_NAME,response['status-line'] or "No Response") if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then local body = response['body']:gsub("%%","%%%%") - stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body)) + stdnse.print_debug(2, "%s: Body %s\n", SCRIPT_NAME,body) for line in string.gmatch(body, "[^\n]+") do - stdnse.print_debug(3, ("%s: Line %s\n"):format(SCRIPT_NAME,line)) + stdnse.print_debug(3, "%s: Line %s\n", SCRIPT_NAME,line) if line:match("job_[%d_]+") then local user = line:match("([^][<>]+)") local job_time = line:match("([^][<]+)") - stdnse.print_debug(1, ("%s: User: %s (%s)"):format(SCRIPT_NAME,user,job_time)) + stdnse.print_debug(1, "%s: User: %s (%s)", SCRIPT_NAME,user,job_time) table.insert( results, ("User: %s (%s)"):format(user,job_time)) end end @@ -83,21 +83,21 @@ end get_tasktrackers = function( host, port ) local results = {} local uri = "/machines.jsp?type=active" - stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri)) + stdnse.print_debug(1, "%s:HTTP GET %s:%s%s", SCRIPT_NAME, host.targetname or host.ip, port.number, uri) local response = http.get( host, port, uri ) - stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response")) + stdnse.print_debug(1, "%s: Status %s", SCRIPT_NAME,response['status-line'] or "No Response") if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then - stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,response['body'])) + stdnse.print_debug(2, "%s: Body %s\n", SCRIPT_NAME,response['body']) for line in string.gmatch(response['body'], "[^\n]+") do - stdnse.print_debug(3, ("%s: Line %s\n"):format(SCRIPT_NAME,line)) + stdnse.print_debug(3, "%s: Line %s\n", SCRIPT_NAME,line) if line:match("href=\"[%w]+://([%w%.:]+)/\">tracker") then local tasktracker = line:match("href=\".*//([%w%.:]+)/\">tracker") - stdnse.print_debug(1, ("%s: taskstracker %s"):format(SCRIPT_NAME,tasktracker)) + stdnse.print_debug(1, "%s: taskstracker %s", SCRIPT_NAME,tasktracker) table.insert( results, tasktracker) if target.ALLOW_NEW_TARGETS then if tasktracker:match("([%w%.]+)") then local newtarget = tasktracker:match("([%w%.]+)") - stdnse.print_debug(1, ("%s: Added target: %s"):format(SCRIPT_NAME, newtarget)) + stdnse.print_debug(1, "%s: Added target: %s", SCRIPT_NAME, newtarget) local status,err = target.add(newtarget) end end @@ -110,42 +110,42 @@ action = function( host, port ) local result = {} local uri = "/jobtracker.jsp" - stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri)) + stdnse.print_debug(1, "%s:HTTP GET %s:%s%s", SCRIPT_NAME, host.targetname or host.ip, port.number, uri) local response = http.get( host, port, uri ) - stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response")) + stdnse.print_debug(1, "%s: Status %s", SCRIPT_NAME,response['status-line'] or "No Response") if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then - stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,response['body'])) + stdnse.print_debug(2, "%s: Body %s\n", SCRIPT_NAME,response['body']) if response['body']:match("State:%s*([^][<]+)") then local state = response['body']:match("State:%s*([^][<]+)") - stdnse.print_debug(1, ("%s: State %s"):format(SCRIPT_NAME,state)) + stdnse.print_debug(1, "%s: State %s", SCRIPT_NAME,state) table.insert(result, ("State: %s"):format(state)) end if response['body']:match("Started:%s*([^][<]+)") then local started = response['body']:match("Started:%s*([^][<]+)") - stdnse.print_debug(1, ("%s: Started %s"):format(SCRIPT_NAME,started)) + stdnse.print_debug(1, "%s: Started %s", SCRIPT_NAME,started) table.insert(result, ("Started: %s"):format(started)) end if response['body']:match("Version:%s*([^][<]+)") then local version = response['body']:match("Version:%s*([^][<]+)") local versionNo = version:match("([^][,]+)") local versionHash = version:match("[^][,]+%s+(%w+)") - stdnse.print_debug(1, ("%s: Version %s (%s)"):format(SCRIPT_NAME,versionNo,versionHash)) + stdnse.print_debug(1, "%s: Version %s (%s)", SCRIPT_NAME,versionNo,versionHash) table.insert(result, ("Version: %s (%s)"):format(versionNo,versionHash)) port.version.version = versionNo end if response['body']:match("Compiled:%s*([^][<]+)") then local compiled = response['body']:match("Compiled:%s*([^][<]+)"):gsub("%s+", " ") - stdnse.print_debug(1, ("%s: Compiled %s"):format(SCRIPT_NAME,compiled)) + stdnse.print_debug(1, "%s: Compiled %s", SCRIPT_NAME,compiled) table.insert(result, ("Compiled: %s"):format(compiled)) end if response['body']:match("Identifier:%s*([^][<]+)") then local identifier = response['body']:match("Identifier:%s*([^][<]+)") - stdnse.print_debug(1, ("%s: Identifier %s"):format(SCRIPT_NAME,identifier)) + stdnse.print_debug(1, "%s: Identifier %s", SCRIPT_NAME,identifier) table.insert(result, ("Identifier: %s"):format(identifier)) end if response['body']:match("([%w/]+)\">Log<") then local logfiles = response['body']:match("([%w/-_:%%]+)\">Log<") - stdnse.print_debug(1, ("%s: Log Files %s"):format(SCRIPT_NAME,logfiles)) + stdnse.print_debug(1, "%s: Log Files %s", SCRIPT_NAME,logfiles) table.insert(result, ("Log Files: %s"):format(logfiles)) end local tasktrackers = get_tasktrackers (host, port) diff --git a/scripts/hadoop-namenode-info.nse b/scripts/hadoop-namenode-info.nse index f8950f110..7e804883f 100644 --- a/scripts/hadoop-namenode-info.nse +++ b/scripts/hadoop-namenode-info.nse @@ -62,20 +62,20 @@ end get_datanodes = function( host, port, Status ) local result = {} local uri = "/dfsnodelist.jsp?whatNodes=" .. Status - stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri)) + stdnse.print_debug(1, "%s:HTTP GET %s:%s%s", SCRIPT_NAME, host.targetname or host.ip, port.number, uri) local response = http.get( host, port, uri ) - stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response" )) + stdnse.print_debug(1, "%s: Status %s", SCRIPT_NAME,response['status-line'] or "No Response" ) if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then local body = response['body']:gsub("%%","%%%%") - stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body)) + stdnse.print_debug(2, "%s: Body %s\n", SCRIPT_NAME,body) for datanodetmp in string.gmatch(body, "[%w%.:-_]+/browseDirectory.jsp") do local datanode = datanodetmp:gsub("/browseDirectory.jsp","") - stdnse.print_debug(1, ("%s: Datanode %s"):format(SCRIPT_NAME,datanode)) + stdnse.print_debug(1, "%s: Datanode %s", SCRIPT_NAME,datanode) table.insert(result, ("Datanode: %s"):format(datanode)) if target.ALLOW_NEW_TARGETS then if datanode:match("([%w%.]+)") then local newtarget = datanode:match("([%w%.]+)") - stdnse.print_debug(1, ("%s: Added target: %s"):format(SCRIPT_NAME, newtarget)) + stdnse.print_debug(1, "%s: Added target: %s", SCRIPT_NAME, newtarget) local status,err = target.add(newtarget) end end @@ -88,51 +88,51 @@ action = function( host, port ) local result = {} local uri = "/dfshealth.jsp" - stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri)) + stdnse.print_debug(1, "%s:HTTP GET %s:%s%s", SCRIPT_NAME, host.targetname or host.ip, port.number, uri) local response = http.get( host, port, uri ) - stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response")) + stdnse.print_debug(1, "%s: Status %s", SCRIPT_NAME,response['status-line'] or "No Response") if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then local body = response['body']:gsub("%%","%%%%") local capacity = {} - stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body)) + stdnse.print_debug(2, "%s: Body %s\n", SCRIPT_NAME,body) if body:match("Started:%s*([^][<]+)") then local start = body:match("Started:%s*([^][<]+)") - stdnse.print_debug(1, ("%s: Started %s"):format(SCRIPT_NAME,start)) + stdnse.print_debug(1, "%s: Started %s", SCRIPT_NAME,start) table.insert(result, ("Started: %s"):format(start)) end if body:match("Version:%s*([^][<]+)") then local version = body:match("Version:%s*([^][<]+)") - stdnse.print_debug(1, ("%s: Version %s"):format(SCRIPT_NAME,version)) + stdnse.print_debug(1, "%s: Version %s", SCRIPT_NAME,version) table.insert(result, ("Version: %s"):format(version)) port.version.version = version end if body:match("Compiled:%s*([^][<]+)") then local compiled = body:match("Compiled:%s*([^][<]+)") - stdnse.print_debug(1, ("%s: Compiled %s"):format(SCRIPT_NAME,compiled)) + stdnse.print_debug(1, "%s: Compiled %s", SCRIPT_NAME,compiled) table.insert(result, ("Compiled: %s"):format(compiled)) end if body:match("Upgrades:%s*([^][<]+)") then local upgrades = body:match("Upgrades:%s*([^][<]+)") - stdnse.print_debug(1, ("%s: Upgrades %s"):format(SCRIPT_NAME,upgrades)) + stdnse.print_debug(1, "%s: Upgrades %s", SCRIPT_NAME,upgrades) table.insert(result, ("Upgrades: %s"):format(upgrades)) end if body:match("([^][\"]+)\">Browse") then local filesystem = body:match("([^][\"]+)\">Browse") - stdnse.print_debug(1, ("%s: Filesystem %s"):format(SCRIPT_NAME,filesystem)) + stdnse.print_debug(1, "%s: Filesystem %s", SCRIPT_NAME,filesystem) table.insert(result, ("Filesystem: %s"):format(filesystem)) end if body:match("([^][\"]+)\">Namenode") then local logs = body:match("([^][\"]+)\">Namenode") - stdnse.print_debug(1, ("%s: Logs %s"):format(SCRIPT_NAME,logs)) + stdnse.print_debug(1, "%s: Logs %s", SCRIPT_NAME,logs) table.insert(result, ("Logs: %s"):format(logs)) end for i in string.gmatch(body, "[%d%.]+%s[KMGTP]B") do table.insert(capacity,i) end if #capacity >= 6 then - stdnse.print_debug(1, ("%s: Total %s"):format(SCRIPT_NAME,capacity[3])) - stdnse.print_debug(1, ("%s: Used DFS (NonDFS) %s (%s)"):format(SCRIPT_NAME,capacity[4],capacity[5])) - stdnse.print_debug(1, ("%s: Remaining %s"):format(SCRIPT_NAME,capacity[6])) + stdnse.print_debug(1, "%s: Total %s", SCRIPT_NAME,capacity[3]) + stdnse.print_debug(1, "%s: Used DFS (NonDFS) %s (%s)", SCRIPT_NAME,capacity[4],capacity[5]) + stdnse.print_debug(1, "%s: Remaining %s", SCRIPT_NAME,capacity[6]) table.insert(result,"Storage:") table.insert(result,"Total\tUsed (DFS)\tUsed (Non DFS)\tRemaining") table.insert(result, ("%s\t%s\t%s\t%s"):format(capacity[3],capacity[4],capacity[5],capacity[6])) diff --git a/scripts/hadoop-secondary-namenode-info.nse b/scripts/hadoop-secondary-namenode-info.nse index 592a6436d..64e6a249d 100644 --- a/scripts/hadoop-secondary-namenode-info.nse +++ b/scripts/hadoop-secondary-namenode-info.nse @@ -59,39 +59,39 @@ action = function( host, port ) local result = {} local uri = "/status.jsp" - stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri)) + stdnse.print_debug(1, "%s:HTTP GET %s:%s%s", SCRIPT_NAME, host.targetname or host.ip, port.number, uri) local response = http.get( host, port, uri ) - stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Resposne")) + stdnse.print_debug(1, "%s: Status %s", SCRIPT_NAME,response['status-line'] or "No Resposne") if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then local body = response['body']:gsub("%%","%%%%") local stats = {} - stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body)) + stdnse.print_debug(2, "%s: Body %s\n", SCRIPT_NAME,body) -- Page isn't valid html :( for i in string.gmatch(body,"\n[%w%s]+:%s+[^][\n]+") do table.insert(stats,i:match(":%s+([^][\n]+)")) end if #stats == 5 then - stdnse.print_debug(1, ("%s: namenode %s"):format(SCRIPT_NAME,stats[1])) - stdnse.print_debug(1, ("%s: Start %s"):format(SCRIPT_NAME,stats[2])) - stdnse.print_debug(1, ("%s: Last Checkpoint %s"):format(SCRIPT_NAME,stats[3])) - stdnse.print_debug(1, ("%s: Checkpoint Period %s"):format(SCRIPT_NAME,stats[4])) - stdnse.print_debug(1, ("%s: Checkpoint Size %s"):format(SCRIPT_NAME,stats[5])) + stdnse.print_debug(1, "%s: namenode %s", SCRIPT_NAME,stats[1]) + stdnse.print_debug(1, "%s: Start %s", SCRIPT_NAME,stats[2]) + stdnse.print_debug(1, "%s: Last Checkpoint %s", SCRIPT_NAME,stats[3]) + stdnse.print_debug(1, "%s: Checkpoint Period %s", SCRIPT_NAME,stats[4]) + stdnse.print_debug(1, "%s: Checkpoint Size %s", SCRIPT_NAME,stats[5]) table.insert(result, ("Start: %s"):format(stats[2])) end if body:match("Version:%s*([^][\n]+)") then local version = body:match("Version:%s*([^][\n]+)") - stdnse.print_debug(1, ("%s: Version %s"):format(SCRIPT_NAME,version)) + stdnse.print_debug(1, "%s: Version %s", SCRIPT_NAME,version) table.insert(result, ("Version: %s"):format(version)) port.version.version = version end if body:match("Compiled:%s*([^][\n]+)") then local compiled = body:match("Compiled:%s*([^][\n]+)") - stdnse.print_debug(1, ("%s: Compiled %s"):format(SCRIPT_NAME,compiled)) + stdnse.print_debug(1, "%s: Compiled %s", SCRIPT_NAME,compiled) table.insert(result, ("Compiled: %s"):format(compiled)) end if body:match("([^][\"]+)\">Logs") then local logs = body:match("([^][\"]+)\">Logs") - stdnse.print_debug(1, ("%s: Logs %s"):format(SCRIPT_NAME,logs)) + stdnse.print_debug(1, "%s: Logs %s", SCRIPT_NAME,logs) table.insert(result, ("Logs: %s"):format(logs)) end if #stats == 5 then @@ -108,7 +108,7 @@ action = function( host, port ) if target.ALLOW_NEW_TARGETS then if stats[1]:match("([^][/]+)") then local newtarget = stats[1]:match("([^][/]+)") - stdnse.print_debug(1, ("%s: Added target: %s"):format(SCRIPT_NAME, newtarget)) + stdnse.print_debug(1, "%s: Added target: %s", SCRIPT_NAME, newtarget) local status,err = target.add(newtarget) end end diff --git a/scripts/hadoop-tasktracker-info.nse b/scripts/hadoop-tasktracker-info.nse index a41e36175..4717416a4 100644 --- a/scripts/hadoop-tasktracker-info.nse +++ b/scripts/hadoop-tasktracker-info.nse @@ -48,28 +48,28 @@ action = function( host, port ) local result = {} local uri = "/tasktracker.jsp" - stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri)) + stdnse.print_debug(1, "%s:HTTP GET %s:%s%s", SCRIPT_NAME, host.targetname or host.ip, port.number, uri) local response = http.get( host, port, uri ) - stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response")) + stdnse.print_debug(1, "%s: Status %s", SCRIPT_NAME,response['status-line'] or "No Response") if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then local body = response['body']:gsub("%%","%%%%") - stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body)) + stdnse.print_debug(2, "%s: Body %s\n", SCRIPT_NAME,body) if response['body']:match("Version:%s*([^][<]+)") then local version = response['body']:match("Version:%s*([^][<]+)") local versionNo = version:match("([^][,]+)") local versionHash = version:match("[^][,]+%s+(%w+)") - stdnse.print_debug(1, ("%s: Version %s (%s)"):format(SCRIPT_NAME,versionNo,versionHash)) + stdnse.print_debug(1, "%s: Version %s (%s)", SCRIPT_NAME,versionNo,versionHash) table.insert(result, ("Version: %s (%s)"):format(versionNo,versionHash)) port.version.version = version end if response['body']:match("Compiled:%s*([^][<]+)") then local compiled = response['body']:match("Compiled:%s*([^][<]+)"):gsub("%s+", " ") - stdnse.print_debug(1, ("%s: Compiled %s"):format(SCRIPT_NAME,compiled)) + stdnse.print_debug(1, "%s: Compiled %s", SCRIPT_NAME,compiled) table.insert(result, ("Compiled: %s"):format(compiled)) end if body:match("([^][\"]+)\">Log") then local logs = body:match("([^][\"]+)\">Log") - stdnse.print_debug(1, ("%s: Logs %s"):format(SCRIPT_NAME,logs)) + stdnse.print_debug(1, "%s: Logs %s", SCRIPT_NAME,logs) table.insert(result, ("Logs: %s"):format(logs)) end if #result > 0 then diff --git a/scripts/hbase-master-info.nse b/scripts/hbase-master-info.nse index 3b20936df..68bb54eda 100644 --- a/scripts/hbase-master-info.nse +++ b/scripts/hbase-master-info.nse @@ -61,65 +61,65 @@ action = function( host, port ) local result = {} local region_servers = {} local uri = "/master.jsp" - stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri)) + stdnse.print_debug(1, "%s:HTTP GET %s:%s%s", SCRIPT_NAME, host.targetname or host.ip, port.number, uri) local response = http.get( host, port, uri ) - stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response")) + stdnse.print_debug(1, "%s: Status %s", SCRIPT_NAME,response['status-line'] or "No Response") if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then local body = response['body']:gsub("%%","%%%%") - stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body)) + stdnse.print_debug(2, "%s: Body %s\n", SCRIPT_NAME,body) if body:match("HBase%s+Version([^][<]+)") then local version = body:match("HBase%s+Version([^][<]+)"):gsub("%s+", " ") - stdnse.print_debug(1, ("%s:Hbase Version %s"):format(SCRIPT_NAME,version)) + stdnse.print_debug(1, "%s:Hbase Version %s", SCRIPT_NAME,version) table.insert(result, ("Hbase Version: %s"):format(version)) port.version.version = version end if body:match("HBase%s+Compiled([^][<]+)") then local compiled = body:match("HBase%s+Compiled([^][<]+)"):gsub("%s+", " ") - stdnse.print_debug(1, ("%s: Hbase Compiled %s"):format(SCRIPT_NAME,compiled)) + stdnse.print_debug(1, "%s: Hbase Compiled %s", SCRIPT_NAME,compiled) table.insert(result, ("Hbase Compiled: %s"):format(compiled)) end if body:match("Directory([^][<]+)") then local compiled = body:match("Directory([^][<]+)"):gsub("%s+", " ") - stdnse.print_debug(1, ("%s: HBase RootDirectory %s"):format(SCRIPT_NAME,compiled)) + stdnse.print_debug(1, "%s: HBase RootDirectory %s", SCRIPT_NAME,compiled) table.insert(result, ("HBase Root Directory: %s"):format(compiled)) end if body:match("Hadoop%s+Version([^][<]+)") then local version = body:match("Hadoop%s+Version([^][<]+)"):gsub("%s+", " ") - stdnse.print_debug(1, ("%s: Hadoop Version %s"):format(SCRIPT_NAME,version)) + stdnse.print_debug(1, "%s: Hadoop Version %s", SCRIPT_NAME,version) table.insert(result, ("Hadoop Version: %s"):format(version)) end if body:match("Hadoop%s+Compiled([^][<]+)") then local compiled = body:match("Hadoop%s+Compiled([^][<]+)"):gsub("%s+", " ") - stdnse.print_debug(1, ("%s: Hadoop Compiled %s"):format(SCRIPT_NAME,compiled)) + stdnse.print_debug(1, "%s: Hadoop Compiled %s", SCRIPT_NAME,compiled) table.insert(result, ("Hadoop Compiled: %s"):format(compiled)) end if body:match("average([^][<]+)") then local average = body:match("average([^][<]+)"):gsub("%s+", " ") - stdnse.print_debug(1, ("%s: Average Load %s"):format(SCRIPT_NAME,average)) + stdnse.print_debug(1, "%s: Average Load %s", SCRIPT_NAME,average) table.insert(result, ("Average Load: %s"):format(average)) end if body:match("Quorum([^][<]+)") then local quorum = body:match("Quorum([^][<]+)"):gsub("%s+", " ") - stdnse.print_debug(1, ("%s: Zookeeper Quorum %s"):format(SCRIPT_NAME,quorum)) + stdnse.print_debug(1, "%s: Zookeeper Quorum %s", SCRIPT_NAME,quorum) table.insert(result, ("Zookeeper Quorum: %s"):format(quorum)) if target.ALLOW_NEW_TARGETS then if quorum:match("([%w%.]+)") then local newtarget = quorum:match("([%w%.]+)") - stdnse.print_debug(1, ("%s: Added target: %s"):format(SCRIPT_NAME, newtarget)) + stdnse.print_debug(1, "%s: Added target: %s", SCRIPT_NAME, newtarget) local status,err = target.add(newtarget) end end end for line in string.gmatch(body, "[^\n]+") do - stdnse.print_debug(3, ("%s: Line %s\n"):format(SCRIPT_NAME,line)) + stdnse.print_debug(3, "%s: Line %s\n", SCRIPT_NAME,line) if line:match("maxHeap") then local region_server= line:match("\">([^][<]+)") - stdnse.print_debug(1, ("%s: Region Server %s"):format(SCRIPT_NAME,region_server)) + stdnse.print_debug(1, "%s: Region Server %s", SCRIPT_NAME,region_server) table.insert(region_servers, region_server) if target.ALLOW_NEW_TARGETS then if region_server:match("([%w%.]+)") then local newtarget = region_server:match("([%w%.]+)") - stdnse.print_debug(1, ("%s: Added target: %s"):format(SCRIPT_NAME, newtarget)) + stdnse.print_debug(1, "%s: Added target: %s", SCRIPT_NAME, newtarget) local status,err = target.add(newtarget) end end diff --git a/scripts/hbase-region-info.nse b/scripts/hbase-region-info.nse index b01de653a..5982e64a9 100644 --- a/scripts/hbase-region-info.nse +++ b/scripts/hbase-region-info.nse @@ -56,36 +56,36 @@ action = function( host, port ) -- uri was previously "/regionserver.jsp". See -- http://seclists.org/nmap-dev/2012/q3/903. local uri = "/rs-status" - stdnse.print_debug(1, ("%s:HTTP GET %s:%s%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number, uri)) + stdnse.print_debug(1, "%s:HTTP GET %s:%s%s", SCRIPT_NAME, host.targetname or host.ip, port.number, uri) local response = http.get( host, port, uri ) - stdnse.print_debug(1, ("%s: Status %s"):format(SCRIPT_NAME,response['status-line'] or "No Response")) + stdnse.print_debug(1, "%s: Status %s", SCRIPT_NAME,response['status-line'] or "No Response") if response['status-line'] and response['status-line']:match("200%s+OK") and response['body'] then local body = response['body']:gsub("%%","%%%%") - stdnse.print_debug(2, ("%s: Body %s\n"):format(SCRIPT_NAME,body)) + stdnse.print_debug(2, "%s: Body %s\n", SCRIPT_NAME,body) if body:match("HBase%s+Version([^][<]+)") then local version = body:match("HBase%s+Version([^][<]+)"):gsub("%s+", " ") - stdnse.print_debug(1, ("%s:Hbase Version %s"):format(SCRIPT_NAME,version)) + stdnse.print_debug(1, "%s:Hbase Version %s", SCRIPT_NAME,version) table.insert(result, ("Hbase Version: %s"):format(version)) port.version.version = version end if body:match("HBase%s+Compiled([^][<]+)") then local compiled = body:match("HBase%s+Compiled([^][<]+)"):gsub("%s+", " ") - stdnse.print_debug(1, ("%s: Hbase Compiled %s"):format(SCRIPT_NAME,compiled)) + stdnse.print_debug(1, "%s: Hbase Compiled %s", SCRIPT_NAME,compiled) table.insert(result, ("Hbase Compiled: %s"):format(compiled)) end if body:match("Metrics([^][<]+)") then local metrics = body:match("Metrics([^][<]+)"):gsub("%s+", " ") - stdnse.print_debug(1, ("%s: Metrics %s"):format(SCRIPT_NAME,metrics)) + stdnse.print_debug(1, "%s: Metrics %s", SCRIPT_NAME,metrics) table.insert(result, ("Metrics %s"):format(metrics)) end if body:match("Quorum([^][<]+)") then local quorum = body:match("Quorum([^][<]+)"):gsub("%s+", " ") - stdnse.print_debug(1, ("%s: Zookeeper Quorum %s"):format(SCRIPT_NAME,quorum)) + stdnse.print_debug(1, "%s: Zookeeper Quorum %s", SCRIPT_NAME,quorum) table.insert(result, ("Zookeeper Quorum: %s"):format(quorum)) if target.ALLOW_NEW_TARGETS then if quorum:match("([%w%.]+)") then local newtarget = quorum:match("([%w%.]+)") - stdnse.print_debug(1, ("%s: Added target: %s"):format(SCRIPT_NAME, newtarget)) + stdnse.print_debug(1, "%s: Added target: %s", SCRIPT_NAME, newtarget) local status,err = target.add(newtarget) end end diff --git a/scripts/http-barracuda-dir-traversal.nse b/scripts/http-barracuda-dir-traversal.nse index 947bd537d..b9bade6c7 100644 --- a/scripts/http-barracuda-dir-traversal.nse +++ b/scripts/http-barracuda-dir-traversal.nse @@ -92,7 +92,7 @@ action = function(host, port) local config_file = "" -- Loop through vulnerable files - stdnse.print_debug(1, ("%s: Connecting to %s:%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number)) + stdnse.print_debug(1, "%s: Connecting to %s:%s", SCRIPT_NAME, host.targetname or host.ip, port.number) for _, path in ipairs(paths) do -- Retrieve file @@ -128,7 +128,7 @@ action = function(host, port) -- No config file found if config_file == "" then - stdnse.print_debug(1, ("%s: %s:%s is not vulnerable or connection timed out."):format(SCRIPT_NAME, host.targetname or host.ip, port.number)) + stdnse.print_debug(1, "%s: %s:%s is not vulnerable or connection timed out.", SCRIPT_NAME, host.targetname or host.ip, port.number) return end diff --git a/scripts/http-qnap-nas-info.nse b/scripts/http-qnap-nas-info.nse index 6ddd0ab6a..1105b6743 100644 --- a/scripts/http-qnap-nas-info.nse +++ b/scripts/http-qnap-nas-info.nse @@ -52,7 +52,7 @@ action = function(host, port) local config_file = "" -- Retrieve file - stdnse.print_debug(1, ("%s: Connecting to %s:%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number)) + stdnse.print_debug(1, "%s: Connecting to %s:%s", SCRIPT_NAME, host.targetname or host.ip, port.number) local data = http.get(host, port, path) -- Check if file exists @@ -63,7 +63,7 @@ action = function(host, port) if string.match(data.body, '') then config_file = data.body else - stdnse.print_debug(1, ("%s: %s:%s uses an invalid config file."):format(SCRIPT_NAME, host.targetname or host.ip, port.number)) + stdnse.print_debug(1, "%s: %s:%s uses an invalid config file.", SCRIPT_NAME, host.targetname or host.ip, port.number) return end diff --git a/scripts/ldap-search.nse b/scripts/ldap-search.nse index 5ab5b3bd1..64cc9b0af 100644 --- a/scripts/ldap-search.nse +++ b/scripts/ldap-search.nse @@ -174,7 +174,7 @@ function action(host,port) local status, errmsg = ldap.bindRequest( socket, bindParam ) if not status then - stdnse.print_debug( string.format("ldap-search failed to bind: %s", errmsg) ) + stdnse.print_debug("ldap-search failed to bind: %s", errmsg) return " \n ERROR: Authentication failed" end -- or if ldap-brute found us something @@ -240,7 +240,7 @@ function action(host,port) if ( searchResEntries:match("DSID[-]0C090627") and not(username) ) then return "ERROR: Failed to bind as the anonymous user" else - stdnse.print_debug( string.format( "ldap.searchRequest returned: %s", searchResEntries ) ) + stdnse.print_debug("ldap.searchRequest returned: %s", searchResEntries) return end end diff --git a/scripts/modbus-discover.nse b/scripts/modbus-discover.nse index f09424e1c..99a6f8bfb 100644 --- a/scripts/modbus-discover.nse +++ b/scripts/modbus-discover.nse @@ -63,7 +63,7 @@ discover_device_id_recursive = function(host, port, sid, start_id) local more_follows = string.byte(result, 12) local next_object_id = string.byte(result, 13) local number_of_objects = string.byte(result, 14) - stdnse.print_debug(1, ("more = 0x%x, next_id = 0x%x, obj_number = 0x%x"):format(more_follows, next_object_id, number_of_objects)) + stdnse.print_debug(1, "more = 0x%x, next_id = 0x%x, obj_number = 0x%x", more_follows, next_object_id, number_of_objects) local offset = 15 for i = start_id, (number_of_objects - 1) do local object_id = string.byte(result, offset) @@ -71,7 +71,7 @@ discover_device_id_recursive = function(host, port, sid, start_id) -- error data format -- if object_len == nil then break end local object_value = string.sub(result, offset + 2, offset + 1 + object_len) - stdnse.print_debug(1, ("Object id = 0x%x, value = %s"):format(object_id, object_value)) + stdnse.print_debug(1, "Object id = 0x%x, value = %s", object_id, object_value) table.insert(objects_table, object_id + 1, object_value) offset = offset + 2 + object_len end diff --git a/scripts/pgsql-brute.nse b/scripts/pgsql-brute.nse index 8cfb14b39..93b820754 100644 --- a/scripts/pgsql-brute.nse +++ b/scripts/pgsql-brute.nse @@ -105,7 +105,7 @@ action = function( host, port ) for username in usernames do ssl_enable = not(nossl) for password in passwords do - stdnse.print_debug( string.format("Trying %s/%s ...", username, password ) ) + stdnse.print_debug("Trying %s/%s ...", username, password ) local socket = connectSocket( host, port, ssl_enable ) status, response = pg.sendStartup(socket, username, username) diff --git a/scripts/qconn-exec.nse b/scripts/qconn-exec.nse index bda75dfb0..3759ce16d 100644 --- a/scripts/qconn-exec.nse +++ b/scripts/qconn-exec.nse @@ -87,17 +87,17 @@ system commands as the 'root' user. -- Send command as service launcher request local req = string.format("service launcher\nstart/flags run /bin/sh /bin/sh -c \"%s\"\n", cmd) - stdnse.print_debug(1, ("%s: Connecting to %s:%s"):format(SCRIPT_NAME, host.targetname or host.ip, port.number)) + stdnse.print_debug(1, "%s: Connecting to %s:%s", SCRIPT_NAME, host.targetname or host.ip, port.number) local status, data = comm.exchange(host, port, req, {timeout=timeout*1000,bytes=bytes}) if not status then - stdnse.print_debug(1, ("%s: Timeout exceeded for %s:%s (Timeout: %ss)."):format(SCRIPT_NAME, host.targetname or host.ip, port.number, timeout)) + stdnse.print_debug(1, "%s: Timeout exceeded for %s:%s (Timeout: %ss).", SCRIPT_NAME, host.targetname or host.ip, port.number, timeout) return end -- Parse response - stdnse.print_debug(2, ("%s: Received reply:\n%s"):format(SCRIPT_NAME, data)) + stdnse.print_debug(2, "%s: Received reply:\n%s", SCRIPT_NAME, data) if not string.match(data, "QCONN") then - stdnse.print_debug(1, ("%s: %s:%s is not a QNX QCONN daemon."):format(SCRIPT_NAME, host.targetname or host.ip, port.number)) + stdnse.print_debug(1, "%s: %s:%s is not a QNX QCONN daemon.", SCRIPT_NAME, host.targetname or host.ip, port.number) return end @@ -107,7 +107,7 @@ system commands as the 'root' user. local report = vulns.Report:new(SCRIPT_NAME, host, port) return report:make_output(vuln_table) else - stdnse.print_debug(1, ("%s: %s:%s QNX QCONN daemon is not vulnerable."):format(SCRIPT_NAME, host.targetname or host.ip, port.number)) + stdnse.print_debug(1, "%s: %s:%s QNX QCONN daemon is not vulnerable.", SCRIPT_NAME, host.targetname or host.ip, port.number) return end diff --git a/scripts/tftp-enum.nse b/scripts/tftp-enum.nse index c92359e52..4d5c9c984 100644 --- a/scripts/tftp-enum.nse +++ b/scripts/tftp-enum.nse @@ -98,7 +98,7 @@ local create_tftp_file_request = function(filename) end local check_file_present = function(host, port, filename) - stdnse.print_debug(1, ("checking file %s"):format(filename)) + stdnse.print_debug(1, "checking file %s", filename) local file_request = create_tftp_file_request(filename) @@ -109,14 +109,14 @@ local check_file_present = function(host, port, filename) if (not (status)) then - stdnse.print_debug(1, ("error %s"):format(lhost)) + stdnse.print_debug(1, "error %s", lhost) socket:close() return REQUEST_ERROR end local bind_socket = nmap.new_socket("udp") - stdnse.print_debug(1, ("local port = %d"):format(lport)) + stdnse.print_debug(1, "local port = %d", lport) socket:send(file_request) socket:close() @@ -127,7 +127,7 @@ local check_file_present = function(host, port, filename) stdnse.print_debug(1, "starting listener") if (not (bindOK)) then - stdnse.print_debug(1, ("Error in bind %s"):format(error)) + stdnse.print_debug(1, "Error in bind %s", error) bind_socket:close() return REQUEST_ERROR end @@ -136,7 +136,7 @@ local check_file_present = function(host, port, filename) local recvOK, data = bind_socket:receive() if (not (recvOK)) then - stdnse.print_debug(1, ("Error in receive %s"):format(data)) + stdnse.print_debug(1, "Error in receive %s", data) bind_socket:close() return REQUEST_ERROR end