Last active
August 18, 2023 08:45
-
-
Save jozic/4f781632d52e868e986217866024d82e to your computer and use it in GitHub Desktop.
netcat: listen to a request and return 200 HTTP response
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## 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