aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbashweb.sh28
-rw-r--r--index.bhtml3
2 files changed, 31 insertions, 0 deletions
diff --git a/bashweb.sh b/bashweb.sh
index b1c6f26..1ca40ae 100755
--- a/bashweb.sh
+++ b/bashweb.sh
@@ -5,3 +5,31 @@
## 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
+
diff --git a/index.bhtml b/index.bhtml
new file mode 100644
index 0000000..4d4989c
--- /dev/null
+++ b/index.bhtml
@@ -0,0 +1,3 @@
+<b>Hello!</b>,this is a page from Bashweb!<br>
+It even supports bash variables:<br>
+<pre>$USER</pre>