Carlos Aguni

Highly motivated self-taught IT analyst. Always learning and ready to explore new skills. An eternal apprentice.


Basic HTTP server netcat

02 Nov 2022 »

https://stackoverflow.com/questions/16640054/minimal-web-server-using-netcat

while true; do (echo -e 'HTTP/1.1 200 OK\r\n'; echo -e "\n\tMy website has date function" ; echo -e "\t$(date)\n") | nc -q 0 -lp 8080; done

client

[root@automation ~]# curl http://laball:8080

        My website has date function
        Wed Nov  2 17:16:09 UTC 2022

[root@automation ~]# curl http://laball:8080

        My website has date function
        Wed Nov  2 17:16:21 UTC 2022

[root@automation ~]# curl http://laball:8080

        My website has date function
        Wed Nov  2 17:16:34 UTC 2022

[root@automation ~]# curl http://laball:8080

        My website has date function
        Wed Nov  2 17:16:34 UTC 2022