1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-05 22:19:03 +00:00

o [NSE] When receiving raw packets from Pcap, the packet capture time

is now available to scripts as an additional return value from
  pcap_receive().  It is returned as the floating point number of
  seconds since the epoch.  The qscan.nse script was updated to use
  this more accurate data instead of using the clock_ms() function
  (which returns the current time). [Kris]
This commit is contained in:
kris
2010-07-23 10:43:04 +00:00
parent 9b5d9af236
commit ee3c89afe4
4 changed files with 28 additions and 8 deletions

View File

@@ -367,7 +367,7 @@ action = function(host)
local saddr = packet.toip(host.bin_ip_src)
local daddr = packet.toip(host.bin_ip)
local port
local start, stop
local start
local rtt
local stats = {}
local try = nmap.new_try()
@@ -410,9 +410,15 @@ action = function(host)
stats[j].sent = stats[j].sent + 1
local status, len, _, pkt = pcap:pcap_receive()
local status, len, _, pkt, stop = pcap:pcap_receive()
stop = nmap.clock_ms()
if not stop then
-- probably a timeout, just grab current time
stop = nmap.clock_ms()
else
-- we gotta use msecs
stop = stop * 1000
end
rtt = stop - start