
명령 줄에서 쉽고 빠른 파일 공유. 이 코드에는 고유 한 인스턴스를 작성하는 데 필요한 모든 것이 포함되어 있습니다.
Transfer.sh는 현재 S3 (Amazon S3), GDRIVE (Google Drive), Storj (Storj) 제공 업체 및 로컬 파일 시스템 (로컬)을 지원합니다.
@stefanbenten 은이 저장소의 관리자 이자 레포지어에서 소프트웨어의 잘 알려진 공개 설치를 주최하는 사람입니다.
두 사람은 어쨌든 관련이 없으며 REPO는 PubBlic 설치에 대한 요청 및 문제를 지시하는 장소가 아닙니다.
보안상의 이유로 레포 자체에 소프트웨어의 제 3 자 공개 설치는 리포지토리 자체에 광고되거나 언급되지 않습니다.
저의 공식 위치 인 @aspacca는 Repo의 관리자 인 소프트웨어를 사용하려면 자신의 설치를 호스팅해야한다는 것입니다.
$ curl -v --upload-file ./hello.txt https://transfer.sh/hello.txt$ gpg --armor --symmetric --output - /tmp/hello.txt | curl --upload-file - https://transfer.sh/test.txt$ curl https://transfer.sh/1lDau/test.txt | gpg --decrypt --output /tmp/hello.txt$ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/virustotal$ curl -X DELETE < X-Url-Delete Response Header URL > $ curl --upload-file ./hello.txt https://transfer.sh/hello.txt -H " Max-Downloads: 1 " # Limit the number of downloads$ curl --upload-file ./hello.txt https://transfer.sh/hello.txt -H " Max-Days: 1 " # Set the number of days before deletion$ curl --upload-file ./hello.txt https://your-transfersh-instance.tld/hello.txt -H " X-Encrypt-Password: test " # Encrypt the content sever side with AES265 using "test" as password$ curl https://your-transfersh-instance.tld/BAYh0/hello.txt -H " X-Decrypt-Password: test " # Decrypt the content sever side with AES265 using "test" as password URL은 파일 삭제를 요청하고 응답 헤더로 반환했습니다.
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.txtexamples.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
| 매개 변수 | 설명 | 값 | env |
|---|---|---|---|
| 경청자 | HTTP에 사용할 포트 (: 80) | 경청자 | |
| 프로파일 리스너 | 프로파일 러에 사용할 포트 (: 6060) | profile_listener | |
| Force-HTTPS | HTTPS로 리디렉션합니다 | 거짓 | Force_https |
| TLS-Listener | https에 사용할 포트 (: 443) | tls_listener | |
| TLS-Listener 전용 | TLS 리스너 만 활성화하는 플래그 | tls_listener_only | |
| TLS-Cert-File | TLS 인증서로가는 경로 | tls_cert_file | |
| TLS- 프라이버시 키 | TLS 개인 키로가는 길 | 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 | HTTP 인증에 도전하지 않고 업로드 할 수있는 IPS 분리 목록 | http_auth_ip_whitelist | |
| IP- 흰색리스트 | 서비스에 연결할 수있는 쉼표 분리 된 IP 목록 | IP_WHITELIST | |
| IP- 블랙리스트 | 서비스에 연결할 수없는 쉼표 분리 된 IP 목록 | IP_BLACKLIST | |
| 템플릿 | 임시 폴더로가는 길 | 시스템 온도 | temp_path |
| 웹 경로 | 정적 웹 파일로가는 경로 (개발 또는 사용자 정의 프론트 엔드) | web_path | |
| 프록시 경로 | 경로 접두사 서비스가 프록시 뒤에서 실행될 때 | proxy_path | |
| 프록시 포트 | 서비스가 프록시 뒤에서 실행될 때 프록시 포트 | proxy_port | |
| 이메일 접촉 | 프론트 엔드에 대한 이메일 연락처 | email_contact | |
| GA-KEY | 프론트 엔드에 대한 Google 웹 로그 분석 키 | ga_key | |
| 공급자 | 사용할 스토리지 제공 업체 | (S3, Storj, Gdrive 또는 Local) | |
| uservoice-key | 프론트 엔드의 사용자 음성 키 | uservoice_key | |
| AWS-Access-Key | AWS 액세스 키 | aws_access_key | |
| AWS-SECRET-KEY | AWS 액세스 키 | aws_secret_key | |
| 버킷 | AWS 버킷 | 버킷 | |
| S3- 엔드 포인트 | 사용자 정의 S3 엔드 포인트. | s3_endpoint | |
| S3- 지역 | S3 버킷의 영역 | EU-West-1 | S3_REGION |
| S3-No-Multipart | S3 Multipart 업로드를 비활성화합니다 | 거짓 | S3_NO_MULTIPART |
| S3-Path 스타일 | Minio에 필요한 경로 스타일 URL. | 거짓 | s3_path_style |
| Storj-Access | 프로젝트에 대한 액세스 | storj_access | |
| Storj-Bucket | 프로젝트 내에서 사용할 버킷 | Storj_bucket | |
| 기반 | 로컬/gdrive 공급자를위한 경로 저장 | 기반 | |
| gdrive-client-json-filepath | GDRIVE 제공 업체를위한 OAUTH 클라이언트 JSON 구성 경로 | gdrive_client_json_filepath | |
| gdrive-local-config-path | 로컬 전송 저장 경로 GDRIVE 제공 업체 용 Sh 구성 캐시 | gdrive_local_config_path | |
| gdrive-chunk 크기 | 메가 바이트로 GDRIVE 업로드의 청크 크기는 사용 가능한 메모리보다 낮아야합니다 (8MB) | gdrive_chunk_size | |
| 암호화 호스트를하자 | Lets 암호화 인증서에 사용할 호스트 (Comma Seperated) | 호스트 | |
| 통나무 | 로그 파일로가는 길 | 통나무 | |
| Cors-Domains | CORS를위한 쉼표로 분리 된 도메인 목록, 설정 활성화 CORS | cors_domains | |
| Clamav-Host | Clamav 기능 호스트 | clamav_host | |
| Clamav-Prescan을 수행하십시오 | Prescan Clamav 기능을 통한 모든 업로드 | perform_clamav_prescan | |
| 속도 제한 | 분당 요청 | rate_limit | |
| MAX-UPLOAD 크기 | 킬로바이트의 최대 업로드 크기 | max_upload_size | |
| 퍼지 날 | 업로드 후 일수가 자동으로 정제됩니다 | purge_days | |
| 퍼지 간판 | 자동 퍼지를 실행하기위한 몇 시간 간격 (S3 및 Storj에 적용되지 않음) | purge_interval | |
| 무작위로 만든 길이 | 업로드 경로의 임의 토큰 길이 (삭제 경로의 두 배) | 6 | random_token_length |
lets 암호화 인증서를 사용하여 TLS를 사용하려면 LET- 암호 호스트를 도메인으로 설정하고 TLS-Listener를 443으로 설정하고 Force-HTTPS를 활성화하십시오.
자체 인증서를 사용하여 TLS를 사용하려면 TLS-Listener를 443, Force-HTTPS, TLS-Cert-File 및 TLS-Private-Key로 설정하십시오.
go111module로 전환했습니다
go run main.go --provider=local --listener :8080 --temp-path=/tmp/ --basedir=/tmp/$ git clone [email protected]:dutchcoders/transfer.sh.git
$ cd transfer.sh
$ go build -o transfersh main.go쉽게 배포하기 위해 공식 Docker 컨테이너를 만들었습니다. 사용자가 프로세스를 실행하는 경우에만 다른 두 가지 변형이 있습니다.
기본값은 root 로 실행됩니다.
docker run --publish 8080:8080 dutchcoders/transfer.sh:latest --provider local --basedir /tmp/ 접미어 -noroot 로 표시된 하나는 5000 UID 및 GID로 사용합니다.
docker run --publish 8080:8080 dutchcoders/transfer.sh:latest-noroot --provider local --basedir /tmp/컨테이너를 직접 만들 수도 있습니다. 이를 통해 NFS 마운트를 사용할 때 어떤 UID/GID를 사용할 것인지 선택할 수 있습니다.
# 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 . AWS S3 버킷을 사용하는 사용을 위해서는 다음 옵션 만 지정하면됩니다.
--provider s3AWS_ACCESS_KEY )AWS_SECRET_KEY 통해)BUCKET 통해)S3_REGION )S3-Region을 지정하면 올바른 엔드 포인트가 자동으로 사용되므로 엔드 포인트 URL을 설정할 필요가 없습니다.
Custom Non-AWS S3 공급자를 사용하려면 클라우드 제공 업체에서 정의 된 엔드 포인트를 지정해야합니다.
Storj Network를 스토리지 제공 업체로 사용하려면 다음 플래그를 지정해야합니다.
--provider storj액세스 보조금을 만들거나 업 링크 구성에서 복사해야합니다.
시작하려면 계정에 로그인하여 액세스 보조금 메뉴로 이동하여 오른쪽 상단에서 마법사를 시작하십시오.
액세스 보조금 이름을 입력하고 다음에 누르고 필요한/선호하는 것으로 제한하십시오. 그 후 CLI 또는 브라우저 내에서 계속됩니다. 다음으로 암호화 키로 사용되는 암호를 요청받을 수 있습니다. 안전한 장소에 저장하십시오. 그것 없이는 파일을 해독하는 능력을 잃게됩니다!
그 후 액세스 보조금을 복사 한 다음 Transfer.sh Endpoint의 시작을 시작할 수 있습니다. 향상된 보안을위한 ENV 변수로서 액세스 보조금과 버킷 이름을 모두 제공하는 것이 좋습니다.
예:
export STORJ_BUCKET=<BUCKET NAME>
export STORJ_ACCESS=<ACCESS GRANT>
transfer.sh --provider storj
Google 드라이브를 사용하려면 다음 옵션을 지정해야합니다.
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]
transfer () (if [ $# -eq 0 ] ; then printf " No arguments specified.nUsage:n transfer <file|directory>n ... | transfer <file_name>n " >&2 ; return 1 ; fi ; file_name= $( basename " $1 " ) ; if [ -t 0 ] ; then file= " $1 " ; if [ ! -e " $file " ] ; then echo " $file : No such file or directory " >&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 " ; ) $ transfer hello.txt
transfer ()
{
local file
declare -a file_array
file_array=( " ${ @ } " )
if [[ " ${file_array[@]} " == " " || " ${1} " == " --help " || " ${1} " == " -h " ]]
then
echo " ${0} - Upload arbitrary files to " transfer.sh " . "
echo " "
echo " Usage: ${0} [options] [<file>]... "
echo " "
echo " OPTIONS: "
echo " -h, --help "
echo " show this message "
echo " "
echo " EXAMPLES: "
echo " Upload a single file from the current working directory: "
echo " ${0} " image.img " "
echo " "
echo " Upload multiple files from the current working directory: "
echo " ${0} " image.img " " image2.img " "
echo " "
echo " Upload a file from a different directory: "
echo " ${0} " /tmp/some_file " "
echo " "
echo " Upload all files from the current working directory. Be aware of the webserver's rate limiting!: "
echo " ${0} * "
echo " "
echo " Upload a single file from the current working directory and filter out the delete token and download link: "
echo " ${0} " image.img " | awk --field-separator= " : " '/Delete token:/ { print $ 2 } /Download link:/ { print $ 2 }' "
echo " "
echo " Show help text from " 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} ' could not be found or is not a 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
# be compatible with "bash"
if [[ " ${ZSH_NAME} " == " zsh " ]]
then
read $' upload_files? e [01;31mDo you really want to upload the above files ( ' " ${ # file_array[@]} " $' ) to "transfer.sh"? (Y/n): e [0m '
elif [[ " ${BASH} " == * " bash " * ]]
then
read -p $' e [01;31mDo you really want to upload the above files ( ' " ${ # file_array[@]} " $' ) to "transfer.sh"? (Y/n): e [0m ' upload_files
fi
case " ${upload_files :- y} " in
" y " | " Y " )
# for the sake of the progress bar, execute "curl" for each file.
# the parameters "--include" and "--form" will suppress the progress bar.
for file in " ${file_array[@]} "
do
# show delete link and filter out the delete token from the response header after upload.
# it is important to save "curl's" "stdout" via a subshell to a variable or redirect it to another command,
# which just redirects to "stdout" in order to have a sane output afterwards.
# the progress bar is redirected to "stderr" and is only displayed,
# if "stdout" is redirected to something; e.g. ">/dev/null", "tee /dev/null" or "| <some_command>".
# the response header is redirected to "stdout", so redirecting "stdout" to "/dev/null" does not make any sense.
# redirecting "curl's" "stderr" to "stdout" ("2>&1") will suppress the progress bar.
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 "Delete command: curl --request DELETE " """delete_link""";
gsub(".*/", "", delete_link);
delete_token=delete_link;
print "Delete token: " delete_token;
}
END{
print "Download link: " $0;
} ' <<< " ${curl_output} " )
# return the results via "stdout", "awk" does not do this for some reason.
echo -e " ${awk_output} n "
# avoid rate limiting as much as possible; nginx: too many requests.
if (( ${ # file_array[@]} > 4 ))
then
sleep 5
fi
done
;;
" n " | " N " )
return 1
;;
* )
echo -e " e[01;31mWrong input: ' ${upload_files} '.e[0m " >&2
return 1
esac
}$ ls -lh
total 20M
-rw-r--r-- 1 < some_username > < some_username > 10M Apr 4 21:08 image.img
-rw-r--r-- 1 < some_username > < some_username > 10M Apr 4 21:08 image2.img
$ transfer image *
10240K image2.img
10240K image.img
20480K total
Do you really want to upload the above files (2) to " transfer.sh " ? (Y/n):
# ####################################################################################################################################################################################################################################### 100.0%
Delete command: curl --request DELETE " https://transfer.sh/wJw9pz/image2.img/mSctGx7pYCId "
Delete token: mSctGx7pYCId
Download link: https://transfer.sh/wJw9pz/image2.img
# ####################################################################################################################################################################################################################################### 100.0%
Delete command: curl --request DELETE " https://transfer.sh/ljJc5I/image.img/nw7qaoiKUwCU "
Delete token: nw7qaoiKUwCU
Download link: https://transfer.sh/ljJc5I/image.img
$ transfer " image.img " | awk --field-separator= " : " ' /Delete token:/ { print $2 } /Download link:/ { print $2 } '
10240K image.img
10240K total
Do you really want to upload the above files (1) to " transfer.sh " ? (Y/n):
# ####################################################################################################################################################################################################################################### 100.0%
tauN5dE3fWJe
https://transfer.sh/MYkuqn/image.img기부금을 환영합니다.
Remco Verhoef
Uvis Grinfelds
안드레아 스파카
스테판 벤텐
코드 및 문서 Copyright 2011-2018 REMCO Verhoef. 코드 및 문서 저작권 2018-2020 Andrea Spacca. 코드 및 문서 Copyright 2020- Andrea Spacca 및 Stefan Benten.
MIT 라이센스에 따라 릴리스 된 코드.