Skip to content

Instantly share code, notes, and snippets.

@johnsom
Last active May 9, 2016 22:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save johnsom/2b793472ed720716e0477dd3e166482e to your computer and use it in GitHub Desktop.
Save johnsom/2b793472ed720716e0477dd3e166482e to your computer and use it in GitHub Desktop.
#!/bin/sh
MYIP=$(/sbin/ifconfig eth0|grep 'inet addr'|awk -F: '{print $2}'| awk '{print $1}');
COUNT=0
while true; do
OUTPUT_STR="Welcome to $MYIP connection $COUNT\r"
OUTPUT_LEN=${#OUTPUT_STR}
echo -e "HTTP/1.0 200 OK\r\nContent-Length: ${OUTPUT_LEN}\r\n\r\n${OUTPUT_STR}" | sudo nc -l -p 80
if [ $? == 0 ]; then
let "COUNT++"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment