mirror of
https://github.com/nmap/nmap.git
synced 2026-02-15 18:06:35 +00:00
os.date format string cleanup
Removed some non-ANSI-C strftime format strings ("%F") and
locale-dependent formats ("%c") from NSE scripts and libraries.
C99-specified %F was noticed by Alex Weber
(http://seclists.org/nmap-dev/2013/q2/300)
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
local bitcoin = require "bitcoin"
|
||||
local os = require "os"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local table = require "table"
|
||||
@@ -57,7 +56,7 @@ action = function(host, port)
|
||||
bcoin:close()
|
||||
|
||||
local result = {}
|
||||
table.insert(result, ("Timestamp: %s"):format(os.date("%c", ver.timestamp)))
|
||||
table.insert(result, ("Timestamp: %s"):format(stdnse.format_timestamp(ver.timestamp)))
|
||||
table.insert(result, ("Network: %s"):format(NETWORK[ver.magic]))
|
||||
table.insert(result, ("Version: %s"):format(ver.ver))
|
||||
table.insert(result, ("Node Id: %s"):format(ver.nodeid))
|
||||
|
||||
@@ -95,7 +95,7 @@ action = function(host, port)
|
||||
end
|
||||
|
||||
local output = {
|
||||
("Time of fix: %s UTC"):format(os.date("%c", gps.Util.convertTime(gpsinfo.date, gpsinfo.time))),
|
||||
("Time of fix: %s"):format(stdnse.format_timestamp(gps.Util.convertTime(gpsinfo.date, gpsinfo.time))),
|
||||
("Coordinates: %.4f,%.4f"):format(tonumber(gpsinfo.latitude), tonumber(gpsinfo.longitude)),
|
||||
("Speed: %s knots"):format(gpsinfo.speed)
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
local nmap = require "nmap"
|
||||
local os = require "os"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local tab = require "tab"
|
||||
@@ -42,7 +41,7 @@ local filter = {
|
||||
|
||||
["pid"] = { name = "Process ID" },
|
||||
["uptime"] = { name = "Uptime", func = function(v) return ("%d seconds"):format(v) end },
|
||||
["time"] = { name = "Server time", func = function(v) return os.date("%c", v) end },
|
||||
["time"] = { name = "Server time", func = stdnse.format_timestamp },
|
||||
["pointer_size"] = { name = "Architecture", func = function(v) return v .. " bit" end },
|
||||
["rusage_user"] = { name = "Used CPU (user)" },
|
||||
["rusage_system"] = { name = "Used CPU (system)"},
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
local bin = require "bin"
|
||||
local comm = require "comm"
|
||||
local nmap = require "nmap"
|
||||
local os = require "os"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
@@ -90,7 +89,7 @@ action = function(host, port)
|
||||
-- the NTP4 reference above.
|
||||
tstamp = sec - 2208988800 + frac / 0x10000000
|
||||
|
||||
table.insert(output, string.format("receive time stamp: %s", os.date("%c", tstamp)))
|
||||
table.insert(output, string.format("receive time stamp: %s", stdnse.format_timestamp(tstamp)))
|
||||
end
|
||||
|
||||
status, bufrlres = comm.exchange(host, port, rlreq, {proto=port.protocol, timeout=TIMEOUT})
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
local comm = require "comm"
|
||||
local nmap = require "nmap"
|
||||
local os = require "os"
|
||||
local shortport = require "shortport"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
@@ -163,12 +162,11 @@ local function formataddress(data)
|
||||
end
|
||||
|
||||
local function formattime(data)
|
||||
local FORMAT = "!%Y-%m-%d %H:%M:%S UTC"
|
||||
local time = parsefloat(data)
|
||||
if not time then
|
||||
return
|
||||
end
|
||||
local human = os.date(FORMAT, time)
|
||||
local human = stdnse.format_timestamp(time)
|
||||
return time .. " (" .. human .. ")"
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user