From f60b0ef80cf6897e20e02130fb4dc58ad75e80e0 Mon Sep 17 00:00:00 2001 From: Remco Date: Sun, 16 Nov 2014 12:11:20 +0100 Subject: [PATCH] added keybase sample, updated transfer alias --- transfersh-server/static/index.html | 45 ++++++++++++++++++++++++----- transfersh-server/static/index.txt | 33 +++++++++++++++++---- transfersh-web/index.html | 45 ++++++++++++++++++++++++----- transfersh-web/index.txt | 33 +++++++++++++++++---- 4 files changed, 132 insertions(+), 24 deletions(-) diff --git a/transfersh-server/static/index.html b/transfersh-server/static/index.html index 9e9d5f4..0f49e4d 100644 --- a/transfersh-server/static/index.html +++ b/transfersh-server/static/index.html @@ -70,7 +70,7 @@
$ curl --upload-file ./hello.txt https://transfer.sh/hello.txt https://transfer.sh/66nb8/hello.txt

- # Create an alias + # Using the alias
$ transfer hello.txt
##################################################### 100.0% https://transfer.sh/eibhM/hello.txt @@ -165,19 +165,33 @@
-

Create an alias and add it to .bashrc or .zshrc

+

Create an alias and add it to .bashrc or .zshrc [gist]

# Add this to .bashrc or its equivalent
transfer() { -
# write to output to tmpfile because of progress bar -
tmpfile=$( mktemp -t transferXXX ); basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g') -
curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile -
cat $tmpfile; rm -f $tmpfile; +
if [ $# -eq 0 ]; then +
echo "No arguments specified. Usage:" +
echo "$ transfer /tmp/test.md" +
echo "$ cat /tmp/test.md | transfer test.md" +
return 1 +
fi +
+
# write to output to tmpfile because of progress bar +
tmpfile=$( mktemp -t transferXXX ); +
+
if tty -s; then +
basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); +
curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; +
else +
curl --progress-bar --upload-file "-" "https://transfer.sh/$1" +
fi +
+
cat $tmpfile; rm -f $tmpfile;
} -
+

alias transfer=transfer

@@ -268,6 +282,23 @@
+
+

Using Keybase.io

+
+
+
+ + # Import keys from keybase +
$ keybase track [them] + # Encrypt for recipient(s) +
$ cat somebackupfile.tar.gz | keybase encrypt [them] | curl --upload-file '-' https://transfer.sh/test.txt + # Decrypt +
$ curl https://transfer.sh/sqUFi/test.md |keybase decrypt +
+
+
+ +

Send us your awesome example

diff --git a/transfersh-server/static/index.txt b/transfersh-server/static/index.txt index c8a16b7..f3726f7 100644 --- a/transfersh-server/static/index.txt +++ b/transfersh-server/static/index.txt @@ -11,7 +11,17 @@ $ cat /tmp/hello.txt|gpg -ac -o-|curl -X PUT --upload-file "-" https://transfer. Download & decrypt: $ curl https://transfer.sh/1lDau/test.txt|gpg -o- > /tmp/hello.txt -Upload to virustotal: +Using Keybase: +# import keys from keybase +$ keybase track [them] + +# encrypt for recipients +$ cat somebackupfile.tar.gz | keybase encrypt [them] | curl --upload-file '-' https://transfer.sh/test.txt + +# decrypt +$ curl https://transfer.sh/sqUFi/test.md |keybase decrypt + +Upload to Virustotal: $ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/virustotal Virusscan: @@ -20,13 +30,26 @@ $ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/scan Add alias to .bashrc or .zshrc: === transfer() { + if [ $# -eq 0 ]; then + echo "No arguments specified. Usage:" + echo "$ transfer /tmp/test.md" + echo "$ cat /tmp/test.md | transfer test.md" + return 1 + fi + # write to output to tmpfile because of progress bar - tmpfile=$( mktemp -t transferXXX ); - basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); - curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; + tmpfile=$( mktemp -t transferXXX ); + + if tty -s; then + basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); + curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; + else + curl --progress-bar --upload-file "-" "https://transfer.sh/$1" + fi + cat $tmpfile; rm -f $tmpfile; } - + alias transfer=transfer === $ transfer test.txt diff --git a/transfersh-web/index.html b/transfersh-web/index.html index 3e20909..4327881 100644 --- a/transfersh-web/index.html +++ b/transfersh-web/index.html @@ -44,7 +44,7 @@ include "includes/head.html"
$ curl --upload-file ./hello.txt https://transfer.sh/hello.txt https://transfer.sh/66nb8/hello.txt

- # Create an alias + # Using the alias
$ transfer hello.txt
##################################################### 100.0% https://transfer.sh/eibhM/hello.txt @@ -139,19 +139,33 @@ include "includes/head.html"
-

Create an alias and add it to .bashrc or .zshrc

+

Create an alias and add it to .bashrc or .zshrc [gist]

# Add this to .bashrc or its equivalent
transfer() { -
# write to output to tmpfile because of progress bar -
tmpfile=$( mktemp -t transferXXX ); basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g') -
curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile -
cat $tmpfile; rm -f $tmpfile; +
if [ $# -eq 0 ]; then +
echo "No arguments specified. Usage:" +
echo "$ transfer /tmp/test.md" +
echo "$ cat /tmp/test.md | transfer test.md" +
return 1 +
fi +
+
# write to output to tmpfile because of progress bar +
tmpfile=$( mktemp -t transferXXX ); +
+
if tty -s; then +
basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); +
curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; +
else +
curl --progress-bar --upload-file "-" "https://transfer.sh/$1" +
fi +
+
cat $tmpfile; rm -f $tmpfile;
} -
+

alias transfer=transfer

@@ -242,6 +256,23 @@ include "includes/head.html"
+
+

Using Keybase.io

+
+
+
+ + # Import keys from keybase +
$ keybase track [them] + # Encrypt for recipient(s) +
$ cat somebackupfile.tar.gz | keybase encrypt [them] | curl --upload-file '-' https://transfer.sh/test.txt + # Decrypt +
$ curl https://transfer.sh/sqUFi/test.md |keybase decrypt +
+
+
+
+

Send us your awesome example

diff --git a/transfersh-web/index.txt b/transfersh-web/index.txt index c8a16b7..f3726f7 100644 --- a/transfersh-web/index.txt +++ b/transfersh-web/index.txt @@ -11,7 +11,17 @@ $ cat /tmp/hello.txt|gpg -ac -o-|curl -X PUT --upload-file "-" https://transfer. Download & decrypt: $ curl https://transfer.sh/1lDau/test.txt|gpg -o- > /tmp/hello.txt -Upload to virustotal: +Using Keybase: +# import keys from keybase +$ keybase track [them] + +# encrypt for recipients +$ cat somebackupfile.tar.gz | keybase encrypt [them] | curl --upload-file '-' https://transfer.sh/test.txt + +# decrypt +$ curl https://transfer.sh/sqUFi/test.md |keybase decrypt + +Upload to Virustotal: $ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/virustotal Virusscan: @@ -20,13 +30,26 @@ $ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/scan Add alias to .bashrc or .zshrc: === transfer() { + if [ $# -eq 0 ]; then + echo "No arguments specified. Usage:" + echo "$ transfer /tmp/test.md" + echo "$ cat /tmp/test.md | transfer test.md" + return 1 + fi + # write to output to tmpfile because of progress bar - tmpfile=$( mktemp -t transferXXX ); - basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); - curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; + tmpfile=$( mktemp -t transferXXX ); + + if tty -s; then + basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); + curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; + else + curl --progress-bar --upload-file "-" "https://transfer.sh/$1" + fi + cat $tmpfile; rm -f $tmpfile; } - + alias transfer=transfer === $ transfer test.txt