diff --git a/ncat/docs/ncatguide.xml b/ncat/docs/ncatguide.xml
index 0f78ec59a..02841bb64 100644
--- a/ncat/docs/ncatguide.xml
+++ b/ncat/docs/ncatguide.xml
@@ -271,7 +271,8 @@ Content-Type: text/html; charset=UTF-8
ran out of input; it won't re-send what has already been sent. For
more information on making a server that continually responds to
requests, see the examples in
- .
+ . More HTTP server tricks can
+ be found here in .
@@ -1415,6 +1416,79 @@ Hello. This short message is being sent by Ncat.
+
+ Turn Ncat into a simple web server
+
+
+ Continuing the example from , we can
+ create a simple HTTP server that serves the
+ index.html file using the following command:
+
+
+
+nc -lk -p 8080 --sh-exec "echo -e 'HTTP/1.1 200 OK\r\n'; cat index.html"
+
+
+
+ Or, if you're a Windows user:
+
+
+
+ncat -lk -p 8080 --sh-exec "echo HTTP/1.1 200 OK& echo(&type index.html"
+
+
+
+ This will start the HTTP server, serving the index.html
+ file from your current working directory. To try it out, visit
+ http://localhost:8080/ using
+ your web browser. You can also skip :8080 from the
+ URL if you specified -p 80 instead of
+ -p 8080 in the command above. Note that it will send
+ this file regardless of the entered URL - to change the file being sent,
+ you need to change the Ncat command or use the httpd.lua script (see
+ below).
+
+
+
+ Since Ncat v6.40, it is possible to use --lua-exec feature to run a Lua
+ script turning Ncat into a web server. In order to do that, need the
+ httpd.lua script - currently hosted on our SVN server. You can download
+ it from the following URL:
+
+
+
+https://svn.nmap.org/nmap-exp/d33tah/lua-exec-examples/ncat/scripts/httpd.lua
+
+
+
+ Once you have downloaded it, simply run Ncat in listening mode. Assuming
+ that your working directory contains the httpd.lua script, simply run:
+
+
+
+ncat --lua-exec httpd.lua --listen 8080 --keep-open
+
+
+
+ This will spawn a HTTP server on TCP port 8080. Unlike the previous
+ example though, the httpd.lua script works without modification on all
+ POSIX-compatible systems and also on Windows. Moreover, you can specify
+ in the URL any other file from the current directory or one of its
+ subdirectories and it will be sent to the user, unlike the
+ --sh-exec example.
+
+
+ Ncat HTTP server on production
+
+ The Ncat HTTP server examples shown above are very simple and may be not
+ as powerful as complete HTTP servers, such as Apache HTTPD. It is not
+ advised to use them in production environments (such as public website
+ hosting). It might be useful, though, if you need to quickly spawn a HTTP
+ server to copy some files or for educational purposes.
+
+
+
+
Chain Ncats Together