pbgopy

command module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 28, 2020 License: MIT Imports: 5 Imported by: 0

README

pbgopy

Release go.dev reference

pbgopy acts like pbcopy/pbpaste but for multiple devices. It lets you share data across devices like you copy and paste.

Demo

Installation

Binary releases are available through here.

MacOS
brew install nakabonne/pbgopy/pbgopy
RHEL/CentOS
rpm -ivh https://github.com/nakabonne/pbgopy/releases/download/v0.3.0/pbgopy_0.3.0_linux_amd64.rpm
Debian/Ubuntu
wget https://github.com/nakabonne/pbgopy/releases/download/v0.3.0/pbgopy_0.3.0_linux_amd64.deb
apt install ./pbgopy_0.3.0_linux_amd64.deb
Arch Linux

AUR package is available: pbgopy

yay pbgopy
Nix
nix-shell -p nixpkgs.pbgopy
Go
go get github.com/nakabonne/pbgopy
Docker
docker run --rm nakabonne/pbgopy pbgopy help

Usage

First up, you start the pbgopy server which works as a shared clipboard for devices. It listens on port 9090 by default. You must allow access to this port for each device you want to share data with.

pbgopy serve

Populate the address of the host where the above process is running into the PBGOPY_SERVER environment variable. Then put the data entered in STDIN into the server with:

export PBGOPY_SERVER=http://host.xz:9090
pbgopy copy <foo.png

Paste it on another device with:

export PBGOPY_SERVER=http://host.xz:9090
pbgopy paste >foo.png

Options

End-to-end encryption

pbgopy comes with a built-in ability to encrypt/decrypt with a variety of keys.

With symmetric-key

You can derive the key from password with the -p flag, which is provided so that you can encrypt/decrypt without previous setting.

pbgopy copy -p your-password <plaintext.txt
pbgopy paste -p your-password

Be aware that this way cannot prevent a dictionary attack.

For more safety, it is highly recommended to use a 32-bytes symmetric key generated by other methods. The -k flag or the PBGOPY_SYMMETRIC_KEY_FILE environment variable is available to indicate the path to key file.

pbgopy copy -k /path/to/pbgopy.key <plaintext.txt
With public/private key-pair

pbgopy can also encrypt using hybrid cryptosystem. If you have already exchanged public keys between devices you want to share data with, this is the way to go.

pbgopy copy --public-key-file /path/to/public.key <plaintext.txt
pbgopy paste --private-key-file /path/to/private.key <plaintext.txt

You manage your keyring in GPG? The --gpg-user-id (-u) flag is for you! Suppose you want to encrypt with a public key whose user id is alice:

pbgopy copy -u alice <plaintext.txt

Then you decrypt it with the private key by specifying the user id on another device:

pbgopy paste -u alice

There are a couple of ways to specify a user ID. Visit here to see the entire list.

TTL

If you don't want more data to be cached on the server than necessary, use the --ttl flag to set TTL for the cache. Give 0s for disabling it. Default is 24h.

pbgopy serve --ttl 10m
Authentication

HTTP Basic Authentication is available with -a flag.

pbgopy serve -a user:pass
pbgopy copy -a user:pass <foo.png
pbgopy paste -a user:pass >foo.png
From clipboard on your OS

You can put the data stored at the clipboard on your OS into pbgopy server.

pbgopy copy -c

Inspired By

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Package cache provides an interface to temporarily store content on a pbgopy server.
Package cache provides an interface to temporarily store content on a pbgopy server.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL