Created
May 30, 2013 02:40
-
-
Save parnurzeal/5675425 to your computer and use it in GitHub Desktop.
This is very easy file sharing using python.
It is very useful and easy when you want to download or sharing the files from servers behind proxy (which normally you need to do many steps before getting to the files). However, this is not secure. Please do use in internal network or as your own risk. Usage: 1.) put the file in sharing folder 2.) …
This file contains 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
#!/usr/bin/python | |
import BaseHTTPServer | |
import CGIHTTPServer | |
import sys | |
import socket | |
def get_local_ip_address(target): | |
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
s.connect((target,8000)) | |
ipaddr = s.getsockname()[0] | |
s.close() | |
return ipaddr | |
print "="*36 | |
print "Access: " + get_local_ip_address('www.google.com') +":"+str(9999) | |
print "="*36 | |
server=BaseHTTPServer.HTTPServer | |
handler = CGIHTTPServer.CGIHTTPRequestHandler | |
server_address = ("",int(9999)) | |
httpd = server(server_address, handler) | |
httpd.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment