Skip to content

Instantly share code, notes, and snippets.

@masterdesky
Created May 17, 2025 14:45
Show Gist options
  • Save masterdesky/08bd89888ac070d131aa7765291e84ee to your computer and use it in GitHub Desktop.
Save masterdesky/08bd89888ac070d131aa7765291e84ee to your computer and use it in GitHub Desktop.
Route wget traffic through Tor using torsocks
#!/usr/bin/env bash
# Route wget traffic through Tor using torsocks
# Usage: ./torwget.sh [wget-options] URL
if [ $# -ge 1 ]; then
>&2 echo "Usage: $0 [wget-options] URL"
exit 1
fi
if ! command -v torsocks &> /dev/null; then
>&2 echo "torsocks is not installed. Please install it first."
exit 1
fi
# Unset http(s) proxy envvars to avoid leaks
unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY
exec torsocks /usr/bin/wget --passive-ftp "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment