Nmap Development mailing list archives

[NSE patch] HTTPS support for showHTMLTitle


From: Sven Klemm <sven () c3d2 de>
Date: Thu, 28 Jun 2007 13:49:28 +0200

Hi

attached is a patch that adds https support to showHTMLTitle. It uses
the port number to decide whether ssl is required or not. There is
probably a better way to detect whether ssl is needed, but in the soc
branch http and https both show up as service "http".

Is there a way I can access the command line parameters of nmap from
within lua?

Cheers,
Sven
Index: scripts/showHTMLTitle.nse
===================================================================
--- scripts/showHTMLTitle.nse   (revision 5043)
+++ scripts/showHTMLTitle.nse   (working copy)
@@ -21,13 +21,19 @@
 --end
 
 action = function(host, port)
-       local url, socket, request, result, status, s, title
+       local url, socket, request, result, status, s, title, protocol
 
        url = "http://"; .. host.name
 
        socket = nmap.new_socket()
 
-       socket:connect(host.ip, port.number)
+       if port.number == 443 then
+               protocol = "ssl"
+       else
+               protocol = "tcp"
+       end
+  
+       socket:connect(host.ip, port.number, protocol )
        request = "GET / HTTP/1.0\r\n\r\n"
        socket:send(request)
 

Attachment: signature.asc
Description: OpenPGP digital signature


_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org

Current thread: