1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-20 14:39:02 +00:00
Files
nmap/scripts/rpcinfo.nse
patrik dd9a237fe2 o [NSE] Added RPC library and three new NFS scripts. Modified the rpcinfo and
nfs-showmount scripts to use the new library. The new scripts are:
  - nfs-acls shows the owner and directory mode of NFS exports
  - nfs-dirlist lists the contents of NFS exports
  - nfs-statfs shows file system statistics for NFS exports
  [Patrik]
2010-03-21 17:56:17 +00:00

47 lines
1.2 KiB
Lua

description = [[
Connects to portmapper and fetches a list of all registered programs.
]]
---
-- @output
-- PORT STATE SERVICE
-- 111/tcp open rpcbind
-- | rpcinfo:
-- | 100000 2 111/tcp rpcbind
-- | 100000 2 111/udp rpcbind
-- | 100003 2 2049/tcp nfs
-- | 100003 2 2049/udp nfs
-- | 100005 1,2 953/udp mountd
-- | 100005 1,2 956/tcp mountd
-- | 100024 1 55145/tcp status
-- |_ 100024 1 59421/udp status
author = "Patrik Karlsson"
license = "Same as Nmap--See http://nmap.org/book/man-legal.html"
categories = {"discovery", "safe"}
require 'shortport'
require 'rpc'
portrule = shortport.port_or_service(111, "rpcbind", {"tcp", "udp"} )
action = function(host, port)
local result = {}
local status, rpcinfo = rpc.Helper.RpcInfo( host, port )
if ( not(status) ) then
return
end
for progid, v in pairs(rpcinfo) do
for proto, v2 in pairs(v) do
table.insert( result, ("%-7d %-10s %5d/%s %s"):format(progid, stdnse.strjoin(",", v2.version), v2.port, proto, rpc.Util.ProgNumberToName(progid) ) )
end
end
table.sort(result)
return stdnse.format_output( true, result )
end