impromptu web server using netcat

Kent Johnson kent37 at tds.net
Sun Jan 14 16:16:41 EST 2007


aluminumsulfate at earthlink.net wrote:
> Hi, All...
> 
> Most of you are probably familiar with the ever useful TCP/IP utility
> "netcat" (often /usr/bin/nc).  It's real handy for doing quick and
> easy file transfers, or otherwise tossing bytes about on a network.
> It runs on most variants of UNIX (including Linux) and there's even a
> version for Win32.

If you have Python installed on the source machine, the single line
python -c "import SimpleHTTPServer; SimpleHTTPServer.test()"

will start a real web server on port 8000, serving static content from 
the directory tree rooted at the current working dir. The server 
includes support for directory listings and will set the correct 
content-type for many types of files.

Kent



More information about the gnhlug-discuss mailing list