diff --git a/LICENSE b/LICENSE index 1da03deef..36478805d 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/README.md b/README.md index 316433153..ea7f9c3d4 100644 --- a/README.md +++ b/README.md @@ -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 ``` @@ -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 @@ -149,7 +150,7 @@ 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 ``` @@ -157,7 +158,7 @@ This will show only `croc` in the process list of a multi-user system and not le For a single-user system the default behavior can be permanently enabled by running -``` +```bash croc --classic ``` @@ -168,7 +169,7 @@ 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] ``` @@ -176,22 +177,31 @@ croc send --code [code-phrase] [file(s)-or-folder] 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 ``` +### 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 ``` @@ -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" ``` @@ -213,7 +223,7 @@ 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 ``` @@ -221,7 +231,7 @@ croc --socks5 "127.0.0.1:9050" send SOMEFILE 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 ``` @@ -231,7 +241,7 @@ 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 ``` @@ -239,7 +249,7 @@ croc send --hash imohash SOMEFILE 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 ``` @@ -247,7 +257,7 @@ By default it uses TCP ports 9009-9013. Make sure to open those up. You can cust 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] ``` @@ -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] ```