python - Simple explanation of security issues related to input() vs raw_input() -
i reading python 2.7 tutorial , they're going on raw_input(), , mentions that:
the input() function try convert things enter if python code, has security problems should avoid it.
i tried googling explanations this, still bit unclear me; what's simple explanation of alleged inherent security issues input() vs raw_input() ?
the input() function in python 2.x evaluates things before returning.
so example can take @ -
>>> input("enter : ") enter : exit() this cause program exit (as evaluate exit()).
another example -
>>> input("enter else :") enter else :__import__("os").listdir('.') ['.gtkrc-1.2-gnome2', ...] this list out contents of current directory , can use functions such os.chdir() , os.remove() , os.removedirs() , os.rmdir()
Comments
Post a Comment