mirror of
https://github.com/nmap/nmap.git
synced 2026-01-17 20:09:02 +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,9 @@
|
||||
# Nmap Changelog ($Id$); -*-text-*-
|
||||
|
||||
o 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. [Daniel Miller]
|
||||
|
||||
o [Zenmap] Added Polish translation by Jacek Wielemborek.
|
||||
|
||||
o [NSE] Added http-coldfusion-subzero. It detects Coldfusion 9 and 10
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
local bin = require "bin"
|
||||
local ipOps = require "ipOps"
|
||||
local nmap = require "nmap"
|
||||
local os = require "os"
|
||||
local stdnse = require "stdnse"
|
||||
_ENV = stdnse.module("natpmp", stdnse.seeall)
|
||||
|
||||
@@ -104,7 +103,7 @@ Response = {
|
||||
|
||||
pos, self.time, self.ip = bin.unpack("<II", self.data, pos)
|
||||
self.ip = ipOps.fromdword(self.ip)
|
||||
self.time = os.date("%c", self.time)
|
||||
self.time = stdnse.format_timestamp(self.time)
|
||||
return true
|
||||
end,
|
||||
|
||||
|
||||
@@ -80,7 +80,6 @@ local bit = require "bit"
|
||||
local datafiles = require "datafiles"
|
||||
local math = require "math"
|
||||
local nmap = require "nmap"
|
||||
local os = require "os"
|
||||
local stdnse = require "stdnse"
|
||||
local string = require "string"
|
||||
local table = require "table"
|
||||
@@ -3208,9 +3207,7 @@ Util =
|
||||
-- @param number of seconds since some given start time
|
||||
-- (the "epoch")
|
||||
-- @return string that represents time.
|
||||
TimeToString = function(time)
|
||||
return os.date("!%F %H:%M", time)
|
||||
end,
|
||||
TimeToString = stdnse.format_timestamp,
|
||||
|
||||
--- Converts the size in bytes to a human readable format
|
||||
--
|
||||
|
||||
@@ -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