Easy-LAN-Share/README.md

31 lines
1.5 KiB
Markdown
Raw Permalink Normal View History

2021-07-21 15:34:06 +00:00
# Easy LAN Share
2021-07-21 16:02:12 +00:00
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!
2021-07-21 15:34:06 +00:00
2021-07-21 16:02:38 +00:00
## The scenario
2021-07-21 15:56:37 +00:00
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?
2021-07-21 15:34:06 +00:00
## Getting started
First, get your private IP address:
```sh
ip route get 1.1.1.1 | grep -oP 'src \K[^ ]+' # ip -c address also works
```
2021-07-21 15:54:44 +00:00
If you want to share text, create a new file and paste in the text:
2021-07-21 15:34:06 +00:00
```sh
2021-07-21 15:54:44 +00:00
touch share.txt # Create the file
2021-07-21 15:34:06 +00:00
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!
```sh
2021-07-21 19:05:29 +00:00
python3 -m http.server
2021-07-21 15:34:06 +00:00
```
2021-07-21 20:23:48 +00:00
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](http://lynx.browser.org/) or plain `curl`. When everything's done, you can press Ctrl-C to stop the HTTP server. Mission accomplished!
2021-07-21 15:34:06 +00:00
## Scripting
2021-07-21 15:34:31 +00:00
Wow, that was easy enough that you could probably easily write a script to do it. Lucky for you, check out [share.sh](share.sh) for a prewritten script to automate this process.
2021-07-21 15:34:06 +00:00
## License
Read the [LICENSE](LICENSE)! It's fun!