Skip to content

Commit

Permalink
Push v0.03
Browse files Browse the repository at this point in the history
  • Loading branch information
lewismc committed Jan 21, 2021
1 parent a8eeef7 commit 7ce65f1
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# 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
Empty file modified LICENSE.txt
100644 → 100755
Empty file.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ you should do with it, and what you shouldn't.
```console
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. 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 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.

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
19 changes: 4 additions & 15 deletions bash-httpd-0.02.sh → bash-httpd-0.03.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
#!/bin/bash

# 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

# Configurable variables
PATH=/bin:/usr/bin
DOC_ROOT=~morty/www/server
PATH=/bin:/usr/bin:/usr/local/bin
DOC_ROOT=~/Downloads/bash-httpd/www/
DEF_HTML=index.html
DEF_DIR=www
LOG_FACILITY=local1

# End of configurables
HTTP_VERSION="HTTP/1.0"
SERVER="bash-httpd/0.02"
Expand Down Expand Up @@ -40,9 +34,7 @@ error(){
if [ "$2" ]; then problem="$2"; else problem="$err"; fi
cat <<EOF
Content-Type: text/html
<html> <head> <title> $problem </title>
<body> <h1> $num $problem </h1> $problem </body> </html>
<!DOCTYPE html><html><head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><title> $problem </title></head><body><h1> $num $problem </h1> $problem </body></html>
EOF
log err "$problem"
exit 1
Expand All @@ -53,8 +45,6 @@ log(){
logger -p $LOG_FACILITY."$level" "$program[$$]: $method $url $version: $message"
}



read method url version

method="${method%$CR}";
Expand Down Expand Up @@ -123,5 +113,4 @@ case $type in
*)
error 501 "Messed up internal type"
;;
esac

esac

0 comments on commit 7ce65f1

Please sign in to comment.