Created
August 6, 2025 21:07
-
-
Save lanefu/888f56e451b7bac23e391a5328d658d4 to your computer and use it in GitHub Desktop.
quick socks5 proxy for kubernetes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
google-chrome \ | |
--user-data-dir="$HOME/ChromeSocksProfile" \ | |
--proxy-server="socks5://localhost:1080" \ | |
--host-resolver-rules="MAP * ~NOTFOUND, EXCLUDE localhost" \ | |
--no-first-run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -euo pipefail | |
NAMESPACE="default" | |
POD_NAME="pproxy-$(date +%s)" | |
LOCAL_PORT=1080 | |
echo "[*] Creating temporary SOCKS5 proxy pod: ${POD_NAME}..." | |
kubectl run "${POD_NAME}" \ | |
--image=python:3.11-slim \ | |
--restart=Never \ | |
--namespace "${NAMESPACE}" \ | |
--labels="app=pproxy" \ | |
--command -- \ | |
sh -c "pip install --quiet pproxy && pproxy -l socks5://0.0.0.0:1080" | |
echo "[*] Waiting for pod to be ready..." | |
kubectl wait --for=condition=Ready pod/"${POD_NAME}" --namespace "${NAMESPACE}" --timeout=60s | |
echo "[*] Starting port-forward: localhost:${LOCAL_PORT} -> pod/${POD_NAME}:1080..." | |
kubectl port-forward pod/"${POD_NAME}" ${LOCAL_PORT}:1080 --namespace "${NAMESPACE}" & | |
PF_PID=$! | |
cleanup() { | |
echo "[*] Cleaning up..." | |
kill $PF_PID || true | |
kubectl delete pod "${POD_NAME}" --namespace "${NAMESPACE}" --grace-period=0 --force | |
} | |
trap cleanup EXIT | |
echo "[✓] SOCKS5 proxy is running at socks5://localhost:${LOCAL_PORT}" | |
echo "[*] Press Ctrl+C to stop." | |
wait |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment