Created
January 23, 2019 11:07
-
-
Save hughpearse/28af1578a4f115d21046c56d8a186491 to your computer and use it in GitHub Desktop.
Listen for any HTTP request
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
#!/bin/bash | |
port=$1 | |
if [[ -n "$port" ]]; then | |
while true; | |
do | |
{ echo -e "HTTP/1.1 200 OK\r\n$(date)\r\n\r\n<h1>hello world from $(hostname) on $(date)</h1>" | nc -vl $port; } | |
done | |
else | |
echo "Usage: $(basename $0) <port>" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment