1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-02 12:59:02 +00:00

Create a shortport.ssl function like shortport.http. Use it in ssl

scripts.
This commit is contained in:
david
2011-02-22 00:46:28 +00:00
parent 0b4de98d24
commit c3ab2d5ea4
4 changed files with 26 additions and 57 deletions

View File

@@ -66,6 +66,7 @@ categories = { "safe", "discovery" }
require("nmap")
require("nsedebug")
require("shortport")
require("stdnse")
local stringify_name
@@ -73,12 +74,10 @@ local date_to_string
local table_find
local s
local LIKELY_SSL_PORTS = { 443, 465, 989, 990, 992, 993, 994, 995, 587, 8443 }
local STARTTLS_PORTS = { 25, 587 }
portrule = function(host, port)
return port.version.service_tunnel == "ssl"
or table_find(LIKELY_SSL_PORTS, port.number) or table_find(STARTTLS_PORTS, port.number)
return shortport.ssl(host, port) or table_find(STARTTLS_PORTS, port.number)
end
action = function(host, port)

View File

@@ -76,37 +76,6 @@ require("nmap")
require("shortport")
require("stdnse")
local SSL_PORTS = {
443,
465,
587,
636,
989,
990,
992,
993,
994,
995,
5061,
6679,
6697,
8443
}
local SSL_SERVICES = {
"ftps",
"ftps-data",
"https",
"https-alt",
"imaps",
"ircs",
"ldapssl",
"pop3s",
"sip-tls",
"smtps",
"telnets"
}
-- Most of the values in the tables below are from:
-- http://www.iana.org/assignments/tls-parameters/
PROTOCOLS = {
@@ -735,24 +704,7 @@ local function try_protocol(host, port, protocol)
return results
end
portrule = function(host, port)
local is_ssl = shortport.port_or_service(SSL_PORTS, SSL_SERVICES)
-- This script only handles SSL/TLS over TCP.
if port.protocol ~= "tcp" then
return false
end
if port.version.service_tunnel == "ssl" then
return true
end
if is_ssl(host, port) then
return true
end
return false
end
portrule = shortport.ssl
action = function(host, port)
local name, result, results

View File

@@ -21,11 +21,7 @@ categories = {"default", "safe"}
require "shortport"
local portfunction = shortport.port_or_service({443,993,995},{'https','imaps','pop3s'})
portrule = function( host, port )
return portfunction( host, port ) or port.version.service_tunnel == 'ssl'
end
portrule = shortport.ssl
hex2dec = function(hex)