diff options
Diffstat (limited to 'module/remote/RequestHandler.py')
-rw-r--r-- | module/remote/RequestHandler.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/module/remote/RequestHandler.py b/module/remote/RequestHandler.py index 212f65b1c..ec0bf0414 100644 --- a/module/remote/RequestHandler.py +++ b/module/remote/RequestHandler.py @@ -8,29 +8,27 @@ this module handels the incoming requests """ import base64 +import hashlib import random import string import cPickle -from Crypto.Cipher import AES -from Crypto.Hash import MD5 -from Crypto.Hash import SHA +from Crypto.Cipher import Blowfish from RequestObject import RequestObject class RequestHandler: def __init__(self, core): self.core = core - key = SHA.new("pwhere") #core.config['remotepassword'] - key = MD5.new(key.hexdigest()) - self.aes = AES.new(key.hexdigest(), AES.MODE_ECB) + key = hashlib.sha256("pwhere") #core.config['remotepassword'] + self.bf = Blowfish.new(key.hexdigest(), Blowfish.MODE_ECB) def proceed(self, data): obj = self.decrypt(data) if obj.command == "exec": func = getattr(self.core, obj.function) - obj.response = func(*obj.args) + obj.response = func( * obj.args) else: obj.response = "error happend" @@ -40,7 +38,7 @@ class RequestHandler: def decrypt(self, dec_str): try: dec_str = base64.standard_b64decode(dec_str) - dec_str = self.aes.decrypt(dec_str) + dec_str = self.bf.decrypt(dec_str) dec_str = dec_str[:-(int(dec_str[-1], 16) + 1)] obj = cPickle.loads(dec_str) @@ -60,7 +58,7 @@ class RequestHandler: p_str += hex(len(p_str)).replace("0x", "") enc_str += p_str - enc_str = self.aes.encrypt(enc_str) + enc_str = self.bf.encrypt(enc_str) enc_str = base64.standard_b64encode(enc_str) return enc_str |