####### # # E-scripts on netcat. # # Note 1: use the eev command (defined in eev.el) and the # ee alias (in my .zshrc) to execute parts of this file. # Executing this file as a whole makes no sense. # An introduction to eev can be found here: # # (find-eev-quick-intro) # http://angg.twu.net/eev-intros/find-eev-quick-intro.html # # Note 2: be VERY careful and make sure you understand what # you're doing. # # Note 3: If you use a shell other than zsh things like |& # and the for loops may not work. # # Note 4: I always run as root. # # Note 5: some parts are too old and don't work anymore. Some # never worked. # # Note 6: the definitions for the find-xxxfile commands are on my # .emacs. # # Note 7: if you see a strange command check my .zshrc -- it may # be defined there as a function or an alias. # # Note 8: the sections without dates are always older than the # sections with dates. # # This file is at # or at . # See also , # , # , # , # and . # ####### # «.send-hi-and-bye» (to "send-hi-and-bye") # «.testport» (to "testport") # «.minimal-web-server» (to "minimal-web-server") # (find-esgrep "grep --color=auto -nH --null -e netcat *.e") ##### # # send-hi-and-bye # 2023jan16 # ##### # «send-hi-and-bye» (to ".send-hi-and-bye") # Based on: (find-es "vnc" "short-movie-about-f9") # (find-man "1 netcat") # (find-man "1 netcat" "-l" "listen mode") # (find-man "1 netcat" "-p port") # (find-man "1 netcat" "-q seconds")  (find-3EE '(eepitch-shell) '(eepitch-shell2))  (find-3ee '(eepitch-shell) '(eepitch-shell2))  (eepitch-shell2) # Listen on port 1234 netcat -l -p 1234   (eepitch-shell) # Send things to port 1234 { echo hi sleep 1 echo bye sleep 1 } | netcat -q 0 localhost 1234 ##### # # testport # 2023jan20 # ##### # «testport» (to ".testport")  (eepitch-shell)  (eepitch-kill)  (eepitch-shell) testport () { echo hi | netcat -q 0 localhost $1; } testport 1234 testport 80 ##### # # Minimal web server (needs fixes) # 2024jun01 # ##### # «minimal-web-server» (to ".minimal-web-server") # https://stackoverflow.com/questions/16640054/minimal-web-server-using-netcat # (find-fline "~/LOGS/2024may31.emacs")  (find-3EE '(eepitch-shell) '(eepitch-shell2))  (find-3ee '(eepitch-shell) '(eepitch-shell2))  (eepitch-shell2) netcat -l -p 8000  (eepitch-shell) cd /tmp/ curl localhost:8000/index.html  (eepitch-shell2) HTTP/1.1 200 Everything Is Just Fine Server: netcat! Content-Type: text/html; charset=UTF-8

A webpage served with netcat

  https://web.archive.org/web/20130817001428/http://www.razvantudorica.com/08/web-server-in-one-line-of-bash/ https://jameshfisher.com/2018/12/31/how-to-make-a-webserver-with-netcat-nc/ https://www.geeksforgeeks.org/minimal-web-server-using-netcat/ # Local Variables: # coding: utf-8-unix # End: