Re: Pasar string a valor

Jesus Cea <[email protected]> Wed, 05 May 2010 15:49:02 +0200
Newsgroups gmane.comp.python.general.castellano
Message-ID <[email protected]>
--===============1853220426==
Content-Type: text/plain; charset=ISO-8859-15
Content-Transfer-Encoding: quoted-printable

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/05/10 15:36, Arnau Sanchez wrote:
> print math_eval("int(43 + sin(-pi/2))")
> # 42
> print math_eval("open('/etc/passwd').read()")
> # NameError

Bueno, como m=EDnimo puedes hacer un bucle infinito, colgando el programa=
.

Y luego hay cosas curiosas como:

>>> dir(math.acos.__module__)
['__add__', '__class__', '__contains__', '__delattr__', '__doc__',
'__eq__', '__format__', '__ge__', '__getattribute__', '__getitem__',
'__getnewargs__', '__getslice__', '__gt__', '__hash__', '__init__',
'__le__', '__len__', '__lt__', '__mod__', '__mul__', '__ne__',
'__new__', '__reduce__', '__reduce_ex__', '__repr__', '__rmod__',
'__rmul__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__',
'_formatter_field_name_split', '_formatter_parser', 'capitalize',
'center', 'count', 'decode', 'encode', 'endswith', 'expandtabs', 'find',
'format', 'index', 'isalnum', 'isalpha', 'isdigit', 'islower',
'isspace', 'istitle', 'isupper', 'join', 'ljust', 'lower', 'lstrip',
'partition', 'replace', 'rfind', 'rindex', 'rjust', 'rpartition',
'rsplit', 'rstrip', 'split', 'splitlines', 'startswith', 'strip',
'swapcase', 'title', 'translate', 'upper', 'zfill']

Osea, aunque pasas un n=FAmero limitado de objetos hacia dentro, alguno d=
e
ellos te puede dar acceso a m=E1s cosas, de forma indirecta.

Por favor, movamos la discusi=F3n a la nueva lista. S=F3lo he comentado a=
qu=ED
porque la soluci=F3n propuesta no soluciona por completo el problema de
seguridad. Cuidad=EDn.

- --=20
Jesus Cea Avion                         _/_/      _/_/_/        _/_/_/
[email protected] - http://www.jcea.es/     _/_/    _/_/  _/_/    _/_/  _/_/
jabber / xmpp:[email protected]         _/_/    _/_/          _/_/_/_/_/
.                              _/_/  _/_/    _/_/          _/_/  _/_/
"Things are not so easy"      _/_/  _/_/    _/_/  _/_/    _/_/  _/_/
"My name is Dump, Core Dump"   _/_/_/        _/_/_/      _/_/  _/_/
"El amor es poner tu felicidad en la felicidad de otro" - Leibniz
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQCVAwUBS+F3Tplgi5GaxT1NAQIPPgP/ZG7ywPheFlT0vDfP+MNE5b+nO2hjtEqK
oDo/Qwd3E0x5JR2BOQdUFOe25tcd6wX/O38zLYmZAaKS1hG9e1CU2DpXuYku7Ulb
ACWQbqvs4SP66yVf0MrFKZbrSD5ml3aMQrGKaRwt2FZ4IuOLal422Q3xxh/CnnVF
shKKTg9EbbI=3D
=3DZZgZ
-----END PGP SIGNATURE-----

--===============1853220426==
Content-Type: text/plain; charset="iso-8859-1"
MIME-Version: 1.0
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

_______________________________________________
Lista de correo Python-es =

http://listas.aditel.org/listinfo/python-es
FAQ: http://listas.aditel.org/faqpyes
--===============1853220426==--