#CPython 3, cracked by Veedrac
CPython 3, cracked by Veedrac
import sys,os,functools
if open(__file__).read().count("__""call__"):sys.exit()
def p(f,e,a,_=os._exit):
if e == "c_call":_(1)
sys.setprofile(p)
del sys.setprofile
(trailing newline at end)
A patch of my previous answer that used the profile hack. First, prematurely exits if the user's code contains __call__
(which can't be constructed dynamically, as getattr
would itself trigger the profile hook madness). Also, deletes sys.setprofile
for thoroughness. Generally same idea; you can do everything in Python, but nothing in C. Input to STDIN, output to STDOUT