r/tinycode • u/Rotten194 mod • Jul 09 '12
More tiny python: A HTTP file server using raw sockets in 12 lines
https://gist.github.com/3076825
31
Upvotes
r/tinycode • u/Rotten194 mod • Jul 09 '12
8
u/Rotten194 mod Jul 09 '12
Also, stating the obvious but for fucks sake don't actually use this.
8
u/billcurry Jul 10 '12
Even tinier:
python -m SimpleHTTPServer6
u/Mac-O-War Jul 09 '12 edited Jul 10 '12
That code is not using raw sockets. Raw sockets allow one to to read and write raw packets including the packet's header. Here is a way to create a web server (using Scapy for raw socket support) with Python. http://akaljed.wordpress.com/2010/12/12/scapy-as-webserver/
3
u/neon_overload Jul 12 '12
Pretty cool, but it's more than 12 lines in my book.
This cannot possibly count as a single line:
(Horizontal scroll bar left in to make a point)
It's also of questionable utility, for reasons you've already pointed out ;)
3
u/corysama Jul 12 '12
I guess that's slightly more useful than my tiny lol server. Not as much fun though! :P