Browse Source

transports started

pull/4/head
R4SAS 8 years ago
parent
commit
0343e318fb
  1. 5
      pbincli/actions.py
  2. 6
      pbincli/sjcl_gcm.py
  3. 16
      pbincli/transports.py
  4. 1
      requirements.txt

5
pbincli/actions.py

@ -4,6 +4,7 @@ import pbincli.actions @@ -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): @@ -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)

6
pbincli/sjcl_gcm.py

@ -133,11 +133,11 @@ class SJCL(object): @@ -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": "",

16
pbincli/transports.py

@ -0,0 +1,16 @@ @@ -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)

1
requirements.txt

@ -1 +1,2 @@ @@ -1 +1,2 @@
pycryptodome
requests
Loading…
Cancel
Save