• Stars
    star
    23,068
  • Rank 917 (Top 0.02 %)
  • Language
    Go
  • License
    MIT License
  • Created over 6 years ago
  • Updated 10 months ago

Reviews

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

Repository Details

Easily and securely send things from one computer to another 🐊 📦

croc
Version Coverage Build
Status

This project is supported by Github sponsors.

croc is a tool that allows any two computers to simply and securely transfer files and folders. AFAIK, croc is the only CLI file-transfer tool that does all of the following:

  • allows any two computers to transfer data (using a relay)
  • provides end-to-end encryption (using PAKE)
  • enables easy cross-platform transfers (Windows, Linux, Mac)
  • allows multiple file transfers
  • allows resuming transfers that are interrupted
  • local server or port-forwarding not needed
  • ipv6-first with ipv4 fallback
  • can use proxy, like tor

For more information about croc, see my blog post or read a recent interview I did.

Example

Install

Download the latest release for your system, or install a release from the command-line:

curl https://getcroc.schollz.com | bash

On macOS you can install the latest release with Homebrew:

brew install croc

On macOS you can also install the latest release with MacPorts:

sudo port selfupdate
sudo port install croc

On Windows you can install the latest release with Scoop, Chocolatey, or Winget:

scoop install croc
choco install croc
winget install schollz.croc

On Unix you can install the latest release with Nix:

nix-env -i croc

On Alpine Linux you have to install dependencies first:

apk add bash coreutils
wget -qO- https://getcroc.schollz.com | bash

On Arch Linux you can install the latest release with pacman:

pacman -S croc

On Fedora you can install with dnf:

dnf install croc

On Gentoo you can install with portage:

emerge net-misc/croc

On Termux you can install with pkg:

pkg install croc

On FreeBSD you can install with pkg:

pkg install croc

Or, you can install Go and build from source (requires Go 1.17+):

go install github.com/schollz/croc/v9@latest

On Android there is a 3rd party F-Droid app available to download.

Usage

To send a file, simply do:

$ croc send [file(s)-or-folder]
Sending 'file-or-folder' (X MB)
Code is: code-phrase

Then to receive the file (or folder) on another computer, you can just do

croc code-phrase

The code phrase is used to establish password-authenticated key agreement (PAKE) which generates a secret key for the sender and recipient to use for end-to-end encryption.

There are a number of configurable options (see --help). A set of options (like custom relay, ports, and code phrase) can be set using --remember.

Custom code phrase

You can send with your own code phrase (must be more than 6 characters).

croc send --code [code-phrase] [file(s)-or-folder]

Allow overwriting without prompt

By default, croc will prompt whether to overwrite a file. You can automatically overwrite files by using the --overwrite flag (recipient only). For example, receive a file to automatically overwrite:

croc --yes --overwrite <code>

Use pipes - stdin and stdout

You can pipe to croc:

cat [filename] | croc send

In this case croc will automatically use the stdin data and send and assign a filename like "croc-stdin-123456789". To receive to stdout at you can always just use the --yes will automatically approve the transfer and pipe it out to stdout.

croc --yes [code-phrase] > out

All of the other text printed to the console is going to stderr so it will not interfere with the message going to stdout.

Send text

Sometimes you want to send URLs or short text. In addition to piping, you can easily send text with croc:

croc send --text "hello world"

This will automatically tell the receiver to use stdout when they receive the text so it will be displayed.

Use a proxy

You can use a proxy as your connection to the relay by adding a proxy address with --socks5. For example, you can send via a tor relay:

croc --socks5 "127.0.0.1:9050" send SOMEFILE

Change encryption curve

You can choose from several different elliptic curves to use for encryption by using the --curve flag. Only the recipient can choose the curve. For example, receive a file using the P-521 curve:

croc --curve p521 <codephrase>

Available curves are P-256, P-348, P-521 and SIEC. P-256 is the default curve.

Change hash algorithm

You can choose from several different hash algorithms. The default is the xxhash algorithm which is fast and thorough. If you want to optimize for speed you can use the imohash algorithm which is even faster, but since it samples files (versus reading the whole file) it can mistakenly determine that a file is the same on the two computers transferring - though this is only a problem if you are syncing files versus sending a new file to a computer.

croc send --hash imohash SOMEFILE

Self-host relay

The relay is needed to staple the parallel incoming and outgoing connections. By default, croc uses a public relay but you can also run your own relay:

croc relay

By default it uses TCP ports 9009-9013. Make sure to open those up. You can customize the ports (e.g. croc relay --ports 1111,1112), but you must have a minimum of 2 ports for the relay. The first port is for communication and the subsequent ports are used for the multiplexed data transfer.

You can send files using your relay by entering --relay to change the relay that you are using if you want to custom host your own.

croc --relay "myrelay.example.com:9009" send [filename]

Note, when sending, you only need to include the first port (the communication port). The subsequent ports for data transfer will be transmitted back to the user from the relay.

Self-host relay (docker)

If it's easier you can also run a relay with Docker:

docker run -d -p 9009-9013:9009-9013 -e CROC_PASS='YOURPASSWORD' schollz/croc

Be sure to include the password for the relay otherwise any requests will be rejected.

croc --pass YOURPASSWORD --relay "myreal.example.com:9009" send [filename]

Note: when including --pass YOURPASSWORD you can instead pass a file with the password, e.g. --pass FILEWITHPASSWORD.

License

MIT

Acknowledgements

croc has gone through many iterations, and I am awed by all the great contributions! If you feel like contributing, in any way, by all means you can send an Issue, a PR, or ask a question.

Thanks @warner for the idea, @tscholl2 for the encryption gists, @skorokithakis for code on proxying two connections. Finally thanks for making pull requests @maximbaz, @meyermarcel, @Girbons, @techtide, @heymatthew, @Lunsford94, @lummie, @jesuiscamille, @threefjord, @marcossegovia, @csleong98, @afotescu, @callmefever, @El-JojA, @anatolyyyyyy, @goggle, @smileboywtu, @nicolashardy, @fbartels, @rkuprov, @hreese, @xenrox and Ipar!

More Repositories

1

howmanypeoplearearound

Count the number of people around you 👨‍👨‍👦 by monitoring wifi signals 📡
Python
6,759
star
2

find

High-precision indoor positioning framework for most wifi-enabled devices.
Go
5,006
star
3

find3

High-precision indoor positioning framework, version 3.
Go
4,494
star
4

progressbar

A really basic thread-safe progress bar for Golang applications
Go
3,367
star
5

hostyoself

Host yo' self from your browser, your phone, your toaster.
Go
1,777
star
6

find-lf

Track the location of every Wi-Fi device (📱) in your house using Raspberry Pis and FIND
Go
977
star
7

rwtxt

A cms for absolute minimalists.
JavaScript
934
star
8

cowyo

A feature-rich wiki webserver for minimalists 🐮 💬
JavaScript
906
star
9

raspberry-pi-turnkey

How to make a Raspberry Pi image that can be deployed anywhere and assigned to a WiFi network without SSH 👌
Python
767
star
10

peerdiscovery

Pure-Go library for cross-platform local peer discovery using UDP multicast 👩 🔁 👩
Go
594
star
11

closestmatch

Golang library for fuzzy matching within a set of strings 📃
Go
407
star
12

gojot

A command-line journal that is distributed and encrypted, making it easy to jot notes 📓
Go
343
star
13

PIanoAI

Realtime piano learning and accompaniment from a Pi-powered AI 🎹
Go
331
star
14

spotifydownload

A dependency-free Spotify playlist downloader that should just work
Shell
318
star
15

poetry-generator

A Python2 based Backus-Naur poetry generator
Python
294
star
16

musicsaur

Music synchronization from your browser.
Go
280
star
17

offlinenotepad

An offline-first, secure, private notepad. 📔 ✏️
JavaScript
236
star
18

pluck

Pluck text in a fast and intuitive way 🐓
Go
214
star
19

pake

PAKE library for generating a strong secret between parties over an insecure channel
Go
180
star
20

miti

miti is a musical instrument textual interface. Basically, its MIDI, but with human-readable text. 🎵
Go
157
star
21

meanrecipe

Get a consensus recipe for your next meal. 🍪 🍰
Go
156
star
22

find3-cli-scanner

The command-line scanner that supports Bluetooth and WiFi
Go
142
star
23

playlistfromsong

Create an offline music playlist from a single song 🎶
Python
136
star
24

recursive-recipes

Visualize the recursive nature of recipes 🍰 🍪
Go
135
star
25

teoperator

Make OP-1 and OP-Z drum and synth patches from any sound. 🎹
Go
134
star
26

jsonstore

Simple thread-safe in-memory JSON key-store with persistent backend
Go
130
star
27

getsong

Download any song mp3 with no dependencies except ffmpeg
Go
124
star
28

find3-android-scanner

An android app that scans Bluetooth and WiFi for FIND3
Java
119
star
29

linkcrawler

Cross-platform persistent and distributed web crawler 🔗
Go
111
star
30

ingredients

Extract recipe ingredients from any recipe website on the internet.
HTML
109
star
31

share

Simple file sharing from the browser and the command-line.
Go
106
star
32

faas

Make any Go function into a API (FaaS)
Go
96
star
33

find-maraudersmap

Internal positioning for everyone, in the style of Harry Potter
HTML
67
star
34

broadcast-server

A simple Go server that broadcasts any data/stream.
Go
65
star
35

streammyaudio

Easily stream audio from any computer to the internet.
HTML
63
star
36

cowyodel

Easily move things between computers with a code phrase and https://cowyo.com 🐮 💬
Go
62
star
37

extract_recipe

Extract recipes from websites, calculates cooking times, collects nutrition info from USDA database
Python
61
star
38

crawdad

Cross-platform persistent and distributed web crawler 🦀
Go
61
star
39

duct

Inspired by patchbay.pub
Go
59
star
40

svg2gcode

Converts svg to gcode for pen plotters
Go
53
star
41

snaptext

A simple webapp to send and receive self-destructing messages in real-time. ✉️ ⚡
Go
53
star
42

pywebsitechanges

Change detection with a simple Python script to email you whenever a website changes.
Python
51
star
43

rpi_ai

An AI developed for the Raspberry Pi
Python
50
star
44

websitechanges

Alerts you via email about a website change.
Go
47
star
45

kiki

An experimental social network that works offline.
Go
46
star
46

pikocore

source for the pikocore drum machine
C++
46
star
47

goagrep

agrep-like fuzzy matching, but made faster using Golang and precomputation.
Go
45
star
48

oooooo

digital tape loops for monome norns, x6.
Lua
43
star
49

readable

Making web pages readable in a browser and in the command line 🔗 📖
Go
41
star
50

onetwothree

A responsive minimalist theme for Hugo that is simple as 1, 2, 3
CSS
39
star
51

logue

A collection of Korg logue patches for the NTS-1 (or possibly minilogue XD)
C
37
star
52

midi2cv-pi

Use a simple Python script, a few wires, and a MCP4725 to convert any MIDI signal to a control voltage.
Python
37
star
53

sqlite3dump

A Golang library for dumping SQL text
Go
35
star
54

wifiscan

A platform-independent WiFi scanning library for getting BSSID + RSSI
Go
35
star
55

norns.online

online norns with norns.online
Go
35
star
56

bol

Command-line and web journal that stays synchronized and encrypted across devices
Go
34
star
57

syncdir

Automatically discover peers and synchronize a folder
Go
33
star
58

18000

18,000 seconds of music.
SuperCollider
32
star
59

beowulf_ssh_cluster

Skeleton program for a simple Beowulf cluster that uses ssh to communicate
Python
31
star
60

markdown2tufte

Process markdown into a nice Tufte-like website 📖
CSS
31
star
61

carp

Browser-based Korg NTS-1 chord arpeggiator (carp) sequencer
JavaScript
28
star
62

httpfileserver

Wrapper for Golang http.FileServer that is faster (serving from memory) and uses less bandwidth (gzips when possible)
Go
27
star
63

nyblcore

ATtiny85-based sample machine with tempo-based effects.
C++
27
star
64

browsersync

A simple live-reloading tool for developing HTML.
Go
26
star
65

tape-synth

Instructions to create a cassette synthesizer.
Go
26
star
66

squirrel

Like curl, or wget, but downloads directly go to a SQLite databse
Go
25
star
67

workshops

workshops
SuperCollider
23
star
68

patchitup

Backup your file to your remote server using minimum bandwidth.
Go
23
star
69

logger

Simplistic, opinionated logging for Golang
Go
21
star
70

mnemonicode

Go
20
star
71

boltdb-server

Fancy server and Go package for connecting to BoltDB databases
Go
20
star
72

zget

zack's wget
Go
19
star
73

wormhole

Transfer files over TCP in Go
Go
19
star
74

quotation-explorer

Explore and search over 120,000 quotations, with the click of a mouse 🌎💬
Go
19
star
75

_core

_core firmware for rp2040-based sample mangling devices
C
19
star
76

o-o-o

dot-connected fm synth and sequencer for norns
Lua
18
star
77

norns-desktop

norns in docker
Dockerfile
17
star
78

tapedeck

norns tape deck emulator.
Lua
17
star
79

amenbreak

a dedicated amen break script for norns.
Lua
16
star
80

prevent-link-rot

Simple utility to convert links in any file to permanent links via the https://archive.org/web/ or http://perma.cc
HTML
16
star
81

anonfiction

A CMS for reading and writing stories in a online magazine format. 📖
Go
16
star
82

raw

Go
16
star
83

mx.samples

like mr. radar or mr.coffee but for samples on norns.
Lua
15
star
84

supertonic

an instrospective drum machien
Lua
15
star
85

mx.synths

norns script for polyphonic synths
Lua
14
star
86

autojack

norns mod for automatically jacking in usb audio
Lua
14
star
87

fbdb

File based database
Go
14
star
88

broadcast

Lua
14
star
89

zxcvbn

a norns script for a tracker on norns.
Lua
14
star
90

heartbpm

Control the tempo of electronic instruments with your heart rate. 💗 🎵
JavaScript
14
star
91

web-archiver

A tiny Python clone of https://archive.org/web/ for your own personal websites.
Python
13
star
92

paracosms

norns script to play and sample many samples.
Lua
13
star
93

album-at-the-place

Open-sourcing my latest music album.
12
star
94

indeterminate-music

A framework for creating indeterminate music (in development) 🎵
HTML
12
star
95

ipfs-connect

Easily connect two computers in the IPFS
Go
11
star
96

googleit

Get results from search engines.
Go
11
star
97

stringsizer

A very simple way to encode short strings.
Go
11
star
98

supercollisions

collection of SuperCollider scripts
SuperCollider
11
star
99

amen

sampler & mangler for monome norns
Lua
11
star
100

string_matching

A simple and fast approach to selecting the best string in a list of strings despite errors or mispelling.
Python
11
star