2019-05-31 12:44:14 +00:00
[](https://github.com/r4sas/PBinCLI/blob/master/LICENSE)
2019-05-31 14:42:22 +00:00
[](https://github.com/r4sas/PBinCLI/tags/)
2022-01-10 12:26:20 +03:00
[](https://www.codacy.com/gh/r4sas/PBinCLI/dashboard?utm_source=github.com& utm_medium=referral& utm_content=r4sas/PBinCLI& utm_campaign=Badge_Grade)
2019-05-31 12:44:14 +00:00
2022-02-02 16:09:25 +03:00
# PBinCLI
2017-02-18 21:00:40 +03:00
2022-02-10 22:29:31 +03:00
PBinCLI is a command line client for [PrivateBin ](https://github.com/PrivateBin/PrivateBin/ ) written in Python 3.
2017-02-18 21:27:24 +03:00
2022-02-10 22:29:31 +03:00
# Installation
2022-01-24 19:06:29 +03:00
2022-02-10 22:29:31 +03:00
Installing globally using pip3:
2017-02-18 21:30:56 +03:00
```bash
2022-02-10 22:29:31 +03:00
pip3 install pbincli
2017-02-18 21:30:56 +03:00
```
2017-02-19 23:27:37 +03:00
2022-02-10 22:29:31 +03:00
Installing with `virtualenv` :
2022-01-24 19:06:29 +03:00
```bash
2022-02-10 22:29:31 +03:00
python3 -m virtualenv --python=python3 venv
. venv/bin/activate
pip install pbincli
2022-01-24 19:06:29 +03:00
```
2022-02-10 22:29:31 +03:00
*Note*: if you used `virtualenv` installation method, don't forget to activate your virtual environment before running the tool: call `. /path/to/venv/bin/activate` in terminal
2022-01-24 19:06:29 +03:00
2022-02-02 16:09:25 +03:00
# Configuration
2022-01-24 19:06:29 +03:00
2022-02-10 22:29:31 +03:00
By default PBinCLI is configured to use `https://paste.i2pd.xyz/` for sending and receiving pastes. No proxy is used by default.
2018-09-22 01:33:21 +03:00
2022-02-10 22:29:31 +03:00
You can always create a config file to use different settings.
2018-09-22 01:33:21 +03:00
2022-02-10 22:29:31 +03:00
Configuration file is expected to be found in `~/.config/pbincli/pbincli.conf` , `%APPDATA%/pbincli/pbincli.conf` (Windows) and `~/Library/Application Support/pbincli/pbincli.conf` (MacOS)
2022-01-24 19:06:29 +03:00
2022-02-10 22:29:31 +03:00
## Example of config file content
2018-09-22 01:33:21 +03:00
2019-06-21 13:32:46 +00:00
```ini
2018-09-22 01:33:21 +03:00
server=https://paste.i2pd.xyz/
proxy=http://127.0.0.1:3128
```
2017-02-21 05:12:13 +03:00
2022-02-10 22:29:31 +03:00
## List of OPTIONS available
2022-01-24 19:06:29 +03:00
2022-01-24 19:07:40 +03:00
| Option | Default | Possible value |
|----------------------|-------------------------|----------------|
| server | https://paste.i2pd.xyz/ | Domain ending with slash |
| mirrors | None | Domains separated with comma, like `http://privatebin.ygg/,http://privatebin.i2p/` |
| proxy | None | Proxy address starting with scheme `http://` or `socks5://` |
2022-02-02 16:09:25 +03:00
| expire | 1day | 5min / 10min / 1hour / 1day / 1week / 1month / 1year / never |
| burn | False | True / False |
| discus | False | True / False |
| format | plaintext | plaintext / syntaxhighlighting / markdown |
2022-01-24 19:07:40 +03:00
| short | False | True / False |
| short_api | None | `tinyurl` , `clckru` , `isgd` , `vgd` , `cuttly` , `yourls` , `custom` |
2022-02-02 16:09:25 +03:00
| short_url | None | Domain name of shortener service for `yourls` , or URL (with required parameters) for `custom` |
2022-01-24 19:07:40 +03:00
| short_user | None | Used only in `yourls` |
| short_pass | None | Used only in `yourls` |
| short_token | None | Used only in `yourls` |
| no_check_certificate | False | True / False |
| no_insecure_warning | False | True / False |
2022-02-02 16:09:25 +03:00
| compression | zlib | zlib / none |
2022-01-24 19:06:29 +03:00
2022-02-02 16:09:25 +03:00
# Usage
2017-02-21 05:09:38 +03:00
2022-02-10 22:29:31 +03:00
PBinCLI tool is started with `pbincli` command. Detailed help on command usage is provided with `-h` option:
2019-06-21 12:43:59 +00:00
```bash
2022-01-24 19:06:29 +03:00
pbincli {send|get|delete} -h
2019-06-21 12:43:59 +00:00
```
2018-02-16 11:56:13 +03:00
2022-02-02 16:09:25 +03:00
## Sending
2018-02-16 11:56:13 +03:00
2022-01-24 19:06:29 +03:00
* Sending text:
```bash
2022-02-10 22:29:31 +03:00
pbincli send -t "Hello! This is a test paste!"
2022-01-24 19:06:29 +03:00
```
2022-02-10 22:29:31 +03:00
* Using stdin input to read text into a paste:
2019-06-21 12:43:59 +00:00
```bash
pbincli send - < < EOF
2022-02-10 22:29:31 +03:00
Hello! This is a test paste!
2019-06-21 12:43:59 +00:00
EOF
```
2017-02-21 05:09:38 +03:00
2022-02-10 22:29:31 +03:00
* Sending a file with text attached into a paste:
2022-01-24 19:06:29 +03:00
```bash
pbincli send -f info.pdf -t "I'm sending my document."
```
2017-02-21 05:09:38 +03:00
2022-02-10 22:29:31 +03:00
* Sending a file only with no text attached:
2019-06-21 12:43:59 +00:00
```bash
2022-01-24 19:06:29 +03:00
pbincli send -q -f info.pdf
2019-06-21 12:43:59 +00:00
```
2017-02-21 05:09:38 +03:00
2022-02-02 16:09:25 +03:00
### Other options
2022-01-24 19:06:29 +03:00
2022-02-10 22:29:31 +03:00
It is also possible to set-up paste parameters such as "burn after reading", expiritaion time, formatting, enabling discussions and changing compression algorithm. Please refer to `pbincli send -h` output for more information.
2022-02-02 16:09:25 +03:00
## Receiving
2022-01-24 19:06:29 +03:00
2022-02-10 22:29:31 +03:00
To retrieve a paste from a server, you need to use `get` command with the paste info.
2017-02-21 05:12:13 +03:00
2022-02-10 22:29:31 +03:00
Paste info must be formated as `pasteID#Passphrase` or just use full URL to a paste. Example:
2022-01-24 19:06:29 +03:00
```bash
pbincli get xxx#yyy ### receive paste xxx from https://paste.i2pd.xyz/ by default
pbincli get https://example.com/?xxx#yyy ### receive paste xxx from https://example.com/
```
2022-02-02 16:09:25 +03:00
## Deletion
2017-02-21 05:09:38 +03:00
2022-02-10 22:29:31 +03:00
To delete a paste from a server, use `delete` command with required `-p` and `-t` options:
2019-06-21 12:43:59 +00:00
```bash
2022-01-24 19:06:29 +03:00
pbincli delete -p xxx -t deletetoken
```
2022-02-10 22:29:31 +03:00
If you need to delete a paste on different server than the configured one, use `-s` option together with the instance URL.
2022-01-24 19:06:29 +03:00
2022-02-02 16:09:25 +03:00
# Additional examples
2022-01-24 19:06:29 +03:00
Here you can find additional examples.
2022-02-10 22:29:31 +03:00
## Usage with I2P enabled services
2022-01-24 19:06:29 +03:00
2022-02-10 22:29:31 +03:00
Change settings to set server to `http://privatebin.i2p/` and proxy to `http://127.0.0.1:4444` . Configuration file for this example is:
2022-01-24 19:06:29 +03:00
```ini
server=http://privatebin.i2p/
proxy=http://127.0.0.1:4444
2019-06-21 12:43:59 +00:00
```
2017-02-21 05:09:38 +03:00
2022-02-10 22:29:31 +03:00
## Using aliases
2022-01-24 19:06:29 +03:00
2022-02-10 22:29:31 +03:00
Example of alias to send a paste from `stdin` direclty to I2P service:
2019-06-21 12:43:59 +00:00
```bash
2022-01-24 19:06:29 +03:00
alias pastei2p="echo 'paste the text to stdin' & & pbincli send -s http://privatebin.i2p/ -x http://127.0.0.1:4444 -"
2019-06-21 12:43:59 +00:00
```
2018-09-22 01:33:21 +03:00
2022-01-24 19:06:29 +03:00
Call it by running `pastei2p` in terminal.
2017-03-02 14:23:05 +03:00
2022-02-02 16:09:25 +03:00
# License
2022-01-24 19:06:29 +03:00
2022-01-24 19:07:40 +03:00
This project is licensed under the MIT license, which can be found in the file [LICENSE ](https://github.com/r4sas/PBinCLI/blob/master/LICENSE ) in the root of the project source code.