A local-area-network (LAN) sharing service that shares files and clipboards across different devices in local area network with access level, essientially, it means transferring files directly between devices on the same network without going through the internet.
Section |
---|
Introduction |
Critical User Journeys |
Getting Started |
Peer Discovery & Message Exchange Commands |
File Sharing Commands |
Clipboad Sharing Commands |
Registry Server Mode |
- CUJ#1: sub LAN with access code;
- CUJ#2: peer discoveries (in LAN and sub-LAN);
- CUJ#3: access level (secured mode, admin, visitor, ...);
- CUJ#4: messages transmission & history (text only);
- CUJ#5: file transmission (different format);
First, make a new folder and clone the repo:
mkdir lanss && cd lanss
git clone [email protected]:amyhuang95/LAN-Sharing-Service.git
cd LAN-Sharing-Service
download all python dependencies:
pip install -r requirements.txt
Notes: Make sure all the device are in the same LAN to discover your peers.
Create a user with username = evan-dayy
.
python create.py create --username <USERNAME> --port <OPTIONL> --gui <terminal/streamlit>
Type help
to see the LAN Terminal command;
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ LAN Share Service โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Welcome to LAN Share, evan-dayy#b598! โ
โ โ
โ โข Share files and directories on your local network โ
โ โข Chat with other users on the same network โ
โ โข Share clipboard contents securely โ
โ โ
โ Type help for available commands โ
โ Press Tab to autocomplete commands, usernames, and file paths โ
โโโโโโโโโโโโโโโโโโโโโโโโโ Connected as evan-dayy#b598 โโโโโโโโโโโโโโโโโโโโโโโโโโ
evan-dayy#b598@LAN(192.168.4.141)# help
โญโโโโโโโโโโโโโโโโโโโโโโโโ LAN Share Command Reference โโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โญโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ โ
โ โ Command โ Description โ Usage Example โ โ
โ โโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค โ
โ โ ul โ List online users โ ul โ โ
โ โ msg โ Send a message to a user โ msg username โ โ
โ โ lm โ List all message โ lm โ โ
โ โ โ conversations โ โ โ
โ โ om โ Open a specific conversation โ om conv_id โ โ
โ โ share โ Share a file or directory โ share ~/Documents/file.txt โ โ
โ โ files โ List and manage shared files โ files โ โ
โ โ access โ Manage access to shared โ access resource_id username โ โ
โ โ โ resources โ add|rm โ โ
โ โ all โ Share resource with everyone โ all resource_id on|off โ โ
โ โ clipboard โ Activate/deactivate โ clipboard on|off โ โ
โ โ โ clipboard sharing โ โ โ
โ โ sc โ Add peers to share clips to โ sc to|from username add|rm โ โ
โ โ โ or receive clips from โ โ โ
โ โ registry โ Manage registry connection โ registry connect โ โ
โ โ โ for restricted networks โ 192.168.1.5:5000 โ โ
โ โ debug โ Toggle debug mode โ debug โ โ
โ โ clear โ Clear screen โ clear โ โ
โ โ help โ Show this help message โ help โ โ
โ โ exit/quit โ Exit the application โ exit โ โ
โ โฐโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ โ
โ TIP: Press Tab to autocomplete commands, usernames, and file paths. โ
โ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
evan-dayy#07a8@LAN(192.168.4.141)# ul
evan-dayy#07a8@LAN(192.168.4.141)# msg jennifer#6423432 --send a message
evan-dayy#07a8@LAN(192.168.4.141)# lm --list all message
evan-dayy#07a8@LAN(192.168.4.141)# om <message id> --open a message
These commands show all the basic usages on how to share a file or directory with a peer, however, there are some important features doesn't show here, here are the summary we provide on file sharing features:
- Share a file or directory to everyone;
- Almost all types of files - including pdf, scripts, pictures, even videos
- Give/Remove certain user an access to a file or directory;
- Auto-sync: The update in the host file or directory will be synced to peers;
- Access Provision & Deletion during new peers emerge or quit;
- An Interactive UI to easily interact with the files sharing;
evan-dayy#208b@LAN(192.168.4.141)# share ./create.py
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ Share Successful โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Successfully shared file: ./create.py โ
โ Resource ID: evan-dayy#208b_1742673990_create.py โ
โ โ
โ By default, only you can access this resource. โ
โ Use access <resource_id> <username> add to give access to others. โ
โ Or use all <resource_id> on to share with everyone. โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
- You can share any file (including video or images) or directory (including recusive directory) by using this command;
- The path can be any format - including relative path or absolute path;
- All shared file will be stored in a the home directory folder called shared, and each peer should has its own shared folder.
lanshare
|____shared
|____evan-dayy#07a8
|____jennifer#24fs
|____(other peers folder that contained shared files)
evan-dayy#07a8@LAN(192.168.4.141)# files
- There are some sub-commands listed in the view, press
e
to in this view to quickly give acccess to everyone;
evan-dayy#208b@LAN(192.168.4.141)# access
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Command Help โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Usage: access <resource_id> <username> add|rm โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
evan-dayy#208b@LAN(192.168.4.141)# access evan-dayy#208b_1742673990_create.py jennifer#b903 add
โ Successfully added to access list for jennifer#b903
evan-dayy#208b@LAN(192.168.4.141)# access evan-dayy#208b_1742673990_create.py jennifer#b903 rm
โ Successfully removed from access list for jennifer#b903
evan-dayy#208b@LAN(192.168.4.141)# all evan-dayy#208b_1742673990_create.py
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Command Help โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Usage: all <resource_id> on|off โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
evan-dayy#208b@LAN(192.168.4.141)# all evan-dayy#208b_1742673990_create.py on
โ Resource is now shared with everyone
evan-dayy#208b@LAN(192.168.4.141)# all evan-dayy#208b_1742673990_create.py off
โ Resource is now no longer shared with everyone
Clipboard sharing feature allows user to copy text from one device and paste it on another easily. When user starts the app, the feature is turned off by default for security reason. To enable two-way exchange of clipboard content between two peers, both users first need to activate the feature from main menu, then add each other to their own sending and receiving list. This prevents unintended sharing of copied data.
evan-dayy#208b@LAN(192.168.4.141)# clipboard
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Command Help โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Usage: clipboard on|off โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
evan-dayy#208b@LAN(192.168.4.141)# sc
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Command Help โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Usage: sc to|from <username> add|rm โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
evan-dayy#208b@LAN(192.168.4.141)#
Background: In enterprise-grade internet (eduroam), broadcasting message is highly restricted from one peer to another peer. In addition to the previous introduction of Laptop Hotspot (the one we discussed in the classroom), registry server is a much easier alternative to resolve the issue.
What is it? A centralized server that record registered users' private IP and port numbers;
python registry.py --port 5050
evan-dayy#208b@LAN(192.168.4.141)# registry
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ Registry Status โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ Not using registry server. Currently in UDP broadcast discovery mode. โ
โ โ
โ To connect to a registry server, use: registry connect <server_url> โ
โ Example: registry connect 192.168.1.5:5000 โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
evan-dayy#208b@LAN(192.168.4.141)# registry connect 192.168.4.141:5050
Connecting to registry server at 192.168.4.141:5050...
โ Successfully registered with registry server
Now discovering peers via both UDP broadcast and registry server
โญโโโโโโโโโโโโโโโโโโโโโโ Active Peers: 1 โโโโโโโโโโโโโโโโโโโโโโโโฎโญโโโโโโ Server Statistics โโโโโโโฎ
โ Online Peers โโ โญโโโโโโโโโโโโโโโโโโฌโโโโโโโโโฎ โ
โ โญโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโฌโโโโโโโโฌโโโโโโโโโโโโฎ โโ โ Registrations โ 0 โ โ
โ โ Username โ IP Address โ Port โ Last Seen โ โโ โ Unregistrations โ 0 โ โ
โ โโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโผโโโโโโโโผโโโโโโโโโโโโค โโ โ Heartbeats โ 5 โ โ
โ โ evan-dayy#208b โ 192.168.4.141 โ 12345 โ 8s ago โ โโ โ Peer Requests โ 95 โ โ
โ โฐโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโดโโโโโโโโดโโโโโโโโโโโโฏ โโ โ Uptime โ 1m 14s โ โ
โ โโ โฐโโโโโโโโโโโโโโโโโโดโโโโโโโโโฏ โ
โ โโ โ
โ โโ โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏโฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
evan-dayy#729a@LAN(192.168.4.141)# registry disconnect
Disconnecting from registry server at http://192.168.4.141:5050...
โ Successfully disconnected from registry server
Now using UDP broadcast discovery only
evan-dayy#729a@LAN(192.168.4.141)# registry status
Not using registry server. Currently in UDP broadcast discovery mode.