Nmap Development mailing list archives

[NSE Script] Banner Grabber


From: Kris Katterjohn <katterjohn () gmail com>
Date: Sun, 10 Jun 2007 14:35:30 -0500

Hey everyone!

I attached a very simple NSE script I wrote a little earlier (I just
really started trying out NSE).  It justs grabs banners from open ports
(timeouts after 3 seconds).

I made a banner grabber in C a looong time ago to learn, and of course
then and now a lot of banners give away version numbers and OS info.  I
know it's really simple (and some of you have probably written one
allready), but I was just thinking about if this script would be good to
ship along with Nmap, as it can be like an extremely lightweight version
and OS detector :)

Well, please let me know what you think, but be gentle :)

Thanks,
Kris Katterjohn
id = "Banner Grabber"

description = "Just grabs any banners"

author = "Kris Katterjohn <katterjohn () gmail com>"

license = "See Nmap's COPYING file for licence"

categories = { "safe" }

portrule = function(host, port)
        return port.state == "open"
end

action = function(host, port)
        local socket = nmap.new_socket()

        socket:set_timeout(3000)
        socket:connect(host.ip, port.number, port.protocol)
        
        local status, result = socket:receive_lines(1)

        socket:close()

        if result ~= "TIMEOUT" then
                return result
        end
end

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: