File: webserver.sh

package info (click to toggle)
octavia 17.0.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 13,248 kB
  • sloc: python: 99,849; sh: 2,459; pascal: 450; makefile: 114; ruby: 18
file content (9 lines) | stat: -rw-r--r-- 278 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
#!/bin/sh

MYIP=$(/sbin/ifconfig eth0|grep 'inet addr'|awk -F: '{print $2}'| awk '{print $1}');
OUTPUT_STR="Welcome to $MYIP\r"
OUTPUT_LEN=${#OUTPUT_STR}

while true; do
    echo -e "HTTP/1.0 200 OK\r\nContent-Length: ${OUTPUT_LEN}\r\n\r\n${OUTPUT_STR}" | sudo nc -l -p 80
done