Nmap Development mailing list archives

Re: [NSE] small improvement to ftp-anon


From: David Fifield <david () bamsoftware com>
Date: Fri, 27 Aug 2010 14:10:10 -0600

On Tue, Aug 17, 2010 at 11:59:43PM +0200, Gutek wrote:
Le 17/08/2010 02:34, David Fifield a écrit :
This looks pretty good and it works for me. I would like you to make
some changes, though. First, the file listing should be controlled by a
script argument, not verbosity() >= 2. I think I would just make it the
default. There needs to be a limit on the number of lines that it will
retrieve, like nfs-ls. And the code that gets the file listing should be
a separate function, expecially seeing as it creates a new socket and
everything.

Please find attached the new script accordingly.
It now requires --script-args dirlist=<nbr of lines returned> and in the
case of a typo (for example a string instead of a number) the default
output will be 4 lines long.
I've choosen 4 lines because often the listing starts with either/both
.(current) and ..(parent), so we have at least 2 directories names to
get an idea of what kind of ftp server we are facing (mail service,
webcams, other devices...)

Thanks. I adapted your patch and committed it. As for default output, I
decided to do a directory listing of 20 items by default, and unlimited
with verbosity. I changed the name of the script argument to
ftp-anon.maxlist.

Anyway, if the dir listing was truncated it also prints
|_(x more entries)

One of my ideas behind limiting the output by default was to protect
against a remote server stalling Nmap by sending thousands of lines of
data. Therefore I rewrote this part to stop reading after it has read
the limit, instead of reading all and then showing only the first
entries.

David Fifield
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/

Current thread: