jah  committed ceee19d Draft

Pass "ssl" as the third paramater to connect() in pop3.lua capabilities() and
smtp-commands.nse if version detection set the port service_tunnel to "ssl".

  • Participants
  • Parent commits f4836b3

Comments (0)

Files changed (2)

File nselib/pop3.lua

    local socket = nmap.new_socket()
    local capas = {}
-   if not socket:connect(host.ip, port.number) then return nil, "Could Not Connect" end
+   local proto = (port.version and port.version.service_tunnel == "ssl" and "ssl") or "tcp"
+   if not socket:connect(host.ip, port.number, proto) then return nil, "Could Not Connect" end
    status, line = socket:receive_lines(1)
    if not stat(line) then return nil, "No Response" end

File scripts/smtp-commands.nse

 	local try = nmap.new_try(catch)
-	local attempt = try(socket:connect(host.ip, port.number, port.protocol))
+	local proto = (port.version and port.version.service_tunnel == "ssl" and "ssl") or port.protocol
+	local attempt = try(socket:connect(host.ip, port.number, proto))
 	if attempt then
 		if nmap.verbosity() >= 2 or nmap.debugging() >= 1 then -- only tell you it fails if you are debugging or verbose X 2
-			return "Problem connecting to " .. host.ip .. " on port " .. port.number .. " using protocol " .. port.protocol
+			return ("Problem connecting to %s on port %d using protocol %s%s"):format(host.ip, port.number, port.protocol, (proto == "ssl" and " (ssl)") or "")
 			return -- if you aren't debugging, just return with nothing