Remove nfs-acls and nfs-dirlist scripts, all their features are supported by nfs-ls.nse script.

This commit is contained in:
djalal 2010-07-06 00:56:41 +00:00
parent 53b2b629dc
commit 98cf1dd7c4
5 changed files with 7 additions and 161 deletions

View file

@ -1,65 +0,0 @@
description = [[
Shows NFS exports and access controls.
]]
---
-- @output
-- PORT STATE SERVICE
-- 111/tcp open rpcbind
-- | nfs-acls:
-- | /tmp
-- | uid: 0; gid: 0; mode: drwxrwxrwx (1777)
-- | /home/storage/backup
-- | uid: 0; gid: 0; mode: drwxr-xr-x (755)
-- | /home
-- |_ uid: 0; gid: 0; mode: drwxr-xr-x (755)
--
-- Version 0.6
-- Created 11/23/2009 - v0.1 - created by Patrik Karlsson <patrik@cqure.net>
-- Revised 11/24/2009 - v0.2 - added RPC query to find mountd ports
-- Revised 11/24/2009 - v0.3 - added a hostrule instead of portrule
-- Revised 11/26/2009 - v0.4 - reduced packet sizes and documented them
-- Revised 01/24/2009 - v0.5 - complete rewrite, moved all NFS related code into nselib/nfs.lua
-- Revised 02/22/2009 - v0.6 - adapted to support new RPC library
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 status, mounts, attribs
local result = {}
status, mounts = rpc.Helper.ShowMounts( host, port )
if ( not(status) or mounts == nil ) then
return stdnse.format_output(false, mounts)
end
for _, mount in ipairs( mounts ) do
local item = {}
status, attribs = rpc.Helper.GetAttributes( host, port, mount.name )
item.name = mount.name
if ( status ) then
table.insert(item, ("uid: %d; gid: %d; mode: %s (%d)"):format(attribs.uid, attribs.gid, rpc.Util.ToAclText( attribs.mode ), rpc.Util.ToAclMode( attribs.mode )) )
else
table.insert(item, string.format("ERROR: %s", attribs))
end
table.insert(result, item)
end
return stdnse.format_output( true, result )
end

View file

@ -1,91 +0,0 @@
description = [[
Does a directory listing of a remote NFS share
]]
---
-- @output
-- PORT STATE SERVICE
-- 111/tcp open rpcbind
-- | nfs-dirlist:
-- | /home/storage/backup
-- | www.cqure.net
-- | /home
-- | admin
-- | lost+found
-- | patrik
-- | storage
-- |_ web
--
-- @args nfs-dirlist.maxfiles If set limits the amount of files returned by the
-- script for each export. If set to zero or less all files are shown.
-- (default 10)
-- Version 0.3
--
-- Created 01/25/2010 - v0.1 - created by Patrik Karlsson <patrik@cqure.net>
-- Revised 02/22/2010 - v0.2 - adapted to support new RPC library
-- Revised 03/13/2010 - v0.3 - converted host to port rule
-- Revised 03/28/2010 - v0.4 - changed and documented maxfiles argument
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 status, mounts
local result, files = {}, {}
local hasmore = false
local proto
status, mounts = rpc.Helper.ShowMounts( host, port )
if ( not(status) ) then
return stdnse.format_output(false, mounts)
end
for _, v in ipairs( mounts ) do
local files = {}
local status, dirlist = rpc.Helper.Dir(host, port, v.name)
if status and dirlist then
local max_files = tonumber(nmap.registry.args['nfs-dirlist.maxfiles']) or 10
hasmore = false
for _, v in ipairs( dirlist.entries ) do
if ( ( 0 < max_files ) and ( #files >= max_files ) ) then
hasmore = true
break
end
if v.name ~= ".." and v.name ~= "." then
table.insert(files, v.name)
end
end
table.sort(files)
if hasmore then
files.name = v.name .. string.format(" (Output limited to %d files, see nfs-dirlist.maxfiles)", max_files )
else
files.name = v.name
end
table.insert( result, files )
else
files.name = v.name
table.insert(files, string.format("ERROR: %s",dirlist))
table.insert( result, files )
end
end
return stdnse.format_output( true, result )
end

View file

@ -72,8 +72,6 @@ Entry { filename = "mysql-info.nse", categories = { "default", "discovery", "saf
Entry { filename = "mysql-users.nse", categories = { "discovery", "intrusive", } }
Entry { filename = "mysql-variables.nse", categories = { "discovery", "intrusive", } }
Entry { filename = "nbstat.nse", categories = { "default", "discovery", "safe", } }
Entry { filename = "nfs-acls.nse", categories = { "discovery", "safe", } }
Entry { filename = "nfs-dirlist.nse", categories = { "discovery", "safe", } }
Entry { filename = "nfs-ls.nse", categories = { "discovery", "safe", } }
Entry { filename = "nfs-showmount.nse", categories = { "discovery", "safe", } }
Entry { filename = "nfs-statfs.nse", categories = { "discovery", "safe", } }