12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- import ctypes
- import os
- import sys
- import json
- 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
- import json
- import os
- import json
- import sys
- import traceback
- import os
- os.chdir("/var/sandbox/sandbox-python")
- lib.DifySeccomp(65537, 1001, 1)
- # declare main function here
- def main() -> dict:
- import requests
- return {
- "result": "awdawd",
- }
- from json import loads, dumps
- from base64 import b64decode
- # execute main function, and return the result
- # inputs is a dict, and it
- inputs = b64decode('e30=').decode('utf-8')
- output = main(**json.loads(inputs))
- # convert output to json and print
- output = dumps(output, indent=4)
- result = f'''<<RESULT>>
- {output}
- <<RESULT>>'''
- print(result)
|