1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-23 16:09:02 +00:00

o Added a new NSE Comm library for common network discovery tasks such

as banner-grabbing (get_banner()) and making a quick exchange of data
  (exchange()).  16 scripts were updated to use this library. [Kris]

I have *not* been able to test all of these scripts; however, I have
reviewed them and they should all work properly.  I would really like
some more testing, though :)

This commit includes scripting.xml documentation.
This commit is contained in:
kris
2008-06-12 14:32:25 +00:00
parent cede9ab542
commit 2f9321360f
19 changed files with 297 additions and 268 deletions

View File

@@ -18,6 +18,7 @@ license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"discovery"}
require "comm"
require "shortport"
require "stdnse"
@@ -76,31 +77,14 @@ end
portrule = shortport.port_or_service({80, 8080}, "http")
action = function(host, port)
local cmd, response
local socket
local cmd = "TRACE / HTTP/1.0\r\n\r\n"
socket = nmap.new_socket()
local status, response = comm.exchange(host, port, cmd, {timeout=5000})
socket:connect(host.ip, port.number)
cmd = "TRACE / HTTP/1.0\r\n\r\n"
socket:send(cmd)
response = ""
while true do
local status, lines = socket:receive_lines(1)
if not status then
break
end
response = response .. lines
if not status then
return
end
socket:close()
return validate(response, cmd)
end