Skip to content

Commit

Permalink
chore: update usage in README and LICENSE year
Browse files Browse the repository at this point in the history
  • Loading branch information
schollz committed Jan 2, 2025
1 parent 08f9d39 commit 5b6e712
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 29 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2017-2024 Zack
Copyright (c) 2017-2025 Zack

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
66 changes: 38 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,76 +49,77 @@ sudo port install croc

On Windows you can install the latest release with [Scoop](https://scoop.sh/), [Chocolatey](https://chocolatey.org), or [Winget](https://learn.microsoft.com/en-us/windows/package-manager/):

```
```bash
scoop install croc
```

```
```bash
choco install croc
```

```
```bash
winget install schollz.croc
```

On Unix you can install the latest release with [Nix](https://nixos.org/nix):

```
```bash
nix-env -i croc
```


On Alpine Linux you have to install dependencies first:

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

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

```
```bash
pacman -S croc
```

On Fedora you can install with `dnf`:

```
```bash
dnf install croc
```

On Gentoo you can install with `portage`:
```

```bash
emerge net-misc/croc
```

On Termux you can install with `pkg`:

```
```bash
pkg install croc
```

On FreeBSD you can install with `pkg`:

```
```bash
pkg install croc
```

On Linux, macOS, and Windows you can install from [conda-forge](https://github.com/conda-forge/croc-feedstock/) globally with [`pixi`](https://pixi.sh/):

```
```bash
pixi global install croc
```

or into a particular environment with [`conda`](https://docs.conda.io/projects/conda/):

```
```bash
conda install --channel conda-forge croc
```

Or, you can [install Go](https://golang.org/dl/) and build from source (requires Go 1.17+):

```
```bash
go install github.com/schollz/croc/v10@latest
```

Expand All @@ -129,7 +130,7 @@ On Android there is a 3rd party F-Droid app [available to download](https://f-dr

To send a file, simply do:

```
```bash
$ croc send [file(s)-or-folder]
Sending 'file-or-folder' (X MB)
Code is: code-phrase
Expand All @@ -149,15 +150,15 @@ There are a number of configurable options (see `--help`). A set of options (lik

On Linux and Mac OS, the sending & receiving is slightly different to avoid [leaking the secret via the process name](https://nvd.nist.gov/vuln/detail/CVE-2023-43621). On these systems you will need to run `croc` with the secret as an environment variable. For example, to receive with the secret `***`:

```
```bash
CROC_SECRET=*** croc
```

This will show only `croc` in the process list of a multi-user system and not leak the secret.

For a single-user system the default behavior can be permanently enabled by running

```
```bash
croc --classic
```

Expand All @@ -168,30 +169,39 @@ Run this command again to disable classic mode.

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

```
```bash
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:

```
```bash
croc --yes --overwrite <code>
```

### Excluding folders

You can exclude folders from being sent by using the `--exclude` flag with a string of comma-delimited exclusions. For example, if you want to send a folder but exclude any `node_modules` folders or `.venv` folders:

```bash
croc send --exclude "node_modules,.venv" [folder]
```

Exclusions work by excluding any absolute path that contains the string. So in the above example, any folder named `node_modules` or `.venv` will be excluded from the transfer.

### Use pipes - stdin and stdout

You can pipe to `croc`:

```
```bash
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`.

```
```bash
croc --yes [code-phrase] > out
```

Expand All @@ -202,7 +212,7 @@ All of the other text printed to the console is going to `stderr` so it will not

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

```
```bash
croc send --text "hello world"
```

Expand All @@ -213,15 +223,15 @@ This will automatically tell the receiver to use `stdout` when they receive the

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:

```
```bash
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:

```
```bash
croc --curve p521 <codephrase>
```

Expand All @@ -231,23 +241,23 @@ Available curves are P-256, P-348, P-521 and SIEC. P-256 is the default curve.

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.

```
```bash
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:

```
```bash
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.

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

Expand All @@ -258,13 +268,13 @@ Note, when sending, you only need to include the first port (the communication p
If it's easier you can also run a relay with Docker:


```
```bash
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.

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

Expand Down

0 comments on commit 5b6e712

Please sign in to comment.