mirror of
https://github.com/nmap/nmap.git
synced 2025-12-08 13:41:29 +00:00
merge soc07 r4798 - Attempts to connect to a hosts finger service and extracts a list of usernames
This commit is contained in:
44
scripts/finger.nse
Normal file
44
scripts/finger.nse
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
id="Finger Results"
|
||||||
|
|
||||||
|
description="attempts to get a list of usernames via the finger service"
|
||||||
|
|
||||||
|
author = "Eddie Bell <ejlbell@gmail.com>"
|
||||||
|
|
||||||
|
license = "See nmaps COPYING for licence"
|
||||||
|
|
||||||
|
categories = {"discovery"}
|
||||||
|
|
||||||
|
portrule = function(host, port)
|
||||||
|
if (port.number == 79
|
||||||
|
or port.service == "finger")
|
||||||
|
and port.protocol == "tcp"
|
||||||
|
and port.state == "open"
|
||||||
|
then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
action = function(host, port)
|
||||||
|
local socket = nmap.new_socket()
|
||||||
|
local results = ""
|
||||||
|
local status = true
|
||||||
|
|
||||||
|
local err_catch = function()
|
||||||
|
socket:close()
|
||||||
|
end
|
||||||
|
|
||||||
|
local try = nmap.new_try(err_catch())
|
||||||
|
|
||||||
|
socket:set_timeout(5000)
|
||||||
|
try(socket:connect(host.ip, port.number, port.protocol))
|
||||||
|
try(socket:send("\n\r"))
|
||||||
|
|
||||||
|
status, results = socket:receive_lines(100)
|
||||||
|
socket:close()
|
||||||
|
|
||||||
|
if status then
|
||||||
|
return results
|
||||||
|
end
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user