Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save random-robbie/1b25babb78487e06d894aac9ceebecd9 to your computer and use it in GitHub Desktop.
Save random-robbie/1b25babb78487e06d894aac9ceebecd9 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