"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
cmd/obscure: Allow obscure command to accept password on STDIN
David Ibarra49cf2eb7e40c
diff --git a/cmd/obscure/obscure.go b/cmd/obscure/obscure.goindex 38f70c14a..84ae266b8 100644--- a/cmd/obscure/obscure.go+++ b/cmd/obscure/obscure.go@@ -3,6 +3,9 @@ package obscureimport ("fmt"+ "io/ioutil"+ "os"+"github.com/rclone/rclone/cmd""github.com/rclone/rclone/fs/config/obscure""github.com/spf13/cobra"@@ -26,13 +29,29 @@ Many equally important things (like access tokens) are not obscured inthe config file. However it is very hard to shoulder surf a 64character hex token.+This command can also accept a password through STDIN instead of an+argument by passing a hyphen as an argument. Example:++echo "secretpassword" | rclone obscure -++If there is no data on STDIN to read, rclone obscure will default to+obfuscating the hyphen itself.+If you want to encrypt the config file then please use config fileencryption - see [rclone config](/commands/rclone_config/) for moreinfo.`,Run: func(command *cobra.Command, args []string) {cmd.CheckArgs(1, 1, command, args)+ var password string+ fi, _ := os.Stdin.Stat()+ if args[0] == "-" && (fi.Mode()&os.ModeCharDevice) == 0 {+ bytes, _ := ioutil.ReadAll(os.Stdin)+ password = string(bytes)+ } else {+ password = args[0]+ }cmd.Run(false, false, command, func() error {- obscured := obscure.MustObscure(args[0])+ obscured := obscure.MustObscure(password)fmt.Println(obscured)return nil})