Skip to content

Instantly share code, notes, and snippets.

@parnurzeal
Last active February 19, 2020 14:14
Show Gist options
  • Save parnurzeal/5675740 to your computer and use it in GitHub Desktop.
Save parnurzeal/5675740 to your computer and use it in GitHub Desktop.
This is easy snippet for easy_file_sharing.py which you can pass directly to your command line.
python -c 'import BaseHTTPServer; import CGIHTTPServer; import sys; import socket; s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM); s.connect(("www.google.com",8000)); ipaddr = s.getsockname()[0]; s.close(); print "="*36 ; print "Access: " + ipaddr +":"+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