84 个版本
0.2.76 | 2022 年 6 月 20 日 |
---|---|
0.2.74 | 2021 年 10 月 7 日 |
0.2.72 | 2021 年 5 月 7 日 |
0.2.68 | 2020 年 10 月 16 日 |
0.0.7 | 2018 年 5 月 31 日 |
#5 in #文件上传
250KB
4.5K SLoC
注意:默认的 Send 主机由 @timvisee (信息) 提供。请考虑 捐赠 并帮助其运行。
ffsend
通过命令行轻松安全地共享文件和目录。一个 Send 客户端。
通过一个简单的命令,通过一个安全、私人和加密的链接在命令行中轻松安全地共享文件和目录。文件使用 Send 服务共享,大小可达 1GB。其他人可以使用此工具或通过他们的网络浏览器下载这些文件。
这里没有可见的演示?在 asciinema 上查看。
所有文件始终在客户端加密,机密信息永远不会与远程主机共享。可以指定一个可选的密码,默认文件有效期为 1(最多 20)次下载或 24 小时,以确保您的文件不会永远保留在线。这提供了一个安全平台来共享您的文件。有关安全性的更多信息,请 在此处 查找。
默认使用的公共 Send 服务由 @timvisee (信息) 提供。
此应用程序与 Firefox 或 Mozilla 没有任何关联。
注意:此工具目前处于测试阶段,因为一些额外期望的功能尚未实现
功能
- 功能齐全且友好的命令行工具
- 安全地上传和下载文件和目录,始终在客户端加密
- 额外的密码保护、生成和可配置的下载限制
- 文件和目录的归档和解压
- 内置的URL缩短器和二维码生成器
- 支持Send v3(当前)和v2
- 历史跟踪您的文件以方便管理
- 能够使用自己的Send主机
- 检查或删除共享文件
- 精确的错误报告
- 流加密和上传/下载,内存占用非常低
- 适用于无需交互的脚本
有关即将推出的功能和想法列表,请查看GitLab上的当前开放问题。
用法
轻松上传和下载
# Simple upload
$ ffsend upload my-file.txt
https://send.vis.ee/#sample-share-url
# Advanced upload
# - Specify a download limit of 1
# - Specify upload expiry time of 5 minutes
# - Enter a password to encrypt the file
# - Archive the file before uploading
# - Copy the shareable link to your clipboard
# - Open the shareable link in your browser
$ ffsend upload --downloads 1 --expiry-time 5m --password --archive --copy --open my-file.txt
Password: ******
https://send.vis.ee/#sample-share-url
# Upload to your own host
$ ffsend u -h https://example.com/ my-file.txt
https://example.com/#sample-share-url
# Simple download
$ ffsend download https://send.vis.ee/#sample-share-url
检查远程文件
# Check if a file exists
$ ffsend exists https://send.vis.ee/#sample-share-url
Exists: yes
# Fetch remote file info
$ ffsend info https://send.vis.ee/#sample-share-url
ID: b087066715
Name: my-file.txt
Size: 12 KiB
MIME: text/plain
Downloads: 0 of 10
Expiry: 18h2m (64928s)
其他命令包括
# View your file history
$ ffsend history
# LINK EXPIRE
1 https://send.vis.ee/#sample-share-url 23h57m
2 https://send.vis.ee/#other-sample-url 17h38m
3 https://example.com/#sample-share-url 37m30s
# Change the password after uploading
$ ffsend password https://send.vis.ee/#sample-share-url
Password: ******
# Delete a file
$ ffsend delete https://send.vis.ee/#sample-share-url
使用--help
标志,help
子命令,或查看帮助部分以获取所有可用子命令。
需求
- Linux、macOS、Windows、FreeBSD、Android(其他BSD可能也适用)
- 终端 😎
- 互联网连接
- Linux
- OpenSSL & CA证书
- Ubuntu、Debian及其衍生版:
apt install openssl ca-certificates
- Ubuntu、Debian及其衍生版:
- 可选:使用剪贴板支持的
xclip
或xsel
- Ubuntu、Debian及其衍生版:
apt install xclip
- CentOS/Red Hat/openSUSE/Fedora:
yum install xclip
- Arch:
pacman -S xclip
- Ubuntu、Debian及其衍生版:
- OpenSSL & CA证书
- Windows特定
- 可选OpenSSL带有
crypto-openssl
功能:[安装程序](https://u.visee.me/dl/openssl/Win64OpenSSL_Light-1_1_0j.exe)(v1.1.0j或更高版本)
- 可选OpenSSL带有
- macOS特定
- 可选OpenSSL带有
crypto-openssl
功能:brew install [email protected]
- 可选OpenSSL带有
- FreeBSD特定
- OpenSSL:
pkg install openssl
- CA证书:
pkg install ca_root_nss
- 可选
xclip
&xsel
用于剪贴板支持:pkg install xclip xsel-conrad
- OpenSSL:
- Android特定
- Termux:» Termux
安装
由于ffsend
仍处于早期阶段,目前只有有限的安装选项。请随意贡献额外的包。
请确保您满足并安装要求。
请参阅以下特定操作系统的说明
Linux(所有发行版)
如果支持,建议使用snap包。
或者您也可以使用预构建的二进制文件手动安装。
只提供64位(x86_64
)包和二进制文件。对于其他架构和配置,您可以从源代码编译。
将很快提供更多包选项。
Linux:snap包
注意:ffsend
的snap
包是隔离的,并且只能访问您的家目录中的文件。如果您不想有这种限制,请选择不同的安装选项。
注意:由于默认配置的 snap
,您可能无法在不进行手动修改的情况下,在某些环境中使用此包,例如通过SSH。如果您遇到问题,请参考其他安装方法,例如预编译的二进制文件,或打开一个问题。
snap install ffsend
ffsend --help
Linux: Arch AUR软件包
» ffsend-bin
(预编译的二进制文件,最新版本,推荐使用)
» ffsend
(从源码编译,最新版本)
» ffsend-git
(从源码编译,最新master
提交)
yay -S ffsend
# or
aurto add ffsend-bin
sudo pacman -S ffsend-bin
# or using any other AUR helper
ffsend --help
Linux: Nix软件包
注意:Nix软件包目前无法自动更新,可能稍显过时。
nix-channel --update
nix-env --install ffsend
ffsend --help
Linux: Fedora软件包
注意:Fedora软件包由贡献者维护,可能稍显过时。
sudo dnf install ffsend
ffsend --help
Linux: Alpine软件包
注意:Alpine软件包由贡献者维护,可能过时。如果缺少重要更新,请选择其他安装方法。
apk add ffsend --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
ffsend --help
Linux: 预编译的二进制文件
查看Linux二进制文件的最新发布资源。
使用ffsend-v*-linux-x64-static
二进制文件,以最大程度地减少问题发生的可能性。如果它尚未提供,您可以使用旧版本中的工件,直到它可用。
在继续之前,请确保满足并安装要求。
您必须使二进制文件可执行,并可能希望将其移动到/usr/bin
以使其易于执行
# Rename binary to ffsend
mv ./ffsend-* ./ffsend
# Mark binary as executable
chmod a+x ./ffsend
# Move binary into path, to make it easily usable
sudo mv ./ffsend /usr/local/bin/
ffsend --help
macOS
建议使用homebrew
软件包。
或者,您可以通过MacPorts安装它,或者手动使用预编译的二进制文件。
macOS: homebrew软件包
确保您已安装homebrew
,并运行
brew install ffsend
ffsend --help
macOS: MacPorts
注意:MacPorts中的ffsend目前无法自动更新,可能稍显过时。
一旦您安装了MacPorts,您可以运行
sudo port selfupdate
sudo port install ffsend
macOS: Nix软件包
注意:Nix软件包目前无法自动更新,可能稍显过时。
nix-channel --update
nix-env --install ffsend
ffsend --help
macOS: 预编译的二进制文件
查看macOS二进制文件的最新发布资源。如果它尚未提供,您可以使用旧版本中的工件,直到它可用。
然后,将下载的二进制文件标记为可执行文件。然后,您可能希望将其移动到/usr/local/bin/
,以便全局可用ffsend
命令
# Rename file to ffsend
mv ./ffsend-* ./ffsend
# Mark binary as executable
chmod a+x ./ffsend
# Move binary into path, to make it easily usable
sudo mv ./ffsend /usr/local/bin/
ffsend
Windows
建议使用scoop
软件包。
或者,您可以通过预编译的二进制文件手动安装它。
如果您正在使用Windows子系统中的Linux,强烈建议您安装预编译的Linux二进制文件。
仅提供64位(x86_64
)的二进制文件。对于其他架构和配置,您可以从源代码编译。
将很快提供chocolatey
软件包和.msi
安装程序。
Windows: scoop软件包
请确保您已经安装了scoop
,然后运行
scoop install ffsend
ffsend --help
Windows: 预编译的二进制文件
请查看最新版本的Windows二进制文件资源。使用ffsend-v*-windows-x64-static
二进制文件,以最大程度地减少问题的可能性。如果它尚未提供,您可以使用之前的版本的工件,直到它可用。
您可以在同一目录下使用ffsend
命令行。
.\ffsend.exe --help
要将它作为ffsend
全局调用,您必须将二进制文件放入您的系统PATH
中。最简单的解决方案是将它移动到System32
move .\ffsend.exe C:\Windows\System32\ffsend.exe
FreeBSD
注意:目前由FreeBSD贡献者维护FreeBSD软件包,可能略微过时。
# Precompiled binary.
pkg install ffsend
# Compiles and installs from source.
cd /usr/ports/www/ffsend && make install
Android
ffsend
可以通过Termux在Android上使用,首先安装它:» Termux
注意:目前由Termux贡献者维护Android软件包,可能略微过时。
# Install package.
pkg install ffsend
ffsend help
其他操作系统或架构
如果您的系统运行Docker,您可以使用docker镜像。目前没有其他二进制文件或软件包可用。
您可以选择从源代码构建项目。
Docker镜像
有一个Docker镜像可用于在容器中运行ffsend
。将目录挂载到/data
,以便容器中的ffsend
可以访问,并像通常一样使用命令。
# Invoke without arguments
docker run --rm -it -v $(pwd):/data timvisee/ffsend
# Upload my-file.txt
docker run --rm -it -v $(pwd):/data timvisee/ffsend upload my-file.txt
# Download from specified link
docker run --rm -it -v $(pwd):/data timvisee/ffsend download https://send.vis.ee/#sample-share-url
# Show help
docker run --rm -it -v $(pwd):/data timvisee/ffsend help
# To update the used image
docker pull timvisee/ffsend
在Linux或macOS上,您可以在您的shell配置中定义别名,以便可以将其作为ffsend
调用
alias ffsend='docker run --rm -it -v "$(pwd):/data" timvisee/ffsend'
注意:此实现仅限于通过指定的挂载访问您提供的路径。
构建
在继续之前,您必须满足以下要求来构建和安装ffsend
构建要求
- 运行时要求
git
rust
v1.40
或更高版本(使用rustup
安装)- OpenSSL或LibreSSL库/头文件
- Linux
- Ubuntu,Debian及其衍生品:
apt install build-essential cmake pkg-config libssl-dev
- CentOS/Red Hat/openSUSE:
yum install gcc gcc-c++ make cmake openssl-devel
- Arch:
pacman -S openssl base-devel
- Gentoo:
emerge -a dev-util/pkgconfig dev-util/cmake dev-libs/openssl
- Fedora:
dnf install gcc gcc-c++ make cmake openssl-devel
- 或查看这里的说明
- Ubuntu,Debian及其衍生品:
- Windows
- 可选使用
crypto-openssl
功能:请参考以下说明 这里
- 可选使用
- macOS
- 可选使用
crypto-openssl
功能:运行以下命令brew install cmake pkg-config openssl
或查看说明 这里
- 可选使用
- FreeBSD
pkg install rust gmake pkgconf python36 libxcb xclip ca_root_nss xsel-conrad
- 建议使用并修改现有的
ffsend
端口,它会为您管理依赖项。
- Linux
编译和安装
然后,按照以下步骤之一编译和安装 ffsend
-
直接从 cargo 编译和安装
# Compile and install from cargo cargo install ffsend -f # Start using ffsend ffsend --help
-
或克隆存储库并使用
cargo
安装# Clone the project git clone https://github.com/timvisee/ffsend.git cd ffsend # Compile and install cargo install --path . -f # Start using ffsend ffsend --help # or run it directly from cargo cargo run --release -- --help
-
或克隆存储库并直接调用二进制文件(Linux/macOS)
# Clone the project git clone https://github.com/timvisee/ffsend.git cd ffsend # Build the project (release version) cargo build --release # Start using ffsend ./target/release/ffsend --help
编译功能和选项
为 ffsend
提供不同的选项,用于切换是否包含各种功能。以下是一些可用的功能,其中一些默认启用
功能 | 启用 | 描述 |
---|---|---|
send2 |
默认 | 支持 Send v2 服务器 |
send3 |
默认 | 支持 Send v3 服务器 |
crypto-ring |
默认 | 使用 ring 作为加密后端 |
crypto-openssl |
使用 OpenSSL 作为加密后端 | |
clipboard |
默认 | 支持将链接复制到剪贴板 |
history |
默认 | 支持跟踪历史中的文件 |
archive |
默认 | 支持存档和提取上传和下载 |
qrcode |
默认 | 支持为共享 URL 渲染二维码 |
urlshorten |
默认 | 支持缩短共享 URL |
infer-command |
默认 | 支持根据二进制名称推断子命令 |
no-color |
在错误和帮助消息中不编译颜色支持 |
在构建或安装期间启用功能,请使用 --features <features...>
指定它们,当使用 cargo
时。您可能希望首先使用 --no-default-features
禁用默认功能。以下是一些示例
# Defaults set of features with no-color, one of
cargo install --features no-color
cargo build --release --features no-color
# No default features, except required
cargo install --no-default-features --features send3,crypto-ring
# With history and clipboard support
cargo install --no-default--features --features send3,crypto-ring,history,clipboard
对于 Windows 系统,建议提供 no-color
标志,因为 Windows 终端的颜色支持不稳定。
配置和环境
以下环境变量可用于配置以下默认值。CLI 标志与它一起显示,以更好地描述与命令行参数的关系
变量 | CLI 标志 | 描述 |
---|---|---|
FFSEND_HISTORY |
--history<FILE> |
历史文件路径 |
FFSEND_HOST |
--host<URL> |
上传主机 |
FFSEND_TIMEOUT |
--timeout <SECONDS> |
请求超时(0 以禁用) |
FFSEND_TRANSFER_TIMEOUT |
--transfer-timeout <SECONDS> |
传输超时(0 以禁用) |
FFSEND_EXPIRY_TIME |
--expiry-time <SECONDS> |
默认上传过期时间 |
FFSEND_DOWNLOAD_LIMIT |
--download-limit<DOWNLOADS> |
默认下载限制 |
FFSEND_API |
--api<VERSION> |
服务器 API 版本,- 以查找 |
FFSEND_BASIC_AUTH |
--basic-auth<USER:PASSWORD> |
基本 HTTP 认证凭据 |
以下环境变量可用于切换标志,只需使它们可用即可。这些变量的实际值被忽略,并且变量可以为空。
变量 | CLI 标志 | 描述 |
---|---|---|
FFSEND_FORCE |
--force |
强制操作 |
FFSEND_NO_INTERACT |
--no-interact |
对于提示没有交互 |
FFSEND_YES |
--yes |
假设提示为是 |
FFSEND_INCOGNITO |
--incognito |
隐身模式,不使用历史记录 |
FFSEND_OPEN |
--open |
打开已上传文件的分享链接 |
FFSEND_ARCHIVE |
--archive |
已上传文件存档 |
FFSEND_EXTRACT |
--extract |
提取下载的文件 |
FFSEND_COPY |
--copy |
将分享链接复制到剪贴板 |
FFSEND_COPY_CMD |
--copy-cmd |
将下载命令复制到剪贴板 |
FFSEND_QUIET |
--quiet |
记录安静信息 |
FFSEND_VERBOSE |
--verbose |
记录详细信息 |
一些环境变量可能在编译时设置,以调整一些默认值。
变量 | 描述 |
---|---|
XCLIP_PATH |
在使用 clipboard-bin (Linux, *BSD) 时设置固定的 xclip 二进制路径 |
XSEL_PATH |
在 使用 clipboard-bin (Linux, *BSD) 时设置固定的 xsel 二进制路径 |
目前,没有配置或 dotfile 文件支持。这将在以后的版本中添加。
每个子命令的二进制文件:ffput
、ffget
ffsend
支持为单个子命令有单独的二进制文件,例如,仅使用 ffsend
进行上传和下载时只有 ffput
和 ffget
。这允许简单直接的命令
ffput my-file.txt
ffget https://send.vis.ee/#sample-share-url
这适用于预定义的二进制名称列表
ffput
→ffsend upload ...
ffget
→ffsend download ...
ffdel
→ffsend delete ...
- 此列表在
src/config.rs
中定义为INFER_COMMANDS
您可以使用以下方法设置这些单个命令的二进制文件
- 创建一个正确命名的符号链接(推荐)
- 创建一个正确命名的硬链接
- 克隆
ffsend
二进制文件,并重命名它
在 Linux 和 macOS 上,您可以使用以下命令在当前目录中设置符号链接
ln -s $(which ffsend) ./ffput
ln -s $(which ffsend) ./ffget
此功能的支持仅在 ffsend
使用 infer-command
功能标志编译时才可用。这通常默认启用。要验证现有安装中是否支持该功能,请在调用 ffsend debug
时确保列出功能。
请注意,由于此包格式的工作方式,snap
包当前不支持此功能。
脚本化能力
ffsend
优化用于自动化脚本。它提供了一些专门的参数来控制 ffsend
而无需用户交互。
--no-interact
(-I
): 不允许用户交互。对于没有默认值的提示,应用程序将因错误而退出,除非提供了--yes
或--force
。在自动化脚本中使用时应始终提供此选项。
示例:在上传目录时,提供此标志将阻止存档问题提示弹出,并将目录存档作为默认选项。--yes
(-y
): 默认假设是 yes/no 提示的 yes 选项。
示例:下载已存在的文件时,提供此标志将在询问覆盖文件时假设 yes。--force
(-f
): 强制继续执行操作,跳过任何会导致应用程序退出的警告。
示例:上传文件过大时,提供此标志将忽略文件大小警告并强制继续。--quiet
(-q
):静默运行,尽可能少地输出信息。
示例:上传文件时,提供此标志将只输出最终分享链接。
一般来说,在自动化时遵循以下规则
- 始终提供
--no-interact
(-I
)。 - 为想要完成的操作提供任何组合的
--yes
(-y
) 和--force
(-f
)。 - 在传递分享链接时,例如上传时,提供
--quiet
(-q
) 标志。
这些标志也可以通过定义环境变量自动设置,具体请参阅此处。
» 配置和环境
以下是一些在 bash
中使用的示例命令。
# Stop on error
set -e
# Upload a file
# -I: no interaction
# -y: assume yes
# -q: quiet output, just return the share link
URL=$(ffsend -Iy upload -q my-file.txt)
# Render file information
# -I: no interaction
# -f: force, just show the info
ffsend -If info $URL
# Set a password for the uploaded file
ffsend -I password $URL --password="secret"
# Use the following flags automatically from now on
# -I: no interaction
# -f: force
# -y: yes
export FFSEND_NO_INTERACT=1 FFSEND_FORCE=1 FFSEND_YES=1
# Download the uploaded file, overwriting the local variant due to variables
ffsend download $URL --password="secret"
有关这些参数的更多信息,请运行 ffsend help
并查看: » 配置和环境
有关自动化或其他功能请求的任何问题,请确保在 此处 提出一个问题。
安全
简而言之;ffsend
工具和 Send 服务可以被认为是安全的,并且可以用于分享敏感文件。但请注意,上传创建的分享链接将允许任何人下载文件。确保不要将此链接与未经授权的人分享。
有关加密的更详细信息,请阅读本节中其余部分的段落。
注意:尽管加密方法被认为是安全的,但此 ffsend
工具在任何形式、方式或程度上均不对未经适当授权而意外解密的数据文件提供任何保证。
客户端加密
ffsend
使用客户端加密,确保在文件上传到远程主机之前文件被安全加密。这使得第三方在没有秘密(加密密钥)的情况下无法解密您的文件。文件及其元数据使用 128-位 AES-GCM
加密,并使用 HMAC SHA-256
签名密钥进行请求认证。这与 Send 服务提供的加密文档一致,ffsend
是为此工具。
关于加密/解密步骤的详细列表和使用的确切加密类型,可以在官方服务文档 此处 找到。
关于分享链接安全的说明
用于下载时解密文件的加密秘密包含在分享链接后面的 #
(哈希)中。当使用浏览器中的分享链接时,这个秘密永远不会直接发送到远程服务器。但是,网页可能加载一些恶意 JavaScript 片段,一旦页面加载完成,就会从链接中窃取这个秘密。尽管这种场景极不可能发生,但有一些选项可以防止这种情况发生。
- 仅使用此
ffsend
工具,不要在浏览器中使用分享链接。 - 通过使用
--password
在上传时指定密码,或之后使用password
子命令来增加额外的保护。 - 自己托管一个安全的Send服务实例。
关于加密的完整概述可以在官方服务文档这里找到。
帮助
$ ffsend help
ffsend 0.2.72
Tim Visee <3[email protected]>
Easily and securely share files from the command line.
A fully featured Send client.
The default public Send host is provided by Tim Visee, @timvisee.
Please consider to donate and help keep it running: https://vis.ee/donate
USAGE:
ffsend [FLAGS] [OPTIONS] [SUBCOMMAND]
FLAGS:
-f, --force Force the action, ignore warnings
-h, --help Prints help information
-i, --incognito Don't update local history for actions
-I, --no-interact Not interactive, do not prompt
-q, --quiet Produce output suitable for logging and automation
-V, --version Prints version information
-v, --verbose Enable verbose information and logging
-y, --yes Assume yes for prompts
OPTIONS:
-A, --api <VERSION> Server API version to use, '-' to lookup [env: FFSEND_API]
--basic-auth <USER:PASSWORD> Protected proxy HTTP basic authentication credentials (not FxA) [env: FFSEND_BASIC_AUTH]
-H, --history <FILE> Use the specified history file [env: FFSEND_HISTORY]
-t, --timeout <SECONDS> Request timeout (0 to disable) [env: FFSEND_TIMEOUT]
-T, --transfer-timeout <SECONDS> Transfer timeout (0 to disable) [env: FFSEND_TRANSFER_TIMEOUT]
SUBCOMMANDS:
upload Upload files [aliases: u, up]
download Download files [aliases: d, down]
debug View debug information [aliases: dbg]
delete Delete a shared file [aliases: del, rm]
exists Check whether a remote file exists [aliases: e]
generate Generate assets [aliases: gen]
help Prints this message or the help of the given subcommand(s)
history View file history [aliases: h]
info Fetch info about a shared file [aliases: i]
parameters Change parameters of a shared file [aliases: params]
password Change the password of a shared file [aliases: pass, p]
version Determine the Send server version [aliases: v]
This application is not affiliated with Firefox or Mozilla.
特别感谢
- 致所有
ffsend
源/包的贡献者 - 感谢Mozilla构建了惊人的Firefox Send服务(《分支》)
- 感谢asciinema和svg-term的所有参与者,他们提供了制作出色视觉演示的工具
- 感谢所有参与所有crate依赖项的人
许可证
本项目采用GNU GPL-3.0许可证发布。有关更多信息,请查看LICENSE文件。
依赖项
~17–35MB
~559K SLoC