aboutsummaryrefslogtreecommitdiff
path: root/bashweb.sh
blob: aa2d1d0cf4136c385109a1d4e359f50cd0bed416 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
##########################################################
##                                                      ##
##    Bashweb, a cursed (probably static) web server    ##
##    written in bash.                                  ##
##                                                      ##
##########################################################

data=$(cat index.bhtml | envsubst)

main () {
#    netcat -q 0 -l 1234 <<EOF
#HTTP/1.1 200 OK
#Server: Bashweb
#Date: $(date)
#Content-Type: text/html; charset=utf-8
#Content-Length: ${#data}
#Connection: keep-alive
#X-Frame-Options: SAMEORIGIN
#X-XSS-Protection: 1; mode=block
#Cache-Control: private, no-cache, no-store, must-revalidate
#X-Content-Type-Options: nosniff
#Pragma: no-cache
#Expires: Sat, 01 Jan 2000 00:00:00 GMT
#Referrer-Policy: no-referrer-when-downgrade
#
#$data
#$(./preprocessor/url.sh)
#EOF
    netcat -q 0 -l 1234 < /tmp/backpipe | ./preprocessor/main.sh 1> /tmp/backpipe
}

while true
do
    main &>log
done