diff --git a/docs/scripting.xml b/docs/scripting.xml index c8e20ee31..d0927ed81 100644 --- a/docs/scripting.xml +++ b/docs/scripting.xml @@ -1146,7 +1146,7 @@ action refer to . Connect-style I/O - + require("nmap") local socket = nmap.new_socket() @@ -1155,7 +1155,8 @@ try = nmap.new_try(function() socket:close() end) try(socket:connect(host.ip, port.number)) try(socket:send("login")) response = try(socket:receive()) -socket:close() +socket:close() + @@ -1701,7 +1702,7 @@ local localip, localport = client_service:get_info() is a DocBook tag so it will disappear within a programlisting! --> An NSEDoc comment for a function - + --- Prints a formatted debug message if the current verbosity level is greater -- than or equal to a given level. -- @@ -1713,7 +1714,7 @@ local localip, localport = client_service:get_info() -- @param level Optional verbosity level. -- @param fmt Format string. -- @param ... Arguments to format. - + @@ -1754,7 +1755,7 @@ local localip, localport = client_service:get_info() An NSEDoc comment for a module - + --- Common communication functions for network discovery tasks like -- banner grabbing and data exchange. -- @@ -1767,7 +1768,7 @@ local localip, localport = client_service:get_info() -- <code>set_timeout()</code> for details). -- @author Kris Katterjohn 04/2008 -- @copyright Same as Nmap--See http://nmap.org/book/man-legal.html - + @@ -1792,7 +1793,7 @@ local localip, localport = client_service:get_info() An NSEDoc comment for a script - + id = "AS Numbers" description = [[ Maps IP addresses to autonomous system (AS) numbers. @@ -1820,7 +1821,7 @@ use by Nmap. author = "jah, Michael" license = "Same as Nmap--See http://nmap.org/book/man-legal.html" categories = {"discovery", "external"} - + NSE Documentation Tags @@ -2012,52 +2013,52 @@ categories = {"version"} require "comm" portrule = function(host, port) - if (port.number == 80 or - port.number == 443 or - port.service == nil or - port.service == "" or - port.service == "unknown") - and port.protocol == "tcp" - and port.state == "open" - and port.service ~= "http" - and port.service ~= "ssl/http" - then - return true - else - return false - end + if (port.number == 80 or + port.number == 443 or + port.service == nil or + port.service == "" or + port.service == "unknown") + and port.protocol == "tcp" + and port.state == "open" + and port.service ~= "http" + and port.service ~= "ssl/http" + then + return true + else + return false + end end action = function(host, port) - local status, result = comm.exchange(host, port, - "GET / HTTP/1.0\r\n\r\n", {bytes=26, proto=port.protocol}) + local status, result = comm.exchange(host, port, + "GET / HTTP/1.0\r\n\r\n", {bytes=26, proto=port.protocol}) - if (not status) then - return - end + if (not status) then + return + end - if (result ~= "HTTP/1.0 404 Not Found\r\n\r\n") then - return - end - - -- So far so good, now see if we get random data for another request + if (result ~= "HTTP/1.0 404 Not Found\r\n\r\n") then + return + end + + -- So far so good, now see if we get random data for another request - status, result = comm.exchange(host, port, - "random data\r\n\r\n", {bytes=15, proto=port.protocol}) + status, result = comm.exchange(host, port, + "random data\r\n\r\n", {bytes=15, proto=port.protocol}) - if (not status) then - return - end + if (not status) then + return + end - if string.match(result, "[^%s!-~].*[^%s!-~].*[^%s!-~]") then - -- Detected - port.version.name = "skype2" - port.version.product = "Skype" - nmap.set_port_version(host, port, "hardmatched") - return - end + if string.match(result, "[^%s!-~].*[^%s!-~].*[^%s!-~]") then + -- Detected + port.version.name = "skype2" + port.version.product = "Skype" + nmap.set_port_version(host, port, "hardmatched") + return + end - return + return end