Skip to content

Commit

Permalink
Merge pull request #3 from kaotisk-hund/master
Browse files Browse the repository at this point in the history
Proposed changes for v0.04
  • Loading branch information
lewismc authored Jul 20, 2024
2 parents 46d1821 + fe31605 commit d72d7ee
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# v0.04: kaotisk: added some mime types
# v0.03: lewismc: 2021/01/21 ensure bash-httpd will run as of 2021...!
# bash-httpd, by Morty Abzug <[email protected]>
# v0.02: morty: 1998/11/22: does simple file queries
# v0.01: morty: 1998/11/??: proof of concept
# v0.01: morty: 1998/11/??: proof of concept
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ foo@bar:~$ git clone https://github.com/lewismc/bash-httpd.git
foo@bar:~$ sudo ln -s /path/to/bash-httpd/bash-httpd-0.03.sh /usr/local/bin/bash-httpd
foo@bar:~$ mkdir www // put your files in this directory
```
Then edit the config variables at the beginning of the script tyo suit your environment. You may need to insert a line for it in /etc/inetd.conf, running as nobody. You probably also want to wrap the port.
Then edit the config variables at the beginning of the script to suit your environment. You may need to insert a line for it in /etc/inetd.conf, running as nobody. You probably also want to wrap the port.

If you're not root, get ahold of Netcat, preferably compile it with -DGAPING_SECURITY_HOLE (because it *is* a gaping security hole), and run:
```console
Expand Down
7 changes: 5 additions & 2 deletions bash-httpd-0.03.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ DEF_DIR=www
LOG_FACILITY=local1
# End of configurables
HTTP_VERSION="HTTP/1.0"
SERVER="bash-httpd/0.02"
SERVER="bash-httpd/0.04"

CR=`printf "\015"`
program="${0##/*/}"
Expand Down Expand Up @@ -106,11 +106,14 @@ case $type in
*.gif) mime=image/gif;;
*.gz|*.tgz) mime=application/binary;;
*.txt|*.text) mime=text/plain;;
*.css) mime=text/css;;
*.js) mime=text/javascript;;
*.json) mime=application/json;;
*) mime=application/binary;;
esac
echo Content-Type: $mime; echo; cat $file
;;
*)
error 501 "Messed up internal type"
;;
esac
esac

0 comments on commit d72d7ee

Please sign in to comment.