return result except: try: exec(code, env) except: sys.stdout = __stdout import traceback buff = StringIO() traceback.print_exc(file=buff) #don't show rpc stack stack = buff.getvalue().replace('"<string>"', '"<JSON-RPC>"').split('\n') return '\n'.join([stack[0]] + stack[3:]) else: sys.stdout = __stdout msg = check_env(env, modules) if msg: return msg open(session_file, 'a+').write('\n%s' % code) return fake_stdout.getvalue() def destroy(self, session_id): os.remove('session_%s.py' % session_id) #from time import sleep #sleep(4) handle_cgi(Interpreter())
return result except: try: exec(code, env) except: sys.stdout = __stdout import traceback buff = StringIO() traceback.print_exc(file=buff) #don't show rpc stack stack = buff.getvalue().replace('"<string>"', '"<JSON-RPC>"').split('\n') return '\n'.join([stack[0]] + stack[3:]) else: result = sys.stdout.getvalue() sys.stdout = __stdout open(session_file, 'a+').write('\n%s' % code) return result def destroy(self, session_id): os.remove('../tmp/session_%s.py' % session_id) if __name__ == '__main__': if valid_token(): json.handle_cgi(Interpreter()) else: print "Content-Type: application/json" print print json.serialize({"error": message})
return result except: try: exec (code, env) except: sys.stdout = __stdout import traceback buff = StringIO() traceback.print_exc(file=buff) # don't show rpc stack stack = buff.getvalue().replace('"<string>"', '"<JSON-RPC>"').split("\n") return "\n".join([stack[0]] + stack[3:]) else: result = sys.stdout.getvalue() sys.stdout = __stdout open(session_file, "a+").write("\n%s" % code) return result def destroy(self, session_id): os.remove("../tmp/session_%s.py" % session_id) if __name__ == "__main__": if valid_token(): json.handle_cgi(Interpreter()) else: print "Content-Type: application/json" print print json.serialize({"error": message})
result += str(ret) return result except: try: exec(code, env) except: sys.stdout = __stdout import traceback buff = StringIO() traceback.print_exc(file=buff) #don't show rpc stack stack = buff.getvalue().replace('"<string>"', '"<JSON-RPC>"').split('\n') return '\n'.join([stack[0]] + stack[3:]) else: sys.stdout = __stdout msg = check_env(env, modules) if msg: return msg open(session_file, 'a+').write('\n%s' % code) return fake_stdout.getvalue() def destroy(self, session_id): os.remove('session_%s.py' % session_id) #from time import sleep #sleep(4) handle_cgi(Interpreter())