diff --git a/pbincli/actions.py b/pbincli/actions.py index 5e67f28..5874a42 100644 --- a/pbincli/actions.py +++ b/pbincli/actions.py @@ -4,6 +4,7 @@ import pbincli.actions from Crypto.Hash import SHA256 from Crypto.Random import get_random_bytes from pbincli.sjcl_gcm import SJCL +from pbincli.transports import privatebin from pbincli.utils import PBinCLIException, check_readable, check_writable from zlib import compress @@ -23,5 +24,7 @@ def send(args): password = passphrase + p.hexdigest().encode("UTF-8") data = SJCL().encrypt(file, password) + request = "data={}&expire={}&formatter={}&burnafterreading={}&opendiscussion={}".format(data, args.expire, args.format, int(args.burn), int(args.discus)) '''Here we must run function post from pbincli.transports''' - print(data) + print(request) + privatebin().post(request) diff --git a/pbincli/sjcl_gcm.py b/pbincli/sjcl_gcm.py index 1a5b7c7..b38c41d 100644 --- a/pbincli/sjcl_gcm.py +++ b/pbincli/sjcl_gcm.py @@ -133,11 +133,11 @@ class SJCL(object): ciphertext = ciphertext + mac return { - "salt": base64.b64encode(salt), + "salt": base64.b64encode(salt).decode('UTF-8'), "iter": count, "ks": dkLen*8, - "ct": base64.b64encode(ciphertext), - "iv": base64.b64encode(iv), + "ct": base64.b64encode(ciphertext).decode('UTF-8'), + "iv": base64.b64encode(iv).decode('UTF-8'), "cipher": "aes", "mode": "gcm", "adata": "", diff --git a/pbincli/transports.py b/pbincli/transports.py new file mode 100644 index 0000000..8082196 --- /dev/null +++ b/pbincli/transports.py @@ -0,0 +1,16 @@ +import requests +import json +import urllib + +class privatebin(object): + + def __init__(self): + self.proxies = {'http': 'http://127.0.0.1:4444'} + self.server = 'http://paste.r4sas.i2p/' + self.headers = {'X-Requested-With': 'JSONHttpRequest'} + + def post(self, data): + r = requests.post(url=self.server, headers=self.headers, proxies=self.proxies, data=data) + print(r.request) + print(r.status_code) + print(r.text) diff --git a/requirements.txt b/requirements.txt index acdfd20..66cacfd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ pycryptodome +requests \ No newline at end of file