Nmap Development mailing list archives
Re: [PATCH] Pcap recv time for NSE scripts, qscan.nse update
From: Kris Katterjohn <katterjohn () gmail com>
Date: Fri, 23 Jul 2010 14:52:29 -0500
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 07/23/2010 12:33 PM, David Fifield wrote:
On Fri, Jul 23, 2010 at 05:45:12AM -0500, Kris Katterjohn wrote:On 07/22/2010 09:50 AM, David Fifield wrote:clock_ms was a mistake. It should have been called simply "clock" and returned a floating-point number of seconds. It bothers me that clock_ms deliberately degrades the information it has to provide millisecond precision.Indeed. Any plans for creating a new clock() function? I'm not sure what to do with clock_ms() other than mark it deprecated or something equally lame.A clock function would be welcome. I would just stop using clock_ms.
Cool, sounds good to me.
It could be cool for a new clock() function to support an optional argument for a time specifier like "s" for seconds, "ms" for msecs and (I guess) "us" for usecs. I doubt clock() would need anything larger than "s" like the other formats Nmap uses. Or at least have a stdnse function for keeping the converting out of scripts, kinda like parse_timespec().I think this would be pretty easy: function clock_ms() return clock() * 1000 end function clock_us() return clock() * 1000000 end The possibilities for what someone would want (ms, us) are limited, so I think it's a good idea just to define separate functions.
OK, doing it separately makes enough sense. I've just committed this as 19163: * Adds nmap.clock() * Adds stdnse.clock_ms() and stdnse.clock_us() * Updates qscan.nse with usec resolution. This just leaves slightly bigger numbers in the output (I prefer this compared to manipulating the times for calculation or presentation, which was the issue to begin with). The new @output with the host forwarding telnet and httpd: | qscan: | PORT FAMILY MEAN (us) STDDEV LOSS (%) | 21 0 2082.70 460.72 0.0% | 22 0 2211.70 886.69 0.0% | 23 1 4631.90 606.67 0.0% | 24 0 1922.40 336.90 0.0% | 25 0 2017.30 404.31 0.0% | 80 1 4180.80 856.98 0.0% |_443 0 2013.30 368.91 0.0%
David Fifield
Cheers, Kris Katterjohn -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJMSfL8AAoJEEQxgFs5kUfuZtoP/0XtaQWmCCbiQTVxvD5eVNM0 IdSTKeczFXXL7vxmB8+kne2Rpolk5d9a0g3MZwi02VKxcpfqJtHp1bcvuwZG/yvb FNJp88yMSMq2vEea0fXaq9052HyhgMYTD5NrQ1UHdrtAHzUy+4ZCWEv0VRJRd4di YeQePvTg/q2vQoYgiGBgZM7A/8NveicsiD7R0gc1q03m1hZaRbjfK/NxTpFuXlpE 32RhH2n9oQiGcVHb6pTSwUzXNMMNb+UnMze3y3rp5ayPoAybVmTu7BGqVzetDXJJ bIuKABAhWnQhI779x/eT8Erlyj1vCRQu/JP9T8WcDBQW4GQwwKDKLWFGLMYepbx5 mHe4r6IyaDOMWp0FbSoEKzir6YFjOjQeBKvlq+xpGKmm2RtcRinnn/m467yi0gW9 Hbshz8cexPdnpOTB88o4VLTCXO4ibDX3XoWtCa5Bhdrj0t+nFWbEwI6M+Z875BbB 0L0sUutYhLp/QWMNERn9889H3nshr4aJhJ5uHsskHaDgyNUP0Q11SCGJeabJjLLQ n9IGA4CZPSy/MtTWGIyuNIrjcfdGSHbxTT24k9jqBJCjKoXpbD8UqXG0CV6L70EQ 5ftSjl89duQvofjZTeGOhD53WSSmxAmEa50CyxZIDfxvteM3nuuwZHhOmxkqiU4h ZqSIcSjc2Rees7ytQHhw =rbtj -----END PGP SIGNATURE----- _______________________________________________ Sent through the nmap-dev mailing list http://cgi.insecure.org/mailman/listinfo/nmap-dev Archived at http://seclists.org/nmap-dev/
Current thread:
- [PATCH] Pcap recv time for NSE scripts, qscan.nse update Kris Katterjohn (Jul 21)
- Re: [PATCH] Pcap recv time for NSE scripts, qscan.nse update majek04 (Jul 22)
- Re: [PATCH] Pcap recv time for NSE scripts, qscan.nse update Kris Katterjohn (Jul 23)
- Re: [PATCH] Pcap recv time for NSE scripts, qscan.nse update David Fifield (Jul 22)
- Re: [PATCH] Pcap recv time for NSE scripts, qscan.nse update Kris Katterjohn (Jul 23)
- Re: [PATCH] Pcap recv time for NSE scripts, qscan.nse update David Fifield (Jul 23)
- Re: [PATCH] Pcap recv time for NSE scripts, qscan.nse update Kris Katterjohn (Jul 23)
- Re: [PATCH] Pcap recv time for NSE scripts, qscan.nse update Kris Katterjohn (Jul 23)
- Re: [PATCH] Pcap recv time for NSE scripts, qscan.nse update majek04 (Jul 22)