Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
transfer.sh — 从命令行轻松快速地共享文件。 | Kitploit
工具/GitHubGitHub/dutchcoders/transfer.sh
通用工具加密/解密工具数据泄露
GitHubdutchcoders/transfer.sh

transfer.sh

从命令行轻松快速地共享文件。

查看仓库
15.9k1.6k2个月前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享

安全警告

通过未认证的 X-Forwarded-For 头欺骗绕过 IP 过滤和 HTTP 认证

transfer.sh Go Report Card Docker pulls Build Status

从命令行轻松快速地共享文件。该代码包含服务器和创建您自己实例所需的一切。

Transfer.sh 目前支持 s3(Amazon S3)、gdrive(Google Drive)、storj(Storj)提供商以及本地文件系统(local)。




免责声明

@stefanbenten 恰好是这个仓库的维护者,同时也在仓库中托管了一个知名的公共软件安装实例。

这两个角色是无关的,本仓库不是用来处理任何公共安装实例的请求和问题的。

为了安全原因,仓库本身不会宣传或提及任何第三方的公共安装实例。

我,@aspacca,作为仓库维护者的官方立场是:如果您想使用该软件,应该托管自己的安装实例。




用法

本节介绍如何使用 transfer.sh


上传```bash

$ curl -v --upload-file ./hello.txt https://transfer.sh/hello.txt

root@kitploit:~
<br />

### 加密与上传```bash
$ gpg --armor --symmetric --output - /tmp/hello.txt | curl --upload-file - https://transfer.sh/test.txt

下载与解密```bash

$ curl https://transfer.sh/1lDau/test.txt | gpg --decrypt --output /tmp/hello.txt

root@kitploit:~
<br />

### 上传到 Virustotal```bash
$ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/virustotal

删除```bash

$ curl -X DELETE

root@kitploit:~
<br />

---

<br />

## 请求头

本节介绍如何使用 curl 处理请求头:

<br />

### Max-Downloads```bash
$ curl --upload-file ./hello.txt https://transfer.sh/hello.txt -H "Max-Downloads: 1" # Limit the number of downloads

Max-Days```bash

$ curl --upload-file ./hello.txt https://transfer.sh/hello.txt -H "Max-Days: 1" # Set the number of days before deletion

root@kitploit:~
<br />

### X-Encrypt-Password

#### 警告,仅在你自托管的服务器上使用此功能:信任第三方服务进行服务器端加密需自行承担风险```bash
$ curl --upload-file ./hello.txt https://your-transfersh-instance.tld/hello.txt -H "X-Encrypt-Password: test" # Encrypt the content server side with AES256 using "test" as password

X-Decrypt-Password

注意,请仅在您自托管的服务器上使用此功能:信任第三方服务进行服务器端加密的风险由您自行承担。```bash

$ curl https://your-transfersh-instance.tld/BAYh0/hello.txt -H "X-Decrypt-Password: test" # Decrypt the content server side with AES256 using "test" as password

root@kitploit:~
<br />

---

<br />

## 响应头

本节说明如何处理响应头:

<br />

### X-Url-Delete

用于请求删除文件的 URL,并作为响应头返回:```bash
curl -sD - --upload-file ./hello.txt https://transfer.sh/hello.txt | grep -i -E 'transfer\.sh|x-url-delete'
x-url-delete: https://transfer.sh/hello.txt/BAYh0/hello.txt/PDw0NHPcqU
https://transfer.sh/hello.txt/BAYh0/hello.txt



示例

请参见 examples.md 上的使用示例


链接别名

创建直接下载链接:

https://transfer.sh/1lDau/test.txt --> https://transfer.sh/get/1lDau/test.txt

内联文件:

https://transfer.sh/1lDau/test.txt --> https://transfer.sh/inline/1lDau/test.txt




用法

如果您想使用Let's Encrypt证书启用TLS,请将lets-encrypt-hosts设置到您的域名,将tls-listener设置为:443,并启用force-https。

如果您想使用自己的证书启用TLS,请设置tls-listener为:443、force-https、tls-cert-file和tls-private-key。




开发

Switched to GO111MODULE```bash go run main.go --provider=local --listener :8080 --temp-path=/tmp/ --basedir=/tmp/

root@kitploit:~
<br />

---

<br />

## 构建```bash
$ git clone [email protected]:dutchcoders/transfer.sh.git
$ cd transfer.sh
$ go build -o transfersh main.go



Docker

为了便于部署,我们创建了一个官方的Docker容器。有两个变体,区别仅在于运行进程的用户。

默认容器将以root身份运行:

[!WARNING] 不鼓励对WatchTower或类似工具使用latest标签。latest标签可能引用未发布的开发版、测试版以及旧版本的补丁发布。在transfer.sh支持主版本或次版本标签之前,请使用实际的版本标签。```bash docker run --publish 8080:8080 dutchcoders/transfer.sh:latest --provider local --basedir /tmp/

root@kitploit:~
<br />

### 无根权限

带有 `-noroot` 标签的镜像表示以最小权限运行,以降低应用程序被攻破时的攻击面。

> [!NOTE]
> 使用 `-noroot` 是**推荐的做法**

<br />

后缀为 `-noroot` 的镜像将使用 `5000` 作为 UID 和 GID:```bash
docker run --publish 8080:8080 dutchcoders/transfer.sh:latest-noroot --provider local --basedir /tmp/

[!NOTE] 开发历史详情见:

  • https://github.com/dutchcoders/transfer.sh/pull/418

标签


构建容器

你也可以自行构建容器。这样可以选择使用的 UID/GID,例如使用 NFS 挂载时:```bash

Build arguments:

* RUNAS: If empty, the container will run as root.

Set this to anything to enable UID/GID selection.

* PUID: UID of the process. Needs RUNAS != "". Defaults to 5000.

* PGID: GID of the process. Needs RUNAS != "". Defaults to 5000.

docker build -t transfer.sh-noroot --build-arg RUNAS=doesntmatter --build-arg PUID=1337 --build-arg PGID=1338 .

root@kitploit:~
<br />

---

<br />

## S3 使用

对于使用 AWS S3 存储桶,只需指定以下选项:
- provider `--provider s3`
- aws-access-key _(可通过标志或环境变量 `AWS_ACCESS_KEY` 指定)_
- aws-secret-key _(可通过标志或环境变量 `AWS_SECRET_KEY` 指定)_
- bucket _(可通过标志或环境变量 `BUCKET` 指定)_
- s3-region _(可通过标志或环境变量 `S3_REGION` 指定)_

如果指定了 s3-region,则无需设置端点 URL,因为正确的端点将自动使用。

<br />

### 自定义 S3 供应商

要使用自定义的非 AWS S3 供应商,需要按照云供应商的定义指定端点。

<br />

---

<br />

## Storj 网络供应商

要将 Storj 网络用作存储供应商,需要指定以下标志:
- provider `--provider storj`
- storj-access _(可通过标志或环境变量 `STORJ_ACCESS` 指定)_
- storj-bucket _(可通过标志或环境变量 `STORJ_BUCKET` 指定)_

<br />

### 创建存储桶和作用域

你需要事先创建一个访问授权(或从 uplink 配置中复制)和一个存储桶。

首先,登录账户,进入访问授权菜单,点击右上角的向导。

输入你选择的访问授权名称,点击*下一步*并根据需要进行限制。
之后,继续在 CLI 或浏览器中操作。接下来,系统会要求输入用作加密密钥的密码短语。
**务必将其保存在安全的地方。没有它,你将无法解密你的文件!**

之后,你可以复制访问授权,然后启动 transfer.sh 端点。
建议将访问授权和存储桶名称都作为环境变量提供,以增强安全性。

示例:```
export STORJ_BUCKET=<BUCKET NAME>
export STORJ_ACCESS=<ACCESS GRANT>
transfer.sh --provider storj



Google 云端硬盘使用

使用 Google 云端硬盘时,需要指定以下选项:

  • provider
  • gdrive-client-json-filepath
  • gdrive-local-config-path
  • basedir

创建 Gdrive 客户端 Json

您需要从 console.cloud.google.com 创建一个 OAuth 客户端 ID,下载该文件,并将其放置在一个安全的目录中。


使用示例go run main.go --provider gdrive --basedir /tmp/ --gdrive-client-json-filepath /[credential_dir] --gdrive-local-config-path [directory_to_save_config]




Shell functions

Bash, ash and zsh (multiple files uploaded as zip archive)

Add this to .bashrc or .zshrc or its equivalent
root@kitploit:~
transfer() (if [ $# -eq 0 ]; then printf "未指定参数。\n用法:\n transfer <文件|目录>\n ... | transfer <文件名>\n">&2; return 1; fi; file_name=$(basename "$1"); if [ -t 0 ]; then file="$1"; if [ ! -e "$file" ]; then echo "$file: 没有那个文件或目录">&2; return 1; fi; if [ -d "$file" ]; then cd "$file" || return 1; file_name="$file_name.zip"; set -- zip -r -q - .; else set -- cat "$file"; fi; else set -- cat; fi; url=$("$@" | curl --silent --show-error --progress-bar --upload-file "-" "https://transfer.sh/$file_name"); echo "$url"; )```

<br />

#### Now you can use transfer function

$ transfer hello.txt```


Bash and zsh (with delete url, delete token output and prompt before uploading)

Add this to .bashrc or .zshrc or its equivalent
Expand

root@kitploit:~
transfer()
{
    local file
    declare -a file_array
    file_array=("${@}")

    if [[ "${file_array[@]}" == "" || "${1}" == "--help" || "${1}" == "-h" ]]
    then
        echo "${0} - 将任意文件上传至 \"transfer.sh\"。"
        echo ""
        echo "用法: ${0} [选项] [<文件>]..."
        echo ""
        echo "选项:"
        echo "  -h, --help"
        echo "      显示本帮助信息"
        echo ""
        echo "示例:"
        echo "  从当前工作目录上传单个文件:"
        echo "      ${0} \"image.img\""
        echo ""
        echo "  从当前工作目录上传多个文件:"
        echo "      ${0} \"image.img\" \"image2.img\""
        echo ""
        echo "  从不同目录上传文件:"
        echo "      ${0} \"/tmp/some_file\""
        echo ""
        echo "  上传当前工作目录的所有文件。请注意 Web 服务器的速率限制!:"
        echo "      ${0} *"
        echo ""
        echo "  上传单个文件并过滤出删除令牌和下载链接:"
        echo "      ${0} \"image.img\" | awk --field-separator=\": \" '/Delete token:/ { print \$2 } /Download link:/ { print \$2 }'"
        echo ""
        echo "  查看 \"transfer.sh\" 的帮助文本:"
        echo "      curl --request GET \"https://transfer.sh\""
        return 0
    else
        for file in "${file_array[@]}"
        do
            if [[ ! -f "${file}" ]]
            then
                echo -e "\e[01;31m'${file}' 未找到或不是一个文件。\e[0m" >&2
                return 1
            fi
        done
        unset file
    fi

    local upload_files
    local curl_output
    local awk_output

    du -c -k -L "${file_array[@]}" >&2
    # 兼容 "bash"
    if [[ "${ZSH_NAME}" == "zsh" ]]
    then
        read $'upload_files?\e[01;31m你真的想将上述文件('"${#file_array[@]}"$'个)上传到 "transfer.sh" 吗?(Y/n): \e[0m'
    elif [[ "${BASH}" == *"bash"* ]]
    then
        read -p $'\e[01;31m你真的想将上述文件('"${#file_array[@]}"$'个)上传到 "transfer.sh" 吗?(Y/n): \e[0m' upload_files
    fi

    case "${upload_files:-y}" in
        "y"|"Y")
            # 为了显示进度条,对每个文件分别执行 "curl"。
            # 参数 "--include" 和 "--form" 会隐藏进度条。
            for file in "${file_array[@]}"
            do
                # 上传后显示删除链接并从响应头中过滤出删除令牌。
                # 重要的是将 "curl" 的 "stdout" 通过子 shell 保存到变量或重定向到另一个命令,
                # 然后将结果重定向到 "stdout",以获得清晰的输出。
                # 进度条被重定向到 "stderr",仅当 "stdout" 被重定向时才会显示;例如 ">/dev/null"、"tee /dev/null" 或 "| <某些命令>"。
                # 响应头被重定向到 "stdout",因此将 "stdout" 重定向到 "/dev/null" 没有意义。
                # 将 "curl" 的 "stderr" 重定向到 "stdout"("2>&1")会隐藏进度条。
                curl_output=$(curl --request PUT --progress-bar --dump-header - --upload-file "${file}" "https://transfer.sh/")
                awk_output=$(awk \
                    'gsub("\r", "", $0) && tolower($1) ~ /x-url-delete/ \
                    {
                        delete_link=$2;
                        print "删除命令: curl --request DELETE " "\""delete_link"\"";

                        gsub(".*/", "", delete_link);
                        delete_token=delete_link;
                        print "删除令牌: " delete_token;
                    }

                    END{
                        print "下载链接: " $0;
                    }' <<< "${curl_output}")

                # 通过 "stdout" 返回结果,"awk" 某种原因不会做这个。
                echo -e "${awk_output}\n"

                # 尽可能避免速率限制;nginx: 请求过多。
                if (( ${#file_array[@]} > 4 ))
                then
                    sleep 5
                fi
            done
            ;;

        "n"|"N")
            return 1
            ;;

        *)
            echo -e "\e[01;31m错误的输入: '${upload_files}'。\e[0m" >&2
            return 1
    esac
}```

</p></details>

#### Sample output
```bash
$ ls -lh
总用量 20M
-rw-r--r-- 1 <some_username> <some_username> 10M 4月  4 21:08 image.img
-rw-r--r-- 1 <some_username> <some_username> 10M 4月  4 21:08 image2.img
$ transfer image*
10240K  image2.img
10240K  image.img
20480K  总计
是否确定要将以上文件(2个)上传到 "transfer.sh"?(Y/n):
######################################################################################################################################################################################################################################## 100.0%
删除命令: curl --request DELETE "https://transfer.sh/wJw9pz/image2.img/mSctGx7pYCId"
删除令牌: mSctGx7pYCId
下载链接: https://transfer.sh/wJw9pz/image2.img

######################################################################################################################################################################################################################################## 100.0%
删除命令: curl --request DELETE "https://transfer.sh/ljJc5I/image.img/nw7qaoiKUwCU"
删除令牌: nw7qaoiKUwCU
下载链接: https://transfer.sh/ljJc5I/image.img

$ transfer "image.img" | awk --field-separator=": " '/Delete token:/ { print $2 } /Download link:/ { print $2 }'
10240K  image.img
10240K  总计
是否确定要将以上文件(1个)上传到 "transfer.sh"?(Y/n):
######################################################################################################################################################################################################################################## 100.0%
tauN5dE3fWJe
https://transfer.sh/MYkuqn/image.img```

<br />

---

<br />

## Contributions

Contributions are welcome.

<br />

---

<br />

## Creators

**Remco Verhoef**
- <https://twitter.com/remco_verhoef>
- <https://twitter.com/dutchcoders>

**Uvis Grinfelds**

<br />

---

<br />

## Maintainers

- **Andrea Spacca**
- **Stefan Benten**

<br />

---

<br />

## Copyright and License

Code and documentation copyright 2011-2018 Remco Verhoef.
Code and documentation copyright 2018-2020 Andrea Spacca.
Code and documentation copyright 2020- Andrea Spacca and Stefan Benten.

Code released under [the MIT license](https://github.com/dutchcoders/transfer.sh/blob/HEAD/LICENSE).
下载工具
参数描述值环境变量
listener用于HTTP的端口(:80)LISTENER
profile-listener用于分析器的端口(:6060)PROFILE_LISTENER
force-https重定向到HTTPSfalseFORCE_HTTPS
tls-listener用于HTTPS的端口(:443)TLS_LISTENER
tls-listener-only仅启用TLS监听器的标志TLS_LISTENER_ONLY
tls-cert-fileTLS证书路径TLS_CERT_FILE
tls-private-keyTLS私钥路径TLS_PRIVATE_KEY
http-auth-user上传时基本HTTP认证的用户HTTP_AUTH_USER
http-auth-pass上传时基本HTTP认证的密码HTTP_AUTH_PASS
http-auth-htpasswd用于上传时基本HTTP认证的htpasswd文件路径HTTP_AUTH_HTPASSWD
http-auth-ip-whitelist无需认证即可上传的允许IP列表(逗号分隔)HTTP_AUTH_IP_WHITELIST
virustotal-keyVirusTotal API密钥VIRUSTOTAL_KEY
ip-whitelist允许连接到服务的IP列表(逗号分隔)IP_WHITELIST
ip-blacklist不允许连接到服务的IP列表(逗号分隔)IP_BLACKLIST
temp-path临时文件夹路径系统临时目录TEMP_PATH
web-path静态网页文件路径(用于开发或自定义前端)WEB_PATH
proxy-path服务在代理后运行时路径前缀(/前缀将被修剪)PROXY_PATH
proxy-port服务在代理后运行时代理端口PROXY_PORT
email-contact前端的电子邮件联系人EMAIL_CONTACT
ga-key前端的Google Analytics密钥GA_KEY
provider要使用的存储提供商(s3、storj、gdrive 或 local)
uservoice-key前端的UserVoice密钥USERVOICE_KEY
aws-access-keyAWS访问密钥AWS_ACCESS_KEY
aws-secret-keyAWS访问密钥AWS_SECRET_KEY
bucketAWS存储桶BUCKET
s3-endpoint自定义S3端点。S3_ENDPOINT
s3-regionS3存储桶的区域eu-west-1S3_REGION
s3-no-multipart禁用S3分段上传falseS3_NO_MULTIPART
s3-path-style强制路径样式URL,Minio需要。falseS3_PATH_STYLE
storj-access项目的访问权限STORJ_ACCESS
storj-bucket项目内使用的存储桶STORJ_BUCKET
basedir本地/Google Drive提供商路径存储BASEDIR
gdrive-client-json-filepath用于Google Drive提供商的OAuth客户端JSON配置路径GDRIVE_CLIENT_JSON_FILEPATH
gdrive-local-config-path存储Google Drive提供商的本地transfer.sh配置缓存路径GDRIVE_LOCAL_CONFIG_PATH
gdrive-chunk-sizeGoogle Drive上传的块大小(MB),必须低于可用内存(8 MB)GDRIVE_CHUNK_SIZE
lets-encrypt-hosts用于Let's Encrypt证书的主机(逗号分隔)HOSTS
log日志文件路径LOG
cors-domainsCORS的域列表(逗号分隔),设置后启用CORSCORS_DOMAINS
clamav-hostClamAV功能的主机CLAMAV_HOST
perform-clamav-prescan每次上传前使用ClamAV进行预扫描(clamav-host必须是本地clamd Unix套接字)PERFORM_CLAMAV_PRESCAN
rate-limit每分钟请求数RATE_LIMIT
max-upload-size最大上传大小(千字节)MAX_UPLOAD_SIZE
purge-days上传后自动清除的天数PURGE_DAYS
purge-interval执行自动清除的时间间隔(小时)(不包括S3和Storj)PURGE_INTERVAL
random-token-length上传路径的随机令牌长度(删除路径长度加倍)6RANDOM_TOKEN_LENGTH
名称用法
latest最新的 CI 构建,可能为夜间构建、提交时构建、标签构建等。
latest-noroot最新的 CI 构建(使用 [no root]),可能为夜间构建、提交时构建、标签构建等。
nightly计划每 UTC 午夜执行的 CI 构建
nightly-noroot计划每 UTC 午夜执行的 CI 构建(使用 [no root])
edge每次在 main 分支提交后立即执行的 CI 构建
edge-noroot每次在 main 分支提交后立即执行的 CI 构建(使用 [no root])
vx.y.z标签发布后的 CI 构建
vx.y.z-noroot标签发布后的 CI 构建(使用 [no root])