It's very easy to write one in Python... Anyway, it's already written, you just launch it.
import sysIt serves the contents of the current directory. You can give it an argument like
import BaseHTTPServer
import SimpleHTTPServer
listen = ":8080"
if len(sys.argv) > 1:
listen = sys.argv[1] + listen
listen = listen.split(":")[:2]
listen[1] = int(listen[1])
listen = tuple(listen)
httpd = BaseHTTPServer.HTTPServer(listen, SimpleHTTPServer.SimpleHTTPRequestHandler)
httpd.serve_forever()
localhost:8080, 0.0.0.0 or :8000 to listen on different IP/port. But be warned that this simple stuff is very insecure!
1 comment:
wow, i didn't know that python can also do this. now I'm really interested to get deeper knowledge on this. I'm not a linux user, but I'm interested about python. Do you think it is best to have linux OS for developing python or windows is OK, as long as you can use run the scripts?
I'm just worried if there would be some restrictions in windows that will force me to do it on Linux (maybe on ubuntu).
thanks,
python n00b
Post a Comment