Skip to content

Instantly share code, notes, and snippets.

@lingxiankong
Created March 26, 2020 09:41
Show Gist options
  • Save lingxiankong/187262d183e84e4cf65471b0d45a0fde to your computer and use it in GitHub Desktop.
Save lingxiankong/187262d183e84e4cf65471b0d45a0fde to your computer and use it in GitHub Desktop.
#!/bin/sh
MYIP=$(ip route get 8.8.8.8 | head -1 | awk '{print $7}')
OUTPUT="Hi, I am $MYIP\r"
LEN=${#OUTPUT}
while true; do echo -e "HTTP/1.1 200 OK\r\nContent-Length: ${LEN}\r\n\r\n${OUTPUT}" | sudo nc -l -p 80; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment