import ctypes import os import sys import traceback # setup sys.excepthook def excepthook(type, value, tb): sys.stderr.write("".join(traceback.format_exception(type, value, tb))) sys.stderr.flush() sys.exit(-1) sys.excepthook = excepthook lib = ctypes.CDLL("./var/sandbox/sandbox-python/python.so") lib.DifySeccomp.argtypes = [ctypes.c_uint32, ctypes.c_uint32, ctypes.c_bool] lib.DifySeccomp.restype = None # get running path running_path = sys.argv[1] if not running_path: exit(-1) os.chdir(running_path) {{preload}} lib.DifySeccomp({{uid}}, {{gid}}, {{enable_network}}) {{code}}