aboutsummaryrefslogtreecommitdiff
path: root/bashweb.sh
blob: 1ca40aec3ed4a6456caa646da5ad3dfdf77daf6b (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
#!/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
EOF
}

while true
do
    main &>/dev/null
done