def myFunc(arg1, arg2):
print "This is a test with " + arg1 + " and " + arg2
while (input != "quit"):
input = raw_input("> ")
if input != "quit":
eval(input)
This code gives me a prompt, allowing me to invoke myFunc
with parameters I want. I know that eval
can be dangerous if a dictionary is not supplied, so I added this:
eval(input, {"__builtins__": {} }
Now I can no longer invoke myFunc
. How do I fix this without leaving eval
open to exploits?