[Python-Dev] Syscall Proxying in Python
Gabriel Becedillas
gabriel.becedillas at corest.com
Mon Aug 1 19:36:42 CEST 2005
Hi,
We embbeded Python 2.0.1 in our product a few years ago and we'd like to
upgrade to Python 2.4.1. This was not a simple task, because we needed
to execute syscalls on a remote host. We modified Python's source code
in severall places to call our own versions of some functions. For
example, instead of calling fopen(...), the source code was modified to
call remote_fopen(...), and the same was done with other libc functions.
Socket functions where hooked too (we modified socket.c), Windows
Registry functions, etc..
There are some syscalls that we don't want to execute remotely. For
example when importing a module. That has to be local, and we didn't
modified that.
Python scripts are executed locally, but syscalls are executed on a
remote host, thus giving the illusion that the script is executing on
the remote host.
As I said before, we're in the process of upgrading and we don't want to
make such unmaintainable changes to Python's code. We'd like to make as
few changes as possible. The aproach we're trying this time is far less
intrusive: We'd like to link Python with special libraries that override
those functions that we want to execute remotely. This way the only code
that has to be changed is the one that has to be executed locally.
I wrote this mail to ask you guys for any useful advice in making this
changes to Python's core. The only places I figure out right now that
have to execute locally all the time are import.c and pythonrun.c, but
I'm not sure at all.
Maybe you guys figure out another way to achieve what we need.
Thanks in advance.
--
Gabriel Becedillas
Developer
CORE SECURITY TECHNOLOGIES
Florida 141 - 2º cuerpo - 7º piso
C1005AAC Buenos Aires - Argentina
Tel/Fax: (54 11) 5032-CORE (2673)
http://www.corest.com
More information about the Python-Dev
mailing list