mirror of
https://github.com/nmap/nmap.git
synced 2025-12-23 07:59:03 +00:00
change debug level for missing decoders, more indent cleanup
This commit is contained in:
@@ -296,54 +296,54 @@ Decoders = {
|
|||||||
|
|
||||||
process = function(self, layer3)
|
process = function(self, layer3)
|
||||||
local p = packet.Packet:new( layer3, #layer3 )
|
local p = packet.Packet:new( layer3, #layer3 )
|
||||||
-- IP Protocol is 89 for OSPF
|
-- IP Protocol is 89 for OSPF
|
||||||
if p.ip_p ~= 89 then return end
|
if p.ip_p ~= 89 then return end
|
||||||
|
|
||||||
local ospf = require("ospf")
|
local ospf = require("ospf")
|
||||||
local data = layer3:sub(p.ip_data_offset + 1)
|
local data = layer3:sub(p.ip_data_offset + 1)
|
||||||
local header = ospf.OSPF.Header.parse(data)
|
local header = ospf.OSPF.Header.parse(data)
|
||||||
if header then
|
if header then
|
||||||
if not(self.results) then
|
if not(self.results) then
|
||||||
self.results = tab.new(5)
|
self.results = tab.new(5)
|
||||||
tab.addrow(self.results, 'Source IP', 'Router ID', 'Area ID', 'Auth Type', 'Password')
|
tab.addrow(self.results, 'Source IP', 'Router ID', 'Area ID', 'Auth Type', 'Password')
|
||||||
end
|
|
||||||
local srcip = p.ip_src
|
|
||||||
local areaid = header.area_id
|
|
||||||
local routerid = header.router_id
|
|
||||||
local authtype = header.auth_type
|
|
||||||
local authdata
|
|
||||||
|
|
||||||
-- Format authentication type and data
|
|
||||||
if header.auth_type == 0 then
|
|
||||||
authtype = "None"
|
|
||||||
authdata = ''
|
|
||||||
elseif header.auth_type == 1 then
|
|
||||||
authtype = "Password"
|
|
||||||
authdata = header.auth_data.password
|
|
||||||
elseif header.auth_type == 2 then
|
|
||||||
authtype = "OSPF MD5"
|
|
||||||
authdata = "" -- Not really helpful, as the MD5
|
|
||||||
-- is applied to the whole packet+password
|
|
||||||
else
|
|
||||||
-- Error
|
|
||||||
stdnse.print_debug("Unknown OSPF auth type %d", header.auth_type)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if ( not(self.dups[("%s:%s"):format(routerid,areaid)]) ) then
|
|
||||||
if ( target.ALLOW_NEW_TARGETS ) then target.add(routerid) end
|
|
||||||
self.dups[("%s:%s"):format(routerid,areaid)] = true
|
|
||||||
tab.addrow( self.results, srcip, routerid, areaid, authtype, authdata)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
return nil
|
|
||||||
end
|
end
|
||||||
|
local srcip = p.ip_src
|
||||||
|
local areaid = header.area_id
|
||||||
|
local routerid = header.router_id
|
||||||
|
local authtype = header.auth_type
|
||||||
|
local authdata
|
||||||
|
|
||||||
|
-- Format authentication type and data
|
||||||
|
if header.auth_type == 0 then
|
||||||
|
authtype = "None"
|
||||||
|
authdata = ''
|
||||||
|
elseif header.auth_type == 1 then
|
||||||
|
authtype = "Password"
|
||||||
|
authdata = header.auth_data.password
|
||||||
|
elseif header.auth_type == 2 then
|
||||||
|
authtype = "OSPF MD5"
|
||||||
|
authdata = "" -- Not really helpful, as the MD5
|
||||||
|
-- is applied to the whole packet+password
|
||||||
|
else
|
||||||
|
-- Error
|
||||||
|
stdnse.print_debug("Unknown OSPF auth type %d", header.auth_type)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( not(self.dups[("%s:%s"):format(routerid,areaid)]) ) then
|
||||||
|
if ( target.ALLOW_NEW_TARGETS ) then target.add(routerid) end
|
||||||
|
self.dups[("%s:%s"):format(routerid,areaid)] = true
|
||||||
|
tab.addrow( self.results, srcip, routerid, areaid, authtype, authdata)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
return nil
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
getResults = function(self) return { name = "OSPF Hello", (self.results and tab.dump(self.results) or "") } end,
|
getResults = function(self) return { name = "OSPF Hello", (self.results and tab.dump(self.results) or "") } end,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
udp = {
|
udp = {
|
||||||
|
|
||||||
-- DHCP
|
-- DHCP
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ sniffInterface = function(iface, Decoders, decodertab)
|
|||||||
end
|
end
|
||||||
-- no decoder was found for this layer2 packet
|
-- no decoder was found for this layer2 packet
|
||||||
if ( not(decoded) and #data > 10 ) then
|
if ( not(decoded) and #data > 10 ) then
|
||||||
stdnse.print_debug(2, "No decoder for packet hex: %s", select(2, bin.unpack("H10", data) ) )
|
stdnse.print_debug(1, "No decoder for packet hex: %s", select(2, bin.unpack("H10", data) ) )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user