r4sas / PBinCLI

PrivateBin CLI on python 3
MIT License
66 stars 25 forks source link

PBinCLI produces garbage output against private instance #12

Closed Nothing4You closed 5 years ago

Nothing4You commented 5 years ago

Tested against both paste.i2pd.xyz aswell as a private instance. Works fine on paste.i2pd.xyz. Both instances currently run version 1.1.1.

Examples (reproducible on the private instance): echo "Test bla" | python -m pbincli.cli send Results reliably in the following:

Test fst fst fst fst fst fst fst fst fst fst fst fst fst fst fst fst fst                                                 

"This is a slightly longer test" results in VVVVVVVV

Do you have any recommendations for debugging this?

r4sas commented 5 years ago

Can you try print what stored in text variable?

Add print(text) before request formatting:

https://github.com/r4sas/PBinCLI/blob/f23b4ff3ccc97a2d972d867579073b52e43418bb/pbincli/actions.py#L31-L36

Nothing4You commented 5 years ago

print(repr(text)) results in the given input: 'This is a slightly longer test\n'

Nothing4You commented 5 years ago

from --debug:

'This is a slightly longer test\n'
Passphrase: b'y+Xl5qqkuk47Zuk9tORq7ecCXheJNjkMsBscAc6m+EU='
Password:   b'y+Xl5qqkuk47Zuk9tORq7ecCXheJNjkMsBscAc6m+EU='
Request:    {'expire': '1day', 'formatter': 'plaintext', 'burnafterreading': 0, 'opendiscussion': 0, 'data': '{"salt":"NErgsy5f5Kc=","iter":10000,"ks":128,"ct":"uaAs+eeD/LUqkyriGsXWEMJgpyBuXtNsgo2qEQBC0yAGxNN1kioQ4Gi2ajGmwDwLS2ApFnqdFrot221AlW+2evsxAO7jyosD6htIaoA/eNr7X7aAocfJnQ==","iv":"bPORTnbbSHX2U2/khq5WpQ==","cipher":"aes","mode":"gcm","adata":"","v":1,"ts":128}'}
Response:   {"status":0,"id":"00e13cfb0b0c2db9","url":"\/?00e13cfb0b0c2db9","deletetoken":"72941e86b5e9a182b8b7ebb27ba3eb70499e5522"}

Paste uploaded!
PasteID:    00e13cfb0b0c2db9
Password:   y+Xl5qqkuk47Zuk9tORq7ecCXheJNjkMsBscAc6m+EU=
Delete token:   72941e86b5e9a182b8b7ebb27ba3eb70499e5522

Link:       https://instance/?00e13cfb0b0c2db9#y+Xl5qqkuk47Zuk9tORq7ecCXheJNjkMsBscAc6m+EU=
r4sas commented 5 years ago
echo "Test bla" | pbincli send
Paste uploaded!
PasteID:        c89b929ac059178b
Password:       ABmRQE6V9QAP19/uzgARltqW2dpjPzt9Cy+z+iuPcXc=
Delete token:   34ac0ff358e5eefaea7b72de89500c94f488f913176f6576aec9930bd0935491

Link:           https://paste.i2pd.xyz/?c89b929ac059178b#ABmRQE6V9QAP19/uzgARltqW2dpjPzt9Cy+z+iuPcXc=

Can't reproduce.

upd: I'll try with 1.2.1 soon.

upd2: same for 1.2.1, paste sent and read without problems...

r4sas commented 5 years ago

from --debug:

What happens if you try get paste with cli? Is result same as on webpage?

Nothing4You commented 5 years ago

Interestingly get works fine:

PasteID:    00e13cfb0b0c2db9
Passphrase: y+Xl5qqkuk47Zuk9tORq7ecCXheJNjkMsBscAc6m+EU=
Password:   y+Xl5qqkuk47Zuk9tORq7ecCXheJNjkMsBscAc6m+EU=
Response:   {"status":0,"id":"00e13cfb0b0c2db9","url":"\/?00e13cfb0b0c2db9?00e13cfb0b0c2db9","meta":{"expire_date":1559383761,"formatter":"plaintext","postdate":1559297361,"remaining_time":83466},"data":"{\"salt\":\"NErgsy5f5Kc=\",\"iter\":10000,\"ks\":128,\"ct\":\"uaAs+eeD\/LUqkyriGsXWEMJgpyBuXtNsgo2qEQBC0yAGxNN1kioQ4Gi2ajGmwDwLS2ApFnqdFrot221AlW+2evsxAO7jyosD6htIaoA\/eNr7X7aAocfJnQ==\",\"iv\":\"bPORTnbbSHX2U2\/khq5WpQ==\",\"cipher\":\"aes\",\"mode\":\"gcm\",\"adata\":\"\",\"v\":1,\"ts\":128}","comments":[],"comment_count":0,"comment_offset":0,"@context":"js\/paste.jsonld"}

Paste received! Text inside:
Text:   {'salt': 'NErgsy5f5Kc=', 'iter': 10000, 'ks': 128, 'ct': 'uaAs+eeD/LUqkyriGsXWEMJgpyBuXtNsgo2qEQBC0yAGxNN1kioQ4Gi2ajGmwDwLS2ApFnqdFrot221AlW+2evsxAO7jyosD6htIaoA/eNr7X7aAocfJnQ==', 'iv': 'bPORTnbbSHX2U2/khq5WpQ==', 'cipher': 'aes', 'mode': 'gcm', 'adata': '', 'v': 1, 'ts': 128}

b'This is a slightly longer test\n'

As I said, I wasn't able to reproduce this on your instance, but both our instances are currently 1.1.1.

Nothing4You commented 5 years ago

fwiw also tested against privatebin.net and another private instance i know running 1.1.1 and it worked there. I'll get in touch with the person managing this instance and see if they can update it and whether there may be some weird modifications.

r4sas commented 5 years ago

If it so, please contact insance owner ;)