|
@@ -1,50 +1,33 @@
|
|
|
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
|
|
|
|
|
|
+os.chdir("/var/sandbox/sandbox-python")
|
|
|
|
|
|
-import json
|
|
|
-import os
|
|
|
+lib.DifySeccomp(65537, 1000, 1)
|
|
|
|
|
|
-import json
|
|
|
import sys
|
|
|
import traceback
|
|
|
-import os
|
|
|
+# setup sys.excepthook
|
|
|
+def excepthook(type, value, tb):
|
|
|
+ sys.stderr.write("".join(traceback.format_exception(type, value, tb)))
|
|
|
+ sys.stderr.flush()
|
|
|
+ sys.exit(-1)
|
|
|
|
|
|
-os.chdir("/var/sandbox/sandbox-python")
|
|
|
+sys.excepthook = excepthook
|
|
|
|
|
|
-lib.DifySeccomp(65537, 1001, 1)
|
|
|
+code = """
|
|
|
+import json
|
|
|
|
|
|
# declare main function here
|
|
|
def main() -> dict:
|
|
|
- original_strings_with_empty = ["apple", "", "cherry", "date", "", "fig", "grape", "honeydew", "kiwi", "", "mango", "nectarine", "orange", "papaya", "quince", "raspberry", "strawberry", "tangerine", "ugli fruit", "vanilla bean", "watermelon", "xigua", "yellow passionfruit", "zucchini"] * 5
|
|
|
-
|
|
|
- extended_strings = []
|
|
|
-
|
|
|
- for s in original_strings_with_empty:
|
|
|
- if s:
|
|
|
- repeat_times = 600
|
|
|
- extended_s = (s * repeat_times)[:3000]
|
|
|
- extended_strings.append(extended_s)
|
|
|
- else:
|
|
|
- extended_strings.append(s)
|
|
|
+ import requests
|
|
|
|
|
|
return {
|
|
|
- "result": extended_strings,
|
|
|
+ "result": requests.get("https://www.bilibili.com").text,
|
|
|
}
|
|
|
|
|
|
from json import loads, dumps
|
|
@@ -63,3 +46,5 @@ result = f'''<<RESULT>>
|
|
|
<<RESULT>>'''
|
|
|
|
|
|
print(result)
|
|
|
+"""
|
|
|
+exec(code)
|