Browse Source

Bug fix, urlencode

dependabot/add-v2-config-file
sviceman 8 years ago
parent
commit
d92816a22b
  1. 7
      pbincli/actions.py
  2. 4
      pbincli/transports.py

7
pbincli/actions.py

@ -7,6 +7,7 @@ from pbincli.sjcl_gcm import SJCL @@ -7,6 +7,7 @@ from pbincli.sjcl_gcm import SJCL
from pbincli.transports import privatebin
from pbincli.utils import PBinCLIException, check_readable, check_writable
from zlib import compress
import json
def send(args):
""" Sub-command for sending paste """
@ -24,7 +25,11 @@ def send(args): @@ -24,7 +25,11 @@ 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))
#request = "data={}&expire={}&formatter={}&burnafterreading={}&opendiscussion={}".format(json.dumps(data, ensure_ascii=False), args.expire, args.format, int(args.burn), int(args.discus))
request = {'data':json.dumps(data, ensure_ascii=False),'expire':args.expire,'formatter':args.format,'burnafterreading':int(args.burn),'opendiscussion':int(args.discus)
}
print(request)
'''Here we must run function post from pbincli.transports'''
print(request)
privatebin().post(request)

4
pbincli/transports.py

@ -1,7 +1,7 @@ @@ -1,7 +1,7 @@
import requests
import json
import urllib
from pprint import pprint
class privatebin(object):
def __init__(self):
@ -13,4 +13,4 @@ class privatebin(object): @@ -13,4 +13,4 @@ class privatebin(object):
r = requests.post(url=self.server, headers=self.headers, proxies=self.proxies, data=data)
print(r.request)
print(r.status_code)
print(r.text)
print(r.text)

Loading…
Cancel
Save