summaryrefslogtreecommitdiffstats
path: root/module/remote
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-06-08 12:23:28 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2009-06-08 12:23:28 +0200
commit7b6a6cb94c8c2abc449351a1238227f9b10b0872 (patch)
treecc419ba50b1cbab369949c0be45ccc2e82c57dba /module/remote
parentFixed the YouPorn.com Plugin (diff)
downloadpyload-7b6a6cb94c8c2abc449351a1238227f9b10b0872.tar.xz
core able to push data to gui, proxy support: closed #1
Diffstat (limited to 'module/remote')
-rw-r--r--module/remote/RequestHandler.py4
-rw-r--r--module/remote/RequestObject.py3
-rw-r--r--module/remote/SocketServer.py17
3 files changed, 21 insertions, 3 deletions
diff --git a/module/remote/RequestHandler.py b/module/remote/RequestHandler.py
index f7623d27b..2f6f248bd 100644
--- a/module/remote/RequestHandler.py
+++ b/module/remote/RequestHandler.py
@@ -28,7 +28,7 @@ class RequestHandler:
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"
@@ -54,7 +54,7 @@ class RequestHandler:
p_str = ""
for i in range(padding - 1):
- p_str += random.choice(string.letters + string.digits)
+ p_str += random.choice(string.letters + string.digits + string.punctuation)
p_str += hex(len(p_str)).replace("0x", "")
enc_str += p_str
diff --git a/module/remote/RequestObject.py b/module/remote/RequestObject.py
index 7080a6faf..c5786061b 100644
--- a/module/remote/RequestObject.py
+++ b/module/remote/RequestObject.py
@@ -13,4 +13,5 @@ class RequestObject(object):
self.command = None
self.function = ""
self.args = []
- self.response = "" \ No newline at end of file
+ self.response = None
+ self.data = None \ No newline at end of file
diff --git a/module/remote/SocketServer.py b/module/remote/SocketServer.py
index c519d8a3b..e5932bb6e 100644
--- a/module/remote/SocketServer.py
+++ b/module/remote/SocketServer.py
@@ -24,6 +24,20 @@ class ServerThread(threading.Thread):
asyncore.loop()
print "loop closed"
+ def sockets(self):
+ """returns all connected sockets in a list"""
+ sockets = []
+ for value in asyncore.socket_map.values():
+ if SecondaryServerSocket == value.__class__:
+ sockets.append(value)
+
+ return sockets
+
+ def push_all(self, obj):
+ """push obj to all sockets"""
+ for socket in self.sockets():
+ socket.push_obj(obj)
+
class MainServerSocket(asyncore.dispatcher):
def __init__(self, port, pycore):
@@ -61,3 +75,6 @@ class SecondaryServerSocket(asynchat.async_chat):
def handle_close(self):
print "Disconnected from", self.getpeername()
self.close()
+ def push_obj(self, obj):
+ obj = self.handler.encrypt(obj)
+ self.push(obj)