Skip to content

Instantly share code, notes, and snippets.

@jozic
Last active August 18, 2023 08:45
Show Gist options
  • Save jozic/4f781632d52e868e986217866024d82e to your computer and use it in GitHub Desktop.
Save jozic/4f781632d52e868e986217866024d82e to your computer and use it in GitHub Desktop.
netcat: listen to a request and return 200 HTTP response
## test is the program that returns response body
while true; do { echo -e 'HTTP/1.1 200 OK\r\n'; sh test; } | nc -l 8909; done
## test sample
#!/bin/bash
echo "************PRINT SOME TEXT***************\n"
echo "Hello World!!!"
echo "\n"
echo "Resources:"
vmstat -S M
echo "\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment