mirror of
https://github.com/nmap/nmap.git
synced 2025-12-28 02:19:04 +00:00
Fix an error in iax2-version
The logic:
byte12 == ("03" or "04")
is the same as:
byte12 == "03"
so the second comparison was never able to succeed.
Additionally, some expressions were simplified, such as not formatting
numbers into strings in order to compare them.
This commit is contained in:
@@ -27,9 +27,7 @@ portrule = shortport.version_port_or_service(4569, nil, "udp")
|
||||
|
||||
action = function(host, port)
|
||||
-- see http://www.cornfed.com/iax.pdf for all options.
|
||||
local poke = string.char(0x80, 0x00, 0x00, 0x00)
|
||||
poke = poke .. string.char(0x00, 0x00, 0x00, 0x00)
|
||||
poke = poke .. string.char(0x00, 0x00, 0x06, 0x1e)
|
||||
local poke = "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x06\x1e"
|
||||
|
||||
local status, recv = comm.exchange(host, port, poke, {proto=port.protocol,timeout=10000})
|
||||
|
||||
@@ -38,13 +36,13 @@ action = function(host, port)
|
||||
end
|
||||
|
||||
if (#recv) == 12 then
|
||||
local byte11 = string.format("%02X", string.byte(recv, 11))
|
||||
local byte12 = string.format("%02X", string.byte(recv, 12))
|
||||
local byte11 = string.byte(recv, 11)
|
||||
local byte12 = string.byte(recv, 12)
|
||||
|
||||
-- byte11 must be \x06 IAX Control Frame
|
||||
-- and byte12 must be \x03 or \x04
|
||||
if ((byte11 == "06") and
|
||||
(byte12 == ("03" or "04")))
|
||||
if ((byte11 == 6) and
|
||||
(byte12 == 3 or byte12 == 4))
|
||||
then
|
||||
nmap.set_port_state(host, port, "open")
|
||||
port.version.name = "iax2"
|
||||
|
||||
Reference in New Issue
Block a user