summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-05-29 00:16:22 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-05-29 00:16:22 +0200
commit5f1c75fd93af98a5d870424971f0383ac4614058 (patch)
treed0e3d5d00295cdd5c9f65a755254aced21a6ff68 /module
parentpremium and free download works with rapidshare (diff)
downloadpyload-5f1c75fd93af98a5d870424971f0383ac4614058.tar.xz
socket server basic
Diffstat (limited to 'module')
-rw-r--r--module/remote/RequestHandler.py29
-rw-r--r--module/remote/SocketServer.py15
2 files changed, 38 insertions, 6 deletions
diff --git a/module/remote/RequestHandler.py b/module/remote/RequestHandler.py
new file mode 100644
index 000000000..9964c90c0
--- /dev/null
+++ b/module/remote/RequestHandler.py
@@ -0,0 +1,29 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+"""
+authored by: RaNaN
+
+this module handels the incoming requests
+
+"""
+
+import base64
+from cPickle import Pickler
+from cStringIO import StringIO
+from Crypto.Cipher import AES
+
+
+class RequestHandler():
+ def __init__(self, core):
+ self.core = core
+ self.p = Pickler(string)
+ self.obj = AES.new('pw', AES.MODE_ECB)
+
+ def proceed(self, data):
+ return "the answer."
+
+ def decrypt(self, string):
+ string = string
+ buf = StringIO(string)
+
+
diff --git a/module/remote/SocketServer.py b/module/remote/SocketServer.py
index 4469f89ac..3635e16d8 100644
--- a/module/remote/SocketServer.py
+++ b/module/remote/SocketServer.py
@@ -10,6 +10,7 @@ import asynchat
import asyncore
import socket
import threading
+from RequestHandler import RequestHandler
class ServerThread(threading.Thread):
@@ -41,18 +42,20 @@ class MainServerSocket(asyncore.dispatcher):
class SecondaryServerSocket(asynchat.async_chat):
- def __init__(self, pycore, *args):
+ def __init__(self, socket, pycore):
print 'initing SSS'
- self.pycore = pycore
- asynchat.async_chat.__init__(self, *args)
- self.set_terminator('\n')
+ asynchat.async_chat.__init__(self, socket)
+ self.pycore = pycore
+ self.handler = RequestHandler(pycore)
+ self.set_terminator('\n')
self.data = []
def collect_incoming_data(self, data):
self.data.append(data)
def found_terminator(self):
- self.push("daten")
+ self.handler.proceed(self.data)
+ self.push(str(self.pycore.plugins_avaible))
self.data = []
#having fun with the data
def handle_close(self):
print "Disconnected from", self.getpeername()
- self.close() \ No newline at end of file
+ self.close()