mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Fix a packet check: command should be Response, need 'or' not 'and'
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
local bin = require "bin"
|
|
||||||
local ipOps = require "ipOps"
|
local ipOps = require "ipOps"
|
||||||
local nmap = require "nmap"
|
local nmap = require "nmap"
|
||||||
local stdnse = require "stdnse"
|
local stdnse = require "stdnse"
|
||||||
|
local string = require "string"
|
||||||
local tab = require "tab"
|
local tab = require "tab"
|
||||||
local table = require "table"
|
local table = require "table"
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ RIPv2 = {
|
|||||||
-- RIPv2 stuff, should be 0 for RIPv1
|
-- RIPv2 stuff, should be 0 for RIPv1
|
||||||
local tag, subnet, nexthop = 0, 0, 0
|
local tag, subnet, nexthop = 0, 0, 0
|
||||||
|
|
||||||
local data = bin.pack(">CCSSSIIII",
|
local data = string.pack(">BB I2 I2 I2 I4 I4 I4 I4",
|
||||||
self.command, self.version, self.domain, self.family, self.tag,
|
self.command, self.version, self.domain, self.family, self.tag,
|
||||||
self.address, self.subnet, self.nexthop, self.metric)
|
self.address, self.subnet, self.nexthop, self.metric)
|
||||||
|
|
||||||
@@ -112,9 +112,9 @@ RIPv2 = {
|
|||||||
if ( not(data) or #data < 3 ) then
|
if ( not(data) or #data < 3 ) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local pos
|
local pos, _
|
||||||
pos, o.command, o.version = bin.unpack(">CCS", data)
|
o.command, o.version, _, pos = string.unpack(">BBI2", data)
|
||||||
if ( o.command ~= RIPv2 and o.version ~= 2 ) then
|
if ( o.command ~= RIPv2.Command.Response or o.version ~= 2 ) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -122,9 +122,9 @@ RIPv2 = {
|
|||||||
tab.addrow(routes, "ip", "netmask", "nexthop", "metric")
|
tab.addrow(routes, "ip", "netmask", "nexthop", "metric")
|
||||||
|
|
||||||
while( #data - pos >= 20 ) do
|
while( #data - pos >= 20 ) do
|
||||||
local family, address, metric, _, netmask, nexthop
|
local family, address, metric, netmask, nexthop
|
||||||
pos, family, _, address, netmask, nexthop,
|
family, _, address, netmask, nexthop,
|
||||||
metric = bin.unpack(">SSIIII", data, pos)
|
metric, pos = string.unpack(">I2 I2 I4 I4 I4 I4", data, pos)
|
||||||
|
|
||||||
if ( family == RIPv2.AddressFamily.IP ) then
|
if ( family == RIPv2.AddressFamily.IP ) then
|
||||||
local ip = ipOps.fromdword(address)
|
local ip = ipOps.fromdword(address)
|
||||||
|
|||||||
Reference in New Issue
Block a user