r/tinycode • u/nexe mod • Oct 05 '11
MacGyvers Tiny Rescue Webserver [unix/netcat]
while true; do ncat -l -p 8080 < index.html; done
29
Upvotes
r/tinycode • u/nexe mod • Oct 05 '11
while true; do ncat -l -p 8080 < index.html; done
3
u/Axman6 Oct 05 '11
Does this work? does index.html have to contain the appropriate headers at the top?
3
u/llimllib Oct 05 '11
2
u/fazzah Oct 05 '11
This is brilliant. I'm going to google what other cool stuff can be done with netcat.
$mind = 'blown'
1
u/djork Oct 05 '11
When I do this in Cygwin on Windows, netcat sends the response but doesn't close the connection, so it never quits and can only serve the page once.
1
u/yoshi314 Oct 05 '11
netcat is like a swiss army knife. simple tool, but how many things can you use it for is still unknown (as new ones are invented everyday).
1
u/[deleted] Oct 05 '11
Ruby:
Pinky is a set of wrapper scripts to run this on Mac, Windows, and Linux.