Unverified Commit e2194519 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

Netcat

parent 0b8c9516
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -16,9 +16,8 @@ done
HTML="<HTML><BODY><H1><CENTER>$2</CENTER></H1></BODY></HTML>"
LENGTH=$(echo "$HTML" | wc -c);

RESPONSE="HTTP/1.1 200 OK\nContent-Length: ${LENGTH}\nConnection: close\n\n$HTML"
RESPONSE="HTTP/1.1 200 OK\nContent-Length: ${LENGTH}\nConnection: close\n\n$HTML\n\n"

while true; do 
  echo -en "$RESPONSE" | timeout 1 nc -lp "${1:-8080}"; 
  echo "loop"
  echo -en "$RESPONSE" | nc -N -lp "${1:-8080}"; 
done