Jump to content

Bash (netcat) only web server


iamnoxtras

Recommended Posts

Recently came across a bash only web server (using netcat) at http://paulbuchheit.blogspot.ro/2007/04/webserver-in-bash.html

I fiddled a little with it and turned it into a decent web server, with server logs and all. (no IP captured, just the query string and timestamp)

It supports file downloads, it servers static html, PHP, Python and binary files with arguments (GET). It checks for 404 errors and it keeps a server log.

Fun facts:

  • 5 times slower then nginx (for a single user)
  • executes binary faster then displays static content
  • php is the slowest :)
  • php files need to be .php
  • python files .py
  • binaries .cb (C binary:) )

It's great if you just need a server for a short period of time and don't need security...

It only works on Linux. (I've tested it under ubuntu)

I had great fun working on it. I hope you'll have as much fun with it as had.

If you find an use for it, drop me a line.

server.zip

Edited by iamnoxtras
Link to comment
Share on other sites

It's hard to imagine any use case in which having a web server written in Bash could be helpful, but it's a cool novelty.
Reminds me of the time I wrote a wiki in about 64 lines of Bash.

Rather than a zip file on a forum, you should post it to Github.

Edited by Sitwon
Link to comment
Share on other sites

Make sure you look up the relevant standards and that your implementations are conformant. It's cool to have something that acts like a web server, but it's even cooler to have something that actually satisfies the requirements set forth in the relevant standards for a web server.

Link to comment
Share on other sites

watching today's episode, I found a utility for this?

I could change the code a little, add it to a ducky, run it with &, and voila.. an almost invisible web server waiting for all my commands:)

I could then just call up the IP, ask for any file, and execute any command directly from a browser...

Granted. The logged in user does need to be root.... maybe someone can find a way to circumvent this?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...