• Stars
    star
    391
  • Rank 105,982 (Top 3 %)
  • Language
    C
  • License
    Other
  • Created almost 7 years ago
  • Updated over 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Dead simple LAN file transfers from the command line

toss: dead simple command line file transfer

Toss is a convenient ultra-minimal command line tool to send files over LAN, WiFi, and virtual networks.

Examples

Toss a file between two terminal windows

Sender:

# toss nginx.conf
nginx.conf/rpyaaaaaaaaaatevqcopx2r56xbo4bakxpjzgeh5qblmfyq4ertt3gmtnncrxyou

Receiver:

$ catch nginx.conf/rpyaaaaaaaaaatevqcopx2r56xbo4bakxpjzgeh5qblmfyq4ertt3gmtnncrxyou
catch: catching nginx.conf (19605 bytes)
catch: 10.187.211.147/35824 connected, reading... wrote 19605 bytes to: nginx.conf

Toss a file to your team

# toss debug-output.log
debug-output.log/vd4qaaaaaaaaabqprfnhdzwnq3r2gbakxpjzgeh5qblmfyq4ertt3gmtnncrxyou

Then paste the token into a chat system like IRC, Slack, etc.

Stream a huge archive between systems

Sender:

# tar -czf - /usr | toss -
ruz7777777777777tu3pjur2yqhtmbakxpjzgeh5qblmfyq4ertt3gmtnncrxyou

Receiver:

$ catch ruz7777777777777tu3pjur2yqhtmbakxpjzgeh5qblmfyq4ertt3gmtnncrxyou - | tar -tzf -

Toss the output of a command to a team member

$ ps aux | toss -
zmr7777777777777grxowcyqr4w3gbakxpjzgeh5qblmfyq4ertt3gmtnncrxyou

Then paste the token into a chat and your team member can do this:

$ catch zmr7777777777777grxowcyqr4w3gbakxpjzgeh5qblmfyq4ertt3gmtnncrxyou -

... and see the output of your ps aux command.

Description

The toss program outputs a token generated from a random local TCP port, the size of the file you're sending, a hash of the file's contents (unless it's a pipe), and all the available IP addresses on all the interfaces in your system. It then listens for catch to connect and if presented with the correct claim token streams the file. If its input is a file it will continue to service catch requests one after the other (not concurrently) until it is terminated with CTRL+C or a kill signal. For pipes it terminates when the pipe closes.

The catch program takes a toss token and then attempts to connect to all the IP addresses specified in it. If connection is successful it listens for a hello message (based on the hashed token) and if this is correct sends a claim message (a different version of the hashed token). If this exchange succeeds toss will send the file and catch will receive it.

To toss a pipe, use toss -. To catch something and pipe it to standard output, use catch <token> -. Both programs send status and error messages to standard error.

The token can include a file name (the part before the slash) but this is optional. If this is not present catch will name the file based on its hash or the output file name provided on the command line.

Transfers are done using TCP over ports between 30000 and 65535. You may have to configure your local firewall to allow this, or at least to allow it between certain IP addresses.

Toss will work across the open Internet if no firewalls are in the way but it's mostly intended for LANs, WiFi networks, and ZeroTier virtual networks (plug, plug! we wrote this!). This little utility serves as an example of how easy things are if devices can communicate directly.

Security

Toss does no encryption and authentication is based on the token alone. Files are checked against a 64-bit hash, but pipes rely on TCP CRC checking alone. If you are transferring sensitive information over an un-trusted insecure network we highly recommend encrypting it with a real crypto tool like GPG or a similar.

The catch command prioritizes private IP addresses and only tries globally scoped IPs after all attempts to use private ones have failed.

Building

On Linux, Mac, and BSD just type make. The source is self-contained and there are no dependencies.

Some work has been done to prepare for a Windows port but this is incomplete. Pull requests are welcome.

License

MIT license.

Changes

  • Version 1.1: add a DESTDIR to make install and make toss favor ZeroTier and tun/tap interfaces over physical ones. It just lists them first so catch will try them first.
  • Version 1.0: initial release!

More Repositories

1

ZeroTierOne

A Smart Ethernet Switch for Earth
C++
12,880
star
2

lf

Fully Decentralized Fully Replicated Key/Value Store
C
887
star
3

awesome-zerotier

A collection of things you can do with ZeroTier, how-to guides, and more
704
star
4

zeronsd

A DNS server for ZeroTier users
Rust
460
star
5

ZeroTierNAS

NAS packages for ZeroTier
JavaScript
427
star
6

DesktopUI

ZeroTier Desktop Tray Application and UI
C
156
star
7

libzt

Encrypted P2P sockets over ZeroTier
C++
124
star
8

terraform-provider-zerotier

Terraform provider for controlling ZeroTier Central
Go
62
star
9

install.zerotier.com

Source for https://install.zerotier.com curl|bash installer
Shell
54
star
10

zerotier-systemd-manager

Manages systemd per-interface DNS resolution for zeronsd
Go
51
star
11

github-action

A Github Action for ZeroTier
JavaScript
41
star
12

edge

ZeroTier Edge software and root filesystem (AARCH64)
Perl
38
star
13

cathode

Demo App for ZeroTier SDK
C
27
star
14

pylon

SOCKS5 Proxy to and from your LAN and ZeroTier Network
C++
24
star
15

terraform-multicloud-quickstart

A tutorial using ZeroTier + Terraform on multiple clouds
HCL
23
star
16

dumb

Dumb User Mode Bridge
C
21
star
17

tetanus

ZeroTier in (almost) pure Rust WORK IN PROGRESS
Rust
16
star
18

zerotier-synology

Dockerfile
15
star
19

zssp

Rust
13
star
20

go-ztcentral

Golang Client for ZeroTier Central
Go
13
star
21

chef-zerotier

Chef recipe for ZeroTier One
Ruby
11
star
22

coyote

A lightweight, embeddable ACME server wwith traits management for storage and challenges
Rust
10
star
23

homebrew-tap

Homebrew tap for ZeroTier
Ruby
10
star
24

terraform-quickstart

HCL
8
star
25

docs

ZeroTier docs site
HTML
8
star
26

go-ztidentity

ZeroTier Identity Generation Library for Go
Go
8
star
27

nat-emulation

A rusty NAT emulation library.
Rust
6
star
28

terraform-zerotier-network

HCL
5
star
29

zeronsd-quickstart

5
star
30

ratpack

A simpleton's HTTP framework for rust-lang
Rust
5
star
31

ztchooks

Primitives for serializing and verifying hooks fired from ZeroTier Central
Go
3
star
32

crypto-glue

Security utility functions and cryptographic API glue code.
Rust
3
star
33

terraform-zerotier-member

HCL
2
star
34

sequential-exchange

The reference implementation of the Sequential Exchange Protocol
Rust
2
star
35

go-zerotier-one

ZeroTierOne service API via deepmap/oapi-codegen
Shell
2
star
36

identity

ZeroTier legacy V1 (x25519) and new (p384) identity and address implementations with common traits.
Rust
2
star
37

zerotier-sockets-apple-framework

Use a ZeroTier node in your macOS, iOS, iPadOS Swift or Objective-C application
C++
1
star
38

common-utils

Rust language common utilities used by multiple ZeroTier crates in Rust.
Rust
1
star
39

udwee

Fast UDP I/O library
Rust
1
star
40

ca_injector

Certificate Authority injector library for Rust
Rust
1
star
41

zerotier-rust-api

Rust API crates for Central and ZeroTierOne
Rust
1
star
42

zt

Rust
1
star
43

helm-charts

ZeroTier
Smarty
1
star
44

ztchooks-ts

Hook verification for hooks fired from ZeroTier Central
TypeScript
1
star
45

zerotier-one-api-spec

ZeroTier
TypeScript
1
star