mirror of
https://github.com/nmap/nmap.git
synced 2026-01-25 15:49:02 +00:00
Update skypev2-version.nse to match how it's shown in scripting.xml.
This commit is contained in:
@@ -8,50 +8,35 @@ categories = {"version"}
|
||||
require "comm"
|
||||
|
||||
portrule = function(host, port)
|
||||
if (port.number == 80 or
|
||||
port.number == 443 or
|
||||
port.service == nil or
|
||||
port.service == "" or
|
||||
port.service == "unknown")
|
||||
and port.protocol == "tcp"
|
||||
and port.state == "open"
|
||||
and port.service ~= "http"
|
||||
and port.service ~= "ssl/http"
|
||||
then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
return (port.number == 80 or port.number == 443 or
|
||||
port.service == nil or port.service == "" or
|
||||
port.service == "unknown")
|
||||
and port.protocol == "tcp" and port.state == "open"
|
||||
and port.service ~= "http" and port.service ~= "ssl/http"
|
||||
end
|
||||
|
||||
action = function(host, port)
|
||||
local status, result = comm.exchange(host, port,
|
||||
"GET / HTTP/1.0\r\n\r\n", {bytes=26, proto=port.protocol})
|
||||
local status, result = comm.exchange(host, port,
|
||||
"GET / HTTP/1.0\r\n\r\n", {bytes=26, proto=port.protocol})
|
||||
if (not status) then
|
||||
return
|
||||
end
|
||||
if (result ~= "HTTP/1.0 404 Not Found\r\n\r\n") then
|
||||
return
|
||||
end
|
||||
-- So far so good, now see if we get random data for another request
|
||||
status, result = comm.exchange(host, port,
|
||||
"random data\r\n\r\n", {bytes=15, proto=port.protocol})
|
||||
|
||||
if (not status) then
|
||||
return
|
||||
end
|
||||
|
||||
if (result ~= "HTTP/1.0 404 Not Found\r\n\r\n") then
|
||||
return
|
||||
end
|
||||
|
||||
-- So far so good, now see if we get random data for another request
|
||||
|
||||
status, result = comm.exchange(host, port,
|
||||
"random data\r\n\r\n", {bytes=15, proto=port.protocol})
|
||||
|
||||
if (not status) then
|
||||
return
|
||||
end
|
||||
|
||||
if string.match(result, "[^%s!-~].*[^%s!-~].*[^%s!-~]") then
|
||||
-- Detected
|
||||
port.version.name = "skype2"
|
||||
port.version.product = "Skype"
|
||||
nmap.set_port_version(host, port, "hardmatched")
|
||||
return
|
||||
end
|
||||
|
||||
return
|
||||
if (not status) then
|
||||
return
|
||||
end
|
||||
if string.match(result, "[^%s!-~].*[^%s!-~].*[^%s!-~]") then
|
||||
-- Detected
|
||||
port.version.name = "skype2"
|
||||
port.version.product = "Skype"
|
||||
nmap.set_port_version(host, port, "hardmatched")
|
||||
return
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user