summaryrefslogtreecommitdiffstats
path: root/sockettest.py
diff options
context:
space:
mode:
authorGravatar spoob <spoob@gmx.de> 2009-06-18 15:05:25 +0200
committerGravatar spoob <spoob@gmx.de> 2009-06-18 15:05:25 +0200
commitb82662e8c9ac9ff0047f75a04f350dc880eb330f (patch)
tree037c5d1784a0321da92e75c3cfd3ee4f2957ea60 /sockettest.py
parentplugin for gigasize (diff)
downloadpyload-b82662e8c9ac9ff0047f75a04f350dc880eb330f.tar.xz
worked on gigasize.com Plugin
Diffstat (limited to 'sockettest.py')
-rw-r--r--sockettest.py79
1 files changed, 0 insertions, 79 deletions
diff --git a/sockettest.py b/sockettest.py
deleted file mode 100644
index ee0053b11..000000000
--- a/sockettest.py
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/usr/bin/env python
-# -'- coding: utf-8 -*.
-"""
-authored by: RaNaN
-
-script only for socket testing
-
-"""
-import base64
-import hashlib
-import random
-import string
-import time
-
-import cPickle
-from Crypto.Cipher import Blowfish
-from module.remote.RequestObject import RequestObject
-from module.remote.ClientSocket import SocketThread
-
-class Handler:
- def __init__(self):
- key = hashlib.sha256("pwhere")
- print key.hexdigest()
- self.bf = Blowfish.new(key.hexdigest(), Blowfish.MODE_ECB)
-
- def proceed(self, data):
-
- return self.decrypt(self.encrypt(str(("lol", "mehrlol", "pff"))))
-
- def decrypt(self, dec_str):
- try:
- dec_str = base64.standard_b64decode(dec_str)
- dec_str = self.bf.decrypt(dec_str)
-
- dec_str = dec_str[:-(int(dec_str[-1], 16) + 1)]
- obj = cPickle.loads(dec_str)
- except:
- obj = None
- return obj
-
- def encrypt(self, obj):
- enc_str = cPickle.dumps(obj, 1)
- padding = len(enc_str) % 16
- padding = 16 - padding
-
- p_str = ""
- for i in range(padding - 1):
- p_str += random.choice(string.letters + string.digits)
- p_str += hex(len(p_str)).replace("0x", "")
- enc_str += p_str
-
- enc_str = self.bf.encrypt(enc_str)
- enc_str = base64.standard_b64encode(enc_str)
- return enc_str
-
-
-
-import socket
-
-handler = Handler()
-sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
-sock.connect(('localhost', 7272))
-th = SocketThread(sock)
-#th.socket.connect(('localhost', 7272))
-print "Connected to server"
-
-obj = RequestObject()
-obj.command = "exec"
-obj.function = "get_downloads"
-
-data = handler.encrypt(obj)
-print "going to push", data
-th.socket.push(data + "\n")
-#response = sock.recv(8192)
-
-#print "Received:", handler.decrypt(response).response
-#sock.close()
-while True:
- sleep(10000) \ No newline at end of file