Anonymous committed debee7b Draft

Quick and dirty allow remote peers

Useful for embedded devices to run a remote (debug) Python console
across a network. Completely unsafe with no security!

Comments (0)

Files changed (2)

     """Decorator to restrict handler method to local proxies only."""
     def _restrict_local(self, *args, **kwargs):
+        """
         if self._addr[0] != '':
             raise ValueError('Attempt to invoke method from remote address.')
+        """
         return foo(self, *args, **kwargs)
     return _restrict_local


 class ProxyConsole(code.InteractiveConsole):
     """Proxy interactive console to remote interpreter."""
-    def __init__(self, port=PORT):
+    def __init__(self, host=rfoo.LOOPBACK, port=PORT):
+ = host
         self.port = port
         self.conn = None
     def interact(self, banner=None):'Enter.')
-        self.conn = rfoo.InetConnection().connect(port=self.port)
+        self.conn = rfoo.InetConnection().connect(, port=self.port)
         return code.InteractiveConsole.interact(self, banner)
     def complete(self, phrase, state):
     thread.start_new_thread(_wrapper, ())
-def interact(banner=None, readfunc=None, port=PORT):
+def interact(banner=None, readfunc=None, host=rfoo.LOOPBACK, port=PORT):
     """Start console and connect to remote console server."""'Enter, port=%d.', port)
-    console = ProxyConsole(port)
+    console = ProxyConsole(host=host, port=port)
     if readfunc is not None:
         console.raw_input = readfunc