pbin

package module
v0.0.0-...-98f2f2e Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: MIT-0 Imports: 20 Imported by: 0

README

pbin - privatebin cli tool


this is an experimental project for putting pastes on privatebin, see here for a public directory: https://privatebin.info/directory/

Install:

install the normal "go" way:

go get github.com/cbluth/pbin/cmd/pbin

or download a binary from the releases page:

https://github.com/cbluth/pbin/releases

Basic Usage:

Upload Paste:

$ echo "anything" | pbin
https://privatebin.net/?5f9fc3956e8bc7bd#8NBafBFyqKWZrqPHiw4hC1JkL9Vx9mxEUGtXBT5wLNJF

Download Paste:

$ URL="https://privatebin.net/?908a9812a167d638#AKQaAp7bwC9t7gLBJkLXxJt1ZQQyW4bfjnBCzbn73c95"
$ pbin $URL
## prints content to stdout

Advanced Usage

You can set additional options if some of these arguments, only when creating a paste:

  • -burn
  • -open
  • -base64
  • -password

Upload Base64 Paste:

$ cat cat-meme.gif | pbin -base64

Download Base64 Paste:

$ pbin $URL -base64 > cat-meme.gif

Download Base64 Paste to file:

$ pbin $URL -base64 -o cat-meme.gif

Upload Paste with Burn After Read Once:

$ echo "anything" | pbin -burn

Download Paste to filepath:

$ pbin $URL -output cat-meme.gif

Upload Paste with discussion forum enabled:

$ echo "anything" | pbin -open

Upload Paste with password protection:

$ echo "anything" | pbin -password mySecretPassw0rd

Expiry Options

You can set the expiry with one of these arguments, only when creating a paste:

  • -hour
  • -day
  • -week
  • -month
  • -year
  • -never

examples:

$ echo "anything" | pbin -hour # <- will expire after 1 hour
$ echo "anything" | pbin -week # <- will expire after 1 week
$ echo "anything" | pbin -month # <- will expire after 1 month
$ cat cat-meme.gif | pbin -base64 -never

TODO:

A list of things to do:

  • add reply/comment
  • add upload file
  • add shorten url

Documentation

Index

Constants

View Source
const (
	Hour       Expiry  = iota // expires after 1 hour
	Day                       // expires after 1 day
	Week                      // expires after 1 week
	Month                     // expires after 1 month
	Year                      // expires after 1 year
	Never                     // expires `"never"`
	Burn       Feature = iota // delete after reading once
	Discussion                // enable comments
	UploadFile                // upload a file
	ShortenURL                // shorten the paste url (does not support foreign urls)
)
View Source
const (
	PrivateBinAPIVersion int    = 2
	KDFIterations        int    = 100000 // kdf iterations
	PasteIDSize          int    = 8      // bytes,hex
	KDFSecretSize        int    = 32     // bytes
	AESKeySize           int    = 32     // bytes
	NonceSize            int    = 12     // bytes
	SaltSize             int    = 8      // bytes
	TagSize              int    = 128    // bits??
	EncryptionAlgorithm  string = "aes"
	EncryptionMode       string = "gcm"
	DataCompression      string = "zlib"
)

Variables

This section is empty.

Functions

func GetPaste

func GetPaste(ur *url.URL) ([]byte, error)

Types

type Expiry

type Expiry option // expiry options

func (Expiry) String

func (e Expiry) String() string

type Feature

type Feature option // featured options

type Paste

type Paste struct {
	// contains filtered or unexported fields
}

func CraftPaste

func CraftPaste(b []byte) (*Paste, error)

func (*Paste) BurnAfterRead

func (p *Paste) BurnAfterRead(burn bool)

func (*Paste) OpenDiscussion

func (p *Paste) OpenDiscussion(openDiscussion bool)

func (*Paste) Send

func (p *Paste) Send() (*url.URL, map[string]interface{}, error)

func (*Paste) SetExpiry

func (p *Paste) SetExpiry(es string)

func (*Paste) SetPassword

func (p *Paste) SetPassword(pass string)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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