Nmap Development mailing list archives

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


From: Patrik Karlsson <patrik () cqure net>
Date: Wed, 11 Jan 2012 19:22:41 +0100

On Wed, Jan 11, 2012 at 2:07 AM, Patrick Donnelly <batrick () batbytes com>wrote:

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.


No need to be nervous in this case really, but I changed the code anyway as
it was just bad and ugly :)



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


Ok, thanks!
//Patrik

-- 
Patrik Karlsson
http://www.cqure.net
http://twitter.com/nevdull77
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: