diff options
-rwxr-xr-x | bashweb.sh | 36 | ||||
-rwxr-xr-x | preprocessor/main.sh | 20 | ||||
-rwxr-xr-x | preprocessor/url.sh | 4 |
3 files changed, 43 insertions, 17 deletions
@@ -9,23 +9,25 @@ 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 +# 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 | ./proprocessor/main.sh 1> /tmp/backpipe } while true diff --git a/preprocessor/main.sh b/preprocessor/main.sh new file mode 100755 index 0000000..0fdfbc5 --- /dev/null +++ b/preprocessor/main.sh @@ -0,0 +1,20 @@ +#!/bin/bash +while read stdin +do + data=$(cat index.bhtml | envsubst) + echo "HTTP/1.1 200 OK" + echo "Server: Bashweb" + echo "Date: $(date)" + echo "Content-Type: text/html; charset=utf-8" + echo "Content-Length: ${#data}" + echo "Connection: keep-alive" + echo "X-Frame-Options: SAMEORIGIN" + echo "X-XSS-Protection: 1; mode=block" + echo "Cache-Control: private, no-cache, no-store, must-revalidate" + echo "X-Content-Type-Options: nosniff" + echo "Pragma: no-cache" + echo "Expires: Sat, 01 Jan 2000 00:00:00 GMT" + echo "Referrer-Policy: no-referrer-when-downgrade" + echo "" + echo $data +done diff --git a/preprocessor/url.sh b/preprocessor/url.sh new file mode 100755 index 0000000..bc4e221 --- /dev/null +++ b/preprocessor/url.sh @@ -0,0 +1,4 @@ +#!/bin/bash +read_from_pipe() { read "$@" <&0; } + +echo "$(read_from_pipe | head -1)" |