privatebin

package module
v0.0.0-...-d3372da Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: ISC Imports: 19 Imported by: 0

README

Introduction

This repository contains a CLI and client library for privatebin servers.

Abstract

I am a big privatebin user, and I never found a clean CLI to deal with it. It why I decided to build this project to simplify my day-to-day workflow.

From source

git clone https://github.com/gearnode/privatebin.git
cd privatebin
make
make install

Configuration

To use the cli, create a file in ~/.config/privatebin/config.json.

Minimal Configuration

{
    "bin": [
        {
            "name": "",
            "host": "https://privatebin.net"
        }
    ]
}

More Complete Configuration

{
    "bin": [
        {
            "name": "example",
            "host": "bin.example.com",
            "auth": {
                "username": "john.doe",
                "password": "s$cr$t"
            },
            "formatter": "markdown",
            "burn_after_reading": false
        },
        {
            "name": "",
            "host": "https://privatebin.net"
        }
    ],
    "burn_after_reading": true
}

Usage

You can create paste from file with:

cat resume.txt | privatebin -bin demo

Build

You can build the command line interface with:

make build

Documentation

This was originally a CLI and library for interacting with PrivateBin instances. It has been modified somewhat to reduce external dependencies.

See original repository

Additionally, the original author's base58 library was integrated into this module.

Licence

Released under the ISC license.

Copyright (c) 2020-2022 Bryan Frimin bryan@frimin.fr.

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

Documentation

Index

Constants

View Source
const (
	PrivateBinAPIVersion = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	URL      url.URL
	Username string
	Password string
}

func NewClient

func NewClient(uri *url.URL, username, password string) *Client

func (*Client) CreatePaste

func (c *Client) CreatePaste(
	message *PasteMessage,
	expire, formatter string,
	openDiscussion, burnAfterReading, gzip bool,
	password string,
) (*CreatePasteResponse, error)

type CreatePasteRequest

type CreatePasteRequest struct {
	V     int                    `json:"v"`
	AData []interface{}          `json:"adata"`
	Meta  CreatePasteRequestMeta `json:"meta"`
	CT    string                 `json:"ct"`
}

type CreatePasteRequestMeta

type CreatePasteRequestMeta struct {
	Expire string `json:"expire"`
}

type CreatePasteResponse

type CreatePasteResponse struct {
	ID          string `json:"id"`
	Status      int    `json:"status"`
	Message     string `json:"message"`
	URL         string `json:"url"`
	DeleteToken string `json:"deletetoken"`
}

type PasteContent

type PasteContent struct {
	Paste          string `json:"paste"`
	Attachment     string `json:"attachment,omitempty"`
	AttachmentName string `json:"attachment_name,omitempty"`
}

type PasteData

type PasteData struct {
	*PasteSpec
	Data             []byte
	Formatter        string
	OpenDiscussion   bool
	BurnAfterReading bool
}

type PasteMessage

type PasteMessage struct {
	Attachment bool
	Filename   string
	Data       []byte
}

type PasteSpec

type PasteSpec struct {
	IV          string
	Salt        string
	Iterations  int
	KeySize     int
	TagSize     int
	Algorithm   string
	Mode        string
	Compression string
}

func (*PasteSpec) SpecArray

func (ps *PasteSpec) SpecArray() []interface{}

Directories

Path Synopsis
cmd
internal

Jump to

Keyboard shortcuts

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