Skip to main content

lanshare

Send files directly between two devices on the same Wi-Fi network or mobile hotspot. No internet connection, no cloud account, no Bluetooth pairing.

One device starts a receiver and gets a one-time PIN. The other device sends a file to that PIN. That's it. Transfers run over a plain TCP socket at full local network speed and are encrypted end-to-end, so the exchange is fast and private even on a network you don't fully trust.

Why not Bluetooth?

Bluetooth is slow and range-limited. lanshare instead uses whatever Wi-Fi link is already available - a home router, an office network, or one phone's hotspot with the other device connected to it - which is typically 10-50x faster and works at normal Wi-Fi range.

Features

  • Wi-Fi or hotspot, no data plan required - works the moment two devices share any local network, including a hotspot with no upstream internet.
  • Automatic discovery - senders can find nearby receivers by name instead of typing an IP address.
  • End-to-end encryption - every transfer is protected with AES-256-GCM, keyed from a one-time PIN via PBKDF2 (200,000 iterations). The PIN itself never crosses the network.
  • Tamper detection - each file is checksummed with SHA-256 before sending and verified again after saving.
  • Path-safe by design - incoming filenames are sanitized so a malicious peer can't write outside the destination folder, and existing files are never silently overwritten.
  • Concurrent transfers - the receiver handles multiple incoming connections at once, each on its own thread.
  • Zero configuration - no accounts, no server, no firewall rules beyond the one port lanshare listens on.
  • Simple CLI - three commands: receive, send, discover.

Installation

pip install .

or, from a clone of this repository:

pip install -r requirements.txt
python -m lanshare --help

Requires Python 3.8+. The only runtime dependency is the widely used cryptography library.

Desktop GUI

Prefer a window over a terminal? lanshare ships an optional desktop GUI with the same Send / Receive / Discover functionality as the CLI.

pip install "lanshare[gui]"
lanshare gui

or run it directly without going through the CLI wrapper:

lanshare-gui

The GUI is built on CustomTkinter and talks to the exact same underlying transfer engine as the command line - nothing about the protocol, encryption, or discovery changes, it's just a window instead of a shell.

Usage

1. On the receiving device

lanshare receive
lanshare receiver running as 'daniels-laptop'
  Listening on : 192.168.1.42:50556
  Saving to    : /home/daniel/received
  PIN          : 483920

Share the PIN with the sender. Press Ctrl+C to stop.

Read that PIN out to whoever is sending you a file (or send it over chat - it's only valid for this session and is useless without also being on the same network).

2. On the sending device

lanshare send vacation_photos.zip
No --host given, searching the network for receivers...
Found daniels-laptop (192.168.1.42:50556)
Enter the PIN shown on the receiving device: 483920
Sending vacation_photos.zip [########################........] 74.2%  186.4 MB/256.0 MB  42.1 MB/s

You can also skip discovery and target a device directly:

lanshare send report.pdf --host 192.168.1.42 --pin 483920

Multiple files in one go:

lanshare send photo1.jpg photo2.jpg notes.txt --host 192.168.1.42

Connecting over a hotspot

If you don't have a shared router, one device can just turn on its mobile hotspot and the other can connect to it as a normal Wi-Fi network - no data plan is consumed for the transfer itself since the file never leaves the local link between the two devices. From there, usage is identical to the examples above.

Finding receivers manually

lanshare discover
Searching for receivers for 3s...
Found 2 receiver(s):
  - daniels-laptop (192.168.1.42:50556)
  - kitchen-tablet (192.168.1.57:50556)

How it works

  1. Discovery - the receiver listens for a UDP broadcast asking "who's out there?" and answers with its name and port. This never touches file contents and can be skipped entirely with --host.
  2. Handshake - the sender generates a random salt and derives a 256-bit key from the salt and the shared PIN using PBKDF2-HMAC-SHA256. The receiver derives the same key from its own copy of the PIN. If the PINs don't match, the very first decrypted message fails integrity verification and the connection is dropped immediately.
  3. Transfer - the file is streamed in 1 MiB chunks, each independently encrypted and authenticated with AES-256-GCM, so partial data can never be tampered with or replayed.
  4. Verification - the receiver recomputes the SHA-256 checksum of the saved file and confirms it matches what the sender sent before reporting success.

Security notes

  • The PIN is the only shared secret. Treat it like a temporary password - don't post it somewhere public while a transfer is pending.
  • Anyone who doesn't know the PIN cannot decrypt a transfer even if they can see the network traffic.
  • lanshare only ever binds to the local network; it does not open any connection to the internet.

Command reference

Command Description
lanshare receive [--out DIR] [--port N] [--pin PIN] [--name NAME] Start listening for incoming files
lanshare send FILE [FILE ...] [--host IP] [--port N] [--pin PIN] Send one or more files
lanshare discover [--timeout SECONDS] List receivers currently visible on the network

Run lanshare --help or lanshare <command> --help for the full list of options.

Running the tests

pip install pytest
pytest

License

MIT - see LICENSE.

Metadata

Release files for lanshare 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lanshare 1.1.0
File Size Uploaded
lanshare-1.1.0.tar.gz 22.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lanshare 1.1.0
File Interpreter ABI Platform
lanshare-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 43.8 kB

Release files / lanshare-1.1.0.tar.gz

Download URL lanshare-1.1.0.tar.gz
Size 22.7 kB
Tags Source
SHA-256 checksum
How to use checksums
9ceecb2b3523a583c4f1b6baeb9788dc52577ee5d2ad09614510294d2046c0ae
BLAKE2b-256 checksum
How to use checksums
b70f928b410e2b2fa91f5d7492df9c1ad754c51f7bd3fbcd0f6572afcbba2043
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

Release files / lanshare-1.1.0-py3-none-any.whl

Download URL lanshare-1.1.0-py3-none-any.whl
Size 21.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b92a90722cf511c53efcd3fd53bebccba84f6f9acbea774350b3716a74f6f33b
BLAKE2b-256 checksum
How to use checksums
ee526f9ebd394ac5c7f9d7782ef8b5ce29f932da9885e703fa6461d0a6a02071
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 20, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page