1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-02 12:59:02 +00:00

Modified code used to create the PPPoE host unique tag [Patrik]

This commit is contained in:
patrik
2012-01-11 18:21:24 +00:00
parent 48fea78cb4
commit 0469654acf

View File

@@ -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)