Created
January 2, 2020 23:23
-
-
Save luqs1/fa955ace49c4d2de65ffbf19e03710ea to your computer and use it in GitHub Desktop.
Host files in the directory on your IP accessible to others on the network
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
| import socket | |
| import os | |
| port = input('port: ') | |
| s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
| s.connect(("8.8.8.8", 80)) | |
| ip = s.getsockname()[0] | |
| s.close() | |
| print(ip+':'+port) | |
| os.system('python -m http.server --bind '+ip+' '+port) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment