Last active
February 15, 2017 17:51
-
-
Save dwallraff/4d959ab49dc236ded26225eaab627b0c to your computer and use it in GitHub Desktop.
Various CLI Web Server examples (netcat, socat, perl, python)
This file contains hidden or 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
| # Netcat | |
| while true ; do nc -k -l 80 < index.html ; done | |
| # Perl | |
| perl -MIO::Socket::INET -ne \ | |
| 'BEGIN{$l=IO::Socket::INET->new(LocalPort=>80,Proto=>"tcp",Listen=>5,ReuseAddr=>1);\ | |
| $l=$l->accept}print $l $_' < index.html | |
| # Socat | |
| socat -u - tcp-listen:80,reuseaddr < index.html | |
| # Python (serves on 8000) | |
| python -m SimpleHTTPServer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment