{"id":12440,"date":"2024-12-04T22:02:13","date_gmt":"2024-12-04T17:02:13","guid":{"rendered":"https:\/\/alexeyka.zantsev.com\/?p=12440"},"modified":"2024-12-04T22:12:00","modified_gmt":"2024-12-04T17:12:00","slug":"a-bash-web-server","status":"publish","type":"post","link":"https:\/\/alexeyka.zantsev.com\/?p=12440","title":{"rendered":"A Bash web server"},"content":{"rendered":"\n<p>Nice oneliners which may be useful to show some console output via HTTP.<\/p>\n\n\n\n<p>An example of showing the iptables FORWARD chain:<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-red-color has-text-color has-link-color wp-elements-430f9319a765c89c41620345d4cddcc0\"><code>while true ; do echo -e \"HTTP\/1.1 200 OK\\n\\n $(sudo iptables -L FORWARD -vn --line-numbers)\" | nc -l -p 8080 -q 1; done<\/code><\/pre>\n\n\n\n<p>Then go to http:\/\/ip.add.re.ss:8080 and you will see the output as a web page. In case of adding new rules renew the webpage and you will see the newly added rules.<\/p>\n\n\n\n<p>To report file system disk space usage:<\/p>\n\n\n\n<pre class=\"wp-block-code has-vivid-red-color has-text-color has-link-color wp-elements-d24a6c45e1aeb698652482d629daf563\"><code>while true ; do echo -e \"HTTP\/1.1 200 OK\\n\\n $(df -h)\" | nc -l -p 8080 -q 1; done<\/code><\/pre>\n\n\n\n<p>More info: <a href=\"https:\/\/www.linux-magazine.com\/Issues\/2021\/250\/Bash-Web-Server\/(offset)\/3\/(tagID)\/92#\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.linux-magazine.com\/Issues\/2021\/250\/Bash-Web-Server\/(offset)\/3\/(tagID)\/92#<\/a> <\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Nice oneliners which may be useful to show some console output via HTTP. An example of showing the iptables FORWARD chain: Then go to http:\/\/ip.add.re.ss:8080 and you will see the output as a web page. In case of adding new rules renew the webpage and you will see the newly added rules. To report file [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[102,292,291],"class_list":["post-12440","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-bash","tag-http","tag-webserver"],"_links":{"self":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/12440","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12440"}],"version-history":[{"count":8,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/12440\/revisions"}],"predecessor-version":[{"id":12442,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=\/wp\/v2\/posts\/12440\/revisions\/12442"}],"wp:attachment":[{"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12440"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12440"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alexeyka.zantsev.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12440"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}