Plugin into a server

Gordon McMillan gmcm at hypernet.com
Wed Feb 16 17:16:33 CET 2000


Szilveszter Juhos writes:
> I want to install new executable objects into a server (running on a 
> remote machine) with a client like:
> 
> class Printer:
>   """
>   This class should run on the SERVER side
>   """
>   def Run(self):
>     print 'dummy message'
> 
> theClient = Connector()
> theClient.SendObject(Printer(),'cmd')
> del theClient
> 
> The idea is that the Connector class implements the interface between the
> server and the client. When I send an object with attribute 'cmd', the
> server side will accept it as an executable object at the server side. I
> can easily trasfer data, but not executable. It is obvious from the
> documentation that pickling/marshaling will not work (at least I could not
> find a way), but what is the way than to send executable objects across
> network? 

Cheap answer: yes, you can use marshal (on the code 
object), or simply transmit source.

Better answer: Think again. It will be very difficult to write code 
on the client that will do anything useful on the server (eg, a 
"print" statement will end up buried in a server log 
somewhere). It will be easy to write code that screws up the 
server accidentally. It will be trivial for a malicious hacker to 
leave your server in ruins.

- Gordon




More information about the Python-list mailing list