[Python-Dev] #! magic (original) (raw)
M.-A. Lemburg mal at egenix.com
Tue Jan 22 22:24:40 CET 2008
- Previous message: [Python-Dev] #! magic
- Next message: [Python-Dev] #! magic
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 2008-01-20 19:30, Christian Heimes wrote:
Yet another python executable could solve the issue, named "pythons" as python secure.
/* gcc -DNDEBUG -g -O2 -Wall -Wstrict-prototypes -IInclude -I. -pthread -Xlinker -lpthread -ldl -lutil -lm -export-dynamic -o pythons2.6 pythons.c libpython2.6.a */ #include "Python.h" int main(int argc, char **argv) { /* disable some possible harmful features */ PyIgnoreEnvironmentFlag++; PyNoUserSiteDirectory++; PyInteractiveFlag -= INTMAX; PyInspectFlag -= INTMAX; return PyMain(argc, argv); } $ ./pythons2.6 Python 2.6a0 (:59956M, Jan 14 2008, 22:09:17) [GCC 4.2.1 (Ubuntu 4.2.1-5ubuntu4)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
import sys sys.flags sys.flags(debug=0, py3kwarning=0, divisionwarning=0, divisionnew=0, inspect=-2147483647, interactive=-2147483647, optimize=0, dontwritebytecode=0, nousersite=1, nosite=0, ingnoreenvironment=1,
Is this a copy&paste error or a typo in the code ----^ ?
tabcheck=0, verbose=0, unicode=0)
To make this even more secure, you'd have to package this up together with a copy of the stdlib, but like mxCGIPython does (or did... I have to revive that project at some point :-):
http://www.egenix.com/www2002/python/mxCGIPython.html
-- Marc-Andre Lemburg eGenix.com
Professional Python Services directly from the Source (#1, Jan 22 2008)
Python/Zope Consulting and Support ... http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::
eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611
- Previous message: [Python-Dev] #! magic
- Next message: [Python-Dev] #! magic
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]