mirror of
https://github.com/nmap/nmap.git
synced 2025-12-23 07:59:03 +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:
@@ -8,18 +8,15 @@ license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
|
||||
|
||||
categories = {"demo"}
|
||||
|
||||
require "comm"
|
||||
require "shortport"
|
||||
|
||||
portrule = shortport.port_or_service(13, "daytime", "udp")
|
||||
|
||||
action = function(host, port)
|
||||
local socket = nmap.new_socket()
|
||||
socket:connect(host.ip, port.number, "udp")
|
||||
socket:send("dummy")
|
||||
local status, result = socket:receive_lines(1);
|
||||
socket:close()
|
||||
local status, result = comm.exchange(host, port, "dummy", {lines=1, proto="udp"})
|
||||
|
||||
if (result ~= nil) then
|
||||
if status then
|
||||
return "Daytime: " .. result
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user