Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 11 Jan 2004 16:36:29 +0000
From:      Matthew Seaman <m.seaman@infracaninophile.co.uk>
To:        Malcolm Kay <malcolm.kay@internode.on.net>
Cc:        FreeBSD Questions <freebsd-questions@freebsd.org>
Subject:   Re: Download contents of http directory?
Message-ID:  <20040111163629.GA12774@happy-idiot-talk.infracaninophile.co.uk>
In-Reply-To: <200401120018.52511.malcolm.kay@internode.on.net>
References:  <20040110224342.23710.qmail@web13910.mail.yahoo.com> <200401111653.52614.malcolm.kay@internode.on.net> <20040111120559.GB10388@happy-idiot-talk.infracaninophile.co.uk> <200401120018.52511.malcolm.kay@internode.on.net>

next in thread | previous in thread | raw e-mail | index | archive | help

--17pEHd4RhPHOinZp
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Mon, Jan 12, 2004 at 12:18:52AM +1030, Malcolm Kay wrote:
> On Sun, 11 Jan 2004 22:35, Matthew Seaman wrote:
> > On Sun, Jan 11, 2004 at 04:53:52PM +1030, Malcolm Kay wrote:
> > > This raises a question for which I don't know the answer:
> > >   How does one list an http directory that does allow it?
> >
> > Basically, you shouldn't.  If the web site administrator has set up
> > index.html files or otherwise prevented you from generating a
> > directory listing, it generally means that there's stuff in that
> > directory which you aren't meant to access.  It's impolite (at best)
> > to try and get round that, although the wise admin will take stronger
> > meansures to ensure that even if you can guess filenames, you still
> > can't download anything you shouldn't.
> >
>=20
> Please reread my query -- I'm asking how to read the directory=20
> when the administrator does allow it.

Oops.  Sorry about that.  Note to self: read what is written, not
anything else.

Just do a HTTP GET on the directory name. eg.

    % GET http://localhost/~matthew/
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
    <html>
     <head>
      <title>Index of /~matthew</title>
     </head>
     <body>
    <h1>Index of /~matthew</h1>
    <pre><img src=3D"/icons/blank.gif" alt=3D"Icon " /> <a href=3D"?C=3DN;O=
=3DD">Name</a>                    <a href=3D"?C=3DM;O=3DA">Last modified</a=
>      <a href=3D"?C=3DS;O=3DA">Size</a>  <a href=3D"?C=3DD;O=3DA">Descript=
ion</a><hr /><img src=3D"/icons/back.gif" alt=3D"[DIR]" /> <a href=3D"/">Pa=
rent Directory</a>                             -  =20
    <img src=3D"/icons/folder.gif" alt=3D"[DIR]" /> <a href=3D"books/">book=
s/</a>                  07-Aug-2003 20:12    -  =20
    <img src=3D"/icons/folder.gif" alt=3D"[DIR]" /> <a href=3D"cryptosphere=
/">cryptosphere/</a>           02-Jun-2003 16:34    -  =20
    <img src=3D"/icons/unknown.gif" alt=3D"[   ]" /> <a href=3D"foo.php">fo=
o.php</a>                 08-Oct-2003 12:24  1.1K =20
    <img src=3D"/icons/text.gif" alt=3D"[TXT]" /> <a href=3D"mrtg-rrd.cgi">=
mrtg-rrd.cgi</a>            23-Jan-2003 13:30   24K =20
    <img src=3D"/icons/text.gif" alt=3D"[TXT]" /> <a href=3D"mrtg-rrd.cgi-1=
=2E20">mrtg-rrd.cgi-1.20</a>       31-Jan-2003 16:25   24K =20
    <img src=3D"/icons/text.gif" alt=3D"[TXT]" /> <a href=3D"mrtg-rrd.cgi.0=
00">mrtg-rrd.cgi.000</a>        14-Jan-2003 12:55   24K =20
    <img src=3D"/icons/folder.gif" alt=3D"[DIR]" /> <a href=3D"mrtg/">mrtg/=
</a>                   18-Apr-2003 15:36    -  =20
    <img src=3D"/icons/text.gif" alt=3D"[TXT]" /> <a href=3D"nwc.cgi">nwc.c=
gi</a>                 17-Nov-2002 08:04   12K =20
    <img src=3D"/icons/text.gif" alt=3D"[TXT]" /> <a href=3D"nwc.css">nwc.c=
ss</a>                 17-Nov-2002 08:04  2.0K =20
    <img src=3D"/icons/unknown.gif" alt=3D"[   ]" /> <a href=3D"nwc.php">nw=
c.php</a>                 17-Nov-2002 08:04   12K =20
    <hr /></pre>
    <address>Apache/2.0.48 (Unix) PHP/4.3.4 Server at localhost Port 80</ad=
dress>
    </body></html>

If you want that without all of the HTML fluff:

    % lynx -dump -nolist http://localhost/~matthew/
   =20
                                  Index of /~matthew
   =20
     Icon   Name                    Last modified      Size  Description
      _____________________________________________________________________=
_____
     [DIR]  Parent Directory                             -
     [DIR]  books/                  07-Aug-2003 20:12    -
     [DIR]  cryptosphere/           02-Jun-2003 16:34    -
     [   ]  foo.php                 08-Oct-2003 12:24  1.1K
     [TXT]  mrtg-rrd.cgi            23-Jan-2003 13:30   24K
     [TXT]  mrtg-rrd.cgi-1.20       31-Jan-2003 16:25   24K
     [TXT]  mrtg-rrd.cgi.000        14-Jan-2003 12:55   24K
     [DIR]  mrtg/                   18-Apr-2003 15:36    -
     [TXT]  nwc.cgi                 17-Nov-2002 08:04   12K
     [TXT]  nwc.css                 17-Nov-2002 08:04  2.0K
     [   ]  nwc.php                 17-Nov-2002 08:04   12K
      _____________________________________________________________________=
_____
   =20
   =20
        Apache/2.0.48 (Unix) PHP/4.3.4 Server at localhost Port 80


	Cheers,

	Matthew

--=20
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK

--17pEHd4RhPHOinZp
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (FreeBSD)

iD8DBQFAAXuNdtESqEQa7a0RAk0NAJ9xiWlIrWJw6UO1iMrd7rjCC2vrQACePi2O
aa8zHuTmkk5cWLpxNxdGN5E=
=x3Om
-----END PGP SIGNATURE-----

--17pEHd4RhPHOinZp--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040111163629.GA12774>