1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 06:01:28 +00:00
Files
nmap/scripts/showSMTPVersion.nse
2008-04-09 09:55:03 +00:00

32 lines
586 B
Lua

id = "SMTP version"
description = "Simple script which queries and prints the version of an SMTP server."
author = "Diman Todorov <diman.todorov@gmail.com>"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"demo"}
require "shortport"
portrule = shortport.port_or_service(25, "smtp")
action = function(host, port)
local client = nmap.new_socket()
client:connect(host.ip, port.number)
local status, result = client:receive_lines(1);
client:close()
if result ~= nil then
result = string.gsub(result, "\n", "")
end
return result
end