update for testing purposes

This commit is contained in:
r4sas
2017-02-19 23:27:37 +03:00
parent 6274f8016a
commit e7f3610fdb
5 changed files with 28 additions and 19 deletions

View File

@@ -12,24 +12,28 @@ from zlib import compress
def send(args):
""" Sub-command for sending paste """
check_readable(args.filename)
with open(args.filename, "rb") as f:
contents = f.read()
file = b64encode(compress(contents))
#check_readable(args.filename)
#with open(args.filename, "rb") as f:
# contents = f.read()
#file = b64encode(compress(contents))
data = b'Test!'
passphrase = os.urandom(32)
print("Passphrase: {}".format(passphrase))
#print("Passphrase: {}".format(passphrase))
if args.password:
#print("Password: {}".format(password))
p = SHA256.new()
p.update(args.password.encode("UTF-8"))
passphrase = passphrase + p.hexdigest().encode("UTF-8")
print("Password: {}".format(password))
print(args.password)
'''data = SJCL().encrypt(file, password.decode("UTF-8"))'''
data = pbincli.sjcl_simple.encrypt(password, file)
request = {'data':json.dumps(data, ensure_ascii=False),'expire':args.expire,'formatter':args.format,'burnafterreading':int(args.burn),'opendiscussion':int(args.discus)
#data = SJCL().encrypt(file, password.decode("UTF-8"))
"""Sending text from 'data' string"""
#cipher = pbincli.sjcl_simple.encrypt(b64encode(passphrase), file)
cipher = pbincli.sjcl_simple.encrypt(b64encode(passphrase), data)
request = {'data':json.dumps(cipher, 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'''
privatebin().post(request, passphrase)
'''Here we run function post from pbincli.transports'''
privatebin().post(request, b64encode(passphrase))