From 0469654acf305b3068175a70e628d5d82f27d77b Mon Sep 17 00:00:00 2001 From: patrik Date: Wed, 11 Jan 2012 18:21:24 +0000 Subject: [PATCH] Modified code used to create the PPPoE host unique tag [Patrik] --- nselib/pppoe.lua | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/nselib/pppoe.lua b/nselib/pppoe.lua index d5576c9bb..3dfd2de02 100644 --- a/nselib/pppoe.lua +++ b/nselib/pppoe.lua @@ -434,19 +434,16 @@ PPPoE = { -- @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)) + local c = "" + for i=1, 4 do + c = c .. math.random(255) end local o = { header = PPPoE.Header:new(PPPoE.Code.PADI), tags = tags or { PPPoE.Tag:new(PPPoE.TagType.SERVICE_NAME), - PPPoE.Tag:new(PPPoE.TagType.HOST_UNIQUE, bin.pack("H", c)) + PPPoE.Tag:new(PPPoE.TagType.HOST_UNIQUE, bin.pack("A", c)) } } setmetatable(o, self)