Finally an easy way to share text and files on your LAN!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Anthony Wang 26447d6c1b
Add a comment for remove files on interrupt line
1 year ago
LICENSE Formatting 1 year ago
README.md Typo 1 year ago
share.sh Add a comment for remove files on interrupt line 1 year ago

README.md

Easy LAN Share

Finally an easy way to share text and files on your LAN! It only takes 15 seconds! No installation needed! No dependencies except for a shell and Python!

The scenario

Let's say you have a long link or file that you want to share with a friend on your LAN. You could just email or message your friend the content, but it seems like a waste to route it through someone else's email or chat server. FTP? F*ck that protocol. SCP? Sh*tty copy protocol. There has to be an easier way, right?

Getting started

First, get your private IP address:

ip route get 1.1.1.1 | grep -oP 'src \K[^ ]+' # ip -c address also works

If you want to share text, create a new file and paste in the text:

touch share.txt # Create the file
xdg-open share.txt # Open file in your default editor

Otherwise, navigate to the directory with the file you would like to share. Now, unleash Python's built-in HTTP server!

python3 -m http.server

Now scream your private IP address to your friend and tell them to go to http://IPADDRESS:8000 in their web browser. All they need to do is download the file. They can even use a TUI browser like lynx or plain curl. When everything's done, you can press Ctrl-C to stop the HTTP server. Mission accomplished!

Scripting

Wow, that was easy enough that you could probably easily write a script to do it. Lucky for you, check out share.sh for a prewritten script to automate this process.

License

Read the LICENSE! It's fun!