mirror of
https://github.com/nmap/nmap.git
synced 2025-12-19 14:09:02 +00:00
Fixed bug that would fail to calculate a PADI host unique value in the pppoe
library under certain circumstances. Fixed bug that would fail to terminate script properly if no response was received from pppoe server. [Patrik]
This commit is contained in:
@@ -434,12 +434,19 @@ PPPoE = {
|
|||||||
-- @param value string/number containing the tag value
|
-- @param value string/number containing the tag value
|
||||||
-- @return o instance of ConfigNak
|
-- @return o instance of ConfigNak
|
||||||
new = function(self, tags)
|
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
|
||||||
|
|
||||||
local o = {
|
local o = {
|
||||||
header = PPPoE.Header:new(PPPoE.Code.PADI),
|
header = PPPoE.Header:new(PPPoE.Code.PADI),
|
||||||
tags = tags or {
|
tags = tags or {
|
||||||
PPPoE.Tag:new(PPPoE.TagType.SERVICE_NAME),
|
PPPoE.Tag:new(PPPoE.TagType.SERVICE_NAME),
|
||||||
PPPoE.Tag:new(PPPoE.TagType.HOST_UNIQUE, bin.pack("H",
|
PPPoE.Tag:new(PPPoE.TagType.HOST_UNIQUE, bin.pack("H", c))
|
||||||
tostring(coroutine.running()):match("^thread: 0x(........)")))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setmetatable(o, self)
|
setmetatable(o, self)
|
||||||
|
|||||||
@@ -32,7 +32,9 @@ require 'pppoe'
|
|||||||
prerule = function() return true end
|
prerule = function() return true end
|
||||||
|
|
||||||
local function fail(err)
|
local function fail(err)
|
||||||
return ("\n ERROR: %s"):format(err)
|
if ( err ) then
|
||||||
|
return ("\n ERROR: %s"):format(err)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function mac_tostr(mac)
|
local function mac_tostr(mac)
|
||||||
|
|||||||
Reference in New Issue
Block a user