Posts

Fake web server using bash, netcat

What if you want to serve some simple html to a browser from a linux server, but don't want to bother with installing a real web server? I've probably found myself in this situation once every couple of years. The first time I investigated this solution (about 15 years ago now), it was to provide a simple HTTP redirect on a server that housed my company's root domain, but not the top level web server. The root domain had to be pointed there for other reasons, and I didn't want a web server running on it for security reasons. So I wrote a little netcat script that responded with an http 302 pointing to the main web page for the company. Netcat is a very simple network utility commonly used for things like network connectivity testing. Want to see if that firewall rule was opened, but your application isn't installed yet? Netcat can open a listener port on the destination, and can also be used to initiate traffic from the source. Starting a listener For ou
Recent posts