Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a9a4079855 | ||
|
|
3965efef89 | ||
|
|
51170975c7 | ||
|
|
cc791da03c |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -54,6 +54,7 @@ MANIFEST
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
-pbincli.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
|
||||
96
README.md
96
README.md
@@ -2,143 +2,137 @@
|
||||
[](https://github.com/r4sas/PBinCLI/tags/)
|
||||
[](https://www.codacy.com/gh/r4sas/PBinCLI/dashboard?utm_source=github.com&utm_medium=referral&utm_content=r4sas/PBinCLI&utm_campaign=Badge_Grade)
|
||||
|
||||
PBinCLI
|
||||
=====
|
||||
# PBinCLI
|
||||
|
||||
PBinCLI is command line client for [PrivateBin](https://github.com/PrivateBin/PrivateBin/) written on Python 3.
|
||||
PBinCLI is a command line client for [PrivateBin](https://github.com/PrivateBin/PrivateBin/) written in Python 3.
|
||||
|
||||
Installing
|
||||
=====
|
||||
# Installation
|
||||
|
||||
Installation inside `virtualenv`:
|
||||
Installing globally using pip3:
|
||||
```bash
|
||||
pip3 install pbincli
|
||||
```
|
||||
|
||||
Installing with `virtualenv`:
|
||||
```bash
|
||||
python3 -m virtualenv --python=python3 venv
|
||||
. venv/bin/activate
|
||||
pip install pbincli
|
||||
```
|
||||
|
||||
Installation to system with pip3:
|
||||
```bash
|
||||
pip3 install pbincli
|
||||
```
|
||||
*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
|
||||
|
||||
*Note: if you used installation with `virtualenv`, don't forget to activate it before usage: call `. /path/to/venv/bin/activate` in terminal*
|
||||
# Configuration
|
||||
|
||||
Configuration
|
||||
=====
|
||||
By default PBinCLI is configured to use `https://paste.i2pd.xyz/` for sending and receiving pastes. No proxy is used by default.
|
||||
|
||||
By default pbincli configured to use `https://paste.i2pd.xyz/` for sending and receiving pastes. No proxy used by default.
|
||||
You can always create a config file to use different settings.
|
||||
|
||||
You can create config file to use different settings.
|
||||
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)
|
||||
|
||||
Configuration file is searched in `~/.config/pbincli/pbincli.conf`, `%APPDATA%/pbincli/pbincli.conf` (Windows) and `~/Library/Application Support/pbincli/pbincli.conf` (MacOS)
|
||||
|
||||
Example contents
|
||||
-----
|
||||
## Example of config file content
|
||||
|
||||
```ini
|
||||
server=https://paste.i2pd.xyz/
|
||||
proxy=http://127.0.0.1:3128
|
||||
```
|
||||
|
||||
All possible options for configuration file
|
||||
-----
|
||||
## List of OPTIONS available
|
||||
|
||||
| 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://` |
|
||||
| expire | 1day | 5min / 10min / 1hour / 1day / 1week / 1month / 1year / never |
|
||||
| burn | False | True / False |
|
||||
| discus | False | True / False |
|
||||
| format | plaintext | plaintext / syntaxhighlighting / markdown |
|
||||
| short | False | True / False |
|
||||
| short_api | None | `tinyurl`, `clckru`, `isgd`, `vgd`, `cuttly`, `yourls`, `custom` |
|
||||
| short_url | None | Domain name of shortener service for `yourls`, or sortener URL (with required parameters) for `custom` |
|
||||
| short_url | None | Domain name of shortener service for `yourls`, or URL (with required parameters) for `custom` |
|
||||
| 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 |
|
||||
| compression | zlib | zlib / none |
|
||||
|
||||
Usage
|
||||
=====
|
||||
# Usage
|
||||
|
||||
Tool available by command `pbincli`, help for every command can be called with `-h` option:
|
||||
PBinCLI tool is started with `pbincli` command. Detailed help on command usage is provided with `-h` option:
|
||||
```bash
|
||||
pbincli {send|get|delete} -h
|
||||
```
|
||||
|
||||
Sending
|
||||
-----
|
||||
## Sending
|
||||
|
||||
* Sending text:
|
||||
```bash
|
||||
pbincli send -t "Hello! This is test paste!"
|
||||
pbincli send -t "Hello! This is a test paste!"
|
||||
```
|
||||
|
||||
* Use stdin input to read text for paste:
|
||||
* Using stdin input to read text into a paste:
|
||||
```bash
|
||||
pbincli send - <<EOF
|
||||
Hello! This is test paste!
|
||||
Hello! This is a test paste!
|
||||
EOF
|
||||
```
|
||||
|
||||
* Sending file with text in paste:
|
||||
* Sending a file with text attached into a paste:
|
||||
```bash
|
||||
pbincli send -f info.pdf -t "I'm sending my document."
|
||||
```
|
||||
|
||||
* Sending only file without any text:
|
||||
* Sending a file only with no text attached:
|
||||
```bash
|
||||
pbincli send -q -f info.pdf
|
||||
```
|
||||
|
||||
*Note*: It is possible to set-up paste parameters such as burning after reading, expiritaion time, formatting, enabling discussions, and changing compression algorithm. Please refer to `pbincli send -h` output for more information.
|
||||
### Other options
|
||||
|
||||
Receiving
|
||||
-----
|
||||
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.
|
||||
|
||||
To retrieve paste from server, use `get` command with paste info.
|
||||
## Receiving
|
||||
|
||||
It must be formated like `pasteID#Passphrase` or use full URL to paste. Example:
|
||||
To retrieve a paste from a server, you need to use `get` command with the paste info.
|
||||
|
||||
Paste info must be formated as `pasteID#Passphrase` or just use full URL to a paste. Example:
|
||||
```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/
|
||||
```
|
||||
|
||||
Deletion
|
||||
-----
|
||||
## Deletion
|
||||
|
||||
To delete paste from server, use `delete` command with required `-p` and `-t` options:
|
||||
To delete a paste from a server, use `delete` command with required `-p` and `-t` options:
|
||||
```bash
|
||||
pbincli delete -p xxx -t deletetoken
|
||||
```
|
||||
|
||||
If you need to delete paste on different server that configured, use `-s` option with instance URL.
|
||||
If you need to delete a paste on different server than the configured one, use `-s` option together with the instance URL.
|
||||
|
||||
Additional examples
|
||||
=====
|
||||
# Additional examples
|
||||
|
||||
Here you can find additional examples.
|
||||
|
||||
Usage with service available inside I2P
|
||||
-----
|
||||
## Usage with I2P enabled services
|
||||
|
||||
Change settings to use server `http://privatebin.i2p/` and proxy `http://127.0.0.1:4444`. Here's example for configuration file:
|
||||
Change settings to set server to `http://privatebin.i2p/` and proxy to `http://127.0.0.1:4444`. Configuration file for this example is:
|
||||
```ini
|
||||
server=http://privatebin.i2p/
|
||||
proxy=http://127.0.0.1:4444
|
||||
```
|
||||
|
||||
Using tool with aliases
|
||||
-----
|
||||
## Using aliases
|
||||
|
||||
Example of alias to send paste from `stdin` direclty to I2P service:
|
||||
Example of alias to send a paste from `stdin` direclty to I2P service:
|
||||
```bash
|
||||
alias pastei2p="echo 'paste the text to stdin' && pbincli send -s http://privatebin.i2p/ -x http://127.0.0.1:4444 -"
|
||||
```
|
||||
|
||||
Call it by running `pastei2p` in terminal.
|
||||
|
||||
License
|
||||
=====
|
||||
# License
|
||||
|
||||
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.
|
||||
|
||||
90
README.rst
90
README.rst
@@ -18,12 +18,18 @@
|
||||
PBinCLI
|
||||
=======
|
||||
|
||||
PBinCLI is command line client for `PrivateBin <https://github.com/PrivateBin/PrivateBin/>`_ written on Python 3.
|
||||
PBinCLI is a command line client for `PrivateBin <https://github.com/PrivateBin/PrivateBin/>`_ written in Python 3.
|
||||
|
||||
Installing
|
||||
==========
|
||||
Installation
|
||||
============
|
||||
|
||||
Installation inside ``virtualenv``\ :
|
||||
Installing globally using pip3:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip3 install pbincli
|
||||
|
||||
Installing with ``virtualenv``\ :
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
@@ -31,33 +37,27 @@ Installation inside ``virtualenv``\ :
|
||||
. venv/bin/activate
|
||||
pip install pbincli
|
||||
|
||||
Installation to system with pip3:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pip3 install pbincli
|
||||
|
||||
*Note: if you used installation with ``virtualenv``\ , don't forget to activate it before usage: call ``. /path/to/venv/bin/activate`` in terminal*
|
||||
*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
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
By default pbincli configured to use ``https://paste.i2pd.xyz/`` for sending and receiving pastes. No proxy used by default.
|
||||
By default PBinCLI is configured to use ``https://paste.i2pd.xyz/`` for sending and receiving pastes. No proxy is used by default.
|
||||
|
||||
You can create config file to use different settings.
|
||||
You can always create a config file to use different settings.
|
||||
|
||||
Configuration file is searched in ``~/.config/pbincli/pbincli.conf``\ , ``%APPDATA%/pbincli/pbincli.conf`` (Windows) and ``~/Library/Application Support/pbincli/pbincli.conf`` (MacOS)
|
||||
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)
|
||||
|
||||
Example contents
|
||||
----------------
|
||||
Example of config file content
|
||||
------------------------------
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
server=https://paste.i2pd.xyz/
|
||||
proxy=http://127.0.0.1:3128
|
||||
|
||||
All possible options for configuration file
|
||||
-------------------------------------------
|
||||
List of OPTIONS available
|
||||
-------------------------
|
||||
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
@@ -74,6 +74,18 @@ All possible options for configuration file
|
||||
* - proxy
|
||||
- None
|
||||
- Proxy address starting with scheme ``http://`` or ``socks5://``
|
||||
* - expire
|
||||
- 1day
|
||||
- 5min / 10min / 1hour / 1day / 1week / 1month / 1year / never
|
||||
* - burn
|
||||
- False
|
||||
- True / False
|
||||
* - discus
|
||||
- False
|
||||
- True / False
|
||||
* - format
|
||||
- plaintext
|
||||
- plaintext / syntaxhighlighting / markdown
|
||||
* - short
|
||||
- False
|
||||
- True / False
|
||||
@@ -82,7 +94,7 @@ All possible options for configuration file
|
||||
- ``tinyurl``\ , ``clckru``\ , ``isgd``\ , ``vgd``\ , ``cuttly``\ , ``yourls``\ , ``custom``
|
||||
* - short_url
|
||||
- None
|
||||
- Domain name of shortener service for ``yourls``\ , or sortener URL (with required parameters) for ``custom``
|
||||
- Domain name of shortener service for ``yourls``\ , or URL (with required parameters) for ``custom``
|
||||
* - short_user
|
||||
- None
|
||||
- Used only in ``yourls``
|
||||
@@ -98,12 +110,15 @@ All possible options for configuration file
|
||||
* - no_insecure_warning
|
||||
- False
|
||||
- True / False
|
||||
* - compression
|
||||
- zlib
|
||||
- zlib / none
|
||||
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
Tool available by command ``pbincli``\ , help for every command can be called with ``-h`` option:
|
||||
PBinCLI tool is started with ``pbincli`` command. Detailed help on command usage is provided with ``-h`` option:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
@@ -118,39 +133,42 @@ Sending
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pbincli send -t "Hello! This is test paste!"
|
||||
pbincli send -t "Hello! This is a test paste!"
|
||||
|
||||
*
|
||||
Use stdin input to read text for paste:
|
||||
Using stdin input to read text into a paste:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pbincli send - <<EOF
|
||||
Hello! This is test paste!
|
||||
Hello! This is a test paste!
|
||||
EOF
|
||||
|
||||
*
|
||||
Sending file with text in paste:
|
||||
Sending a file with text attached into a paste:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pbincli send -f info.pdf -t "I'm sending my document."
|
||||
|
||||
*
|
||||
Sending only file without any text:
|
||||
Sending a file only with no text attached:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pbincli send -q -f info.pdf
|
||||
|
||||
*Note*\ : It is possible to set-up paste parameters such as burning after reading, expiritaion time, formatting, enabling discussions, and changing compression algorithm. Please refer to ``pbincli send -h`` output for more information.
|
||||
Other options
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
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.
|
||||
|
||||
Receiving
|
||||
---------
|
||||
|
||||
To retrieve paste from server, use ``get`` command with paste info.
|
||||
To retrieve a paste from a server, you need to use ``get`` command with the paste info.
|
||||
|
||||
It must be formated like ``pasteID#Passphrase`` or use full URL to paste. Example:
|
||||
Paste info must be formated as ``pasteID#Passphrase`` or just use full URL to a paste. Example:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
@@ -160,33 +178,33 @@ It must be formated like ``pasteID#Passphrase`` or use full URL to paste. Exampl
|
||||
Deletion
|
||||
--------
|
||||
|
||||
To delete paste from server, use ``delete`` command with required ``-p`` and ``-t`` options:
|
||||
To delete a paste from a server, use ``delete`` command with required ``-p`` and ``-t`` options:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
pbincli delete -p xxx -t deletetoken
|
||||
|
||||
If you need to delete paste on different server that configured, use ``-s`` option with instance URL.
|
||||
If you need to delete a paste on different server than the configured one, use ``-s`` option together with the instance URL.
|
||||
|
||||
Additional examples
|
||||
===================
|
||||
|
||||
Here you can find additional examples.
|
||||
|
||||
Usage with service available inside I2P
|
||||
---------------------------------------
|
||||
Usage with I2P enabled services
|
||||
-------------------------------
|
||||
|
||||
Change settings to use server ``http://privatebin.i2p/`` and proxy ``http://127.0.0.1:4444``. Here's example for configuration file:
|
||||
Change settings to set server to ``http://privatebin.i2p/`` and proxy to ``http://127.0.0.1:4444``. Configuration file for this example is:
|
||||
|
||||
.. code-block:: ini
|
||||
|
||||
server=http://privatebin.i2p/
|
||||
proxy=http://127.0.0.1:4444
|
||||
|
||||
Using tool with aliases
|
||||
-----------------------
|
||||
Using aliases
|
||||
-------------
|
||||
|
||||
Example of alias to send paste from ``stdin`` direclty to I2P service:
|
||||
Example of alias to send a paste from ``stdin`` direclty to I2P service:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
|
||||
BIN
contrib/privatebin.ico
Normal file
BIN
contrib/privatebin.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
67
pbincli.spec
Normal file
67
pbincli.spec
Normal file
@@ -0,0 +1,67 @@
|
||||
# -*- mode: python -*-
|
||||
|
||||
from pkg_resources import parse_version
|
||||
from PyInstaller.utils.win32.versioninfo import VSVersionInfo, FixedFileInfo, StringFileInfo, StringTable, StringStruct, VarFileInfo, VarStruct
|
||||
from pbincli.__init__ import __version__ as pbincli_version, __copyright__ as pbincli_copyright
|
||||
|
||||
pbincli_ver = parse_version(pbincli_version)
|
||||
|
||||
block_cipher = None
|
||||
|
||||
a = Analysis(['pbincli\\cli.py'],
|
||||
pathex=[],
|
||||
binaries=[],
|
||||
datas=[],
|
||||
hiddenimports=[],
|
||||
hookspath=[],
|
||||
runtime_hooks=[],
|
||||
excludes=[],
|
||||
win_no_prefer_redirects=False,
|
||||
win_private_assemblies=False,
|
||||
cipher=block_cipher,
|
||||
noarchive=False)
|
||||
pyz = PYZ(a.pure, a.zipped_data,
|
||||
cipher=block_cipher)
|
||||
exe = EXE(pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
[],
|
||||
name='pbincli-' + pbincli_version,
|
||||
version=VSVersionInfo(
|
||||
ffi=FixedFileInfo(
|
||||
filevers=(pbincli_ver.major, pbincli_ver.minor, pbincli_ver.micro, 0),
|
||||
prodvers=(pbincli_ver.major, pbincli_ver.minor, pbincli_ver.micro, 0),
|
||||
mask=0x3f,
|
||||
flags=0x0,
|
||||
OS=0x40004,
|
||||
fileType=0x1,
|
||||
subtype=0x0,
|
||||
date=(0, 0)
|
||||
),
|
||||
kids=[
|
||||
StringFileInfo([
|
||||
StringTable(
|
||||
u'040904B0',
|
||||
[
|
||||
StringStruct(u'FileDescription', u'PrivateBin CLI'),
|
||||
StringStruct(u'FileVersion', pbincli_version),
|
||||
StringStruct(u'InternalName', u'pbincli'),
|
||||
StringStruct(u'LegalCopyright', pbincli_copyright),
|
||||
StringStruct(u'OriginalFilename', u'pbincli-' + pbincli_version + u'.exe'),
|
||||
StringStruct(u'ProductName', u'PBinCLI'),
|
||||
StringStruct(u'ProductVersion', pbincli_version)
|
||||
]
|
||||
)
|
||||
]),
|
||||
VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
|
||||
]
|
||||
),
|
||||
icon=['contrib\\privatebin.ico'],
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True,
|
||||
runtime_tmpdir=None,
|
||||
console=True)
|
||||
@@ -105,8 +105,12 @@ def main():
|
||||
|
||||
CONFIG = {
|
||||
'server': 'https://paste.i2pd.xyz/',
|
||||
'mirrors': None, # real example for paste.i2pd.xyz: 'http://privatebin.ygg/,http://privatebin.i2p/'
|
||||
'mirrors': None,
|
||||
'proxy': None,
|
||||
'expire': None,
|
||||
'burn': False,
|
||||
'discus': False,
|
||||
'format': None,
|
||||
'short': False,
|
||||
'short_api': None,
|
||||
'short_url': None,
|
||||
@@ -114,7 +118,8 @@ def main():
|
||||
'short_pass': None,
|
||||
'short_token': None,
|
||||
'no_check_certificate': False,
|
||||
'no_insecure_warning': False
|
||||
'no_insecure_warning': False,
|
||||
'compression': None
|
||||
}
|
||||
|
||||
# Configuration preference order:
|
||||
|
||||
Reference in New Issue
Block a user