Nmap Development mailing list archives

Re: [nmap-svn] r27799 - in nmap: nselib scripts


From: Patrick Donnelly <batrick () batbytes com>
Date: Tue, 10 Jan 2012 20:07:47 -0500

Hi Patrik,

On Tue, Jan 10, 2012 at 4:08 PM,  <commit-mailer () insecure org> wrote:
==============================================================================
--- nmap/nselib/pppoe.lua       (original)
+++ nmap/nselib/pppoe.lua       Tue Jan 10 13:08:20 2012
@@ -434,12 +434,19 @@
               -- @param value string/number containing the tag value
               -- @return o instance of ConfigNak
               new = function(self, tags)
+                       local c = tostring(coroutine.running())
+                       c = c:match("^thread: 0x(.*)"):sub(1, 8)
+
+                       math.randomseed(os.time())
+                       while ( #c < 8 ) do
+                               c = c .. stdnse.tohex(math.random(255))
+                       end
+

What's the purpose of getting a string ID for the thread? The Lua
tostring function on a coroutine/table makes me nervous unless it's
for debugging.

Also, math.randomseed is set in nse_main.cc (via srand()) so no need
calling it anywhere else.

-- 
- Patrick Donnelly
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/

Current thread: