#!/usr/bin/env bash ########################################################################### ## Copyright (C) Wizardry and Steamworks 2025 - License: MIT ## ########################################################################### # define default parameters [ -z "$TOR_SOCKS_PORT" ] && TOR_SOCKS_PORT='0.0.0.0:9050' [ -z "$TOR_HTTP_TUNNEL_PORT" ] && TOR_HTTP_TUNNEL_PORT='0.0.0.0:9055' [ -z "$TOR_DNS_PORT" ] && TOR_DNS_PORT='0.0.0.0:9053' [ -z "$CHECK_CIRCUIT_PORT" ] && CHECK_CIRCUIT_PORT='0.0.0.0:7050' [ -z "$USE_BRIDGES" ] && USE_BRIDGES=1 #--Log "notice stdout" # launch tor from command line TOR_RUN=( /usr/local/bin/tor --Log "notice stdout" --SocksPort $TOR_SOCKS_PORT --HTTPTunnelPort $TOR_HTTP_TUNNEL_PORT --RunAsDaemon 0 --DataDirectory /run/tor/data/ --ControlPort 8050 --HashedControlPassword 16:9F840FFC85EF83CE60469C431DC9FF43DB889305B7653C2CB653302594 --SocksPolicy "accept *" --VirtualAddrNetwork 10.192.0.0/10 --AutomapHostsOnResolve 1 --AutomapHostsSuffixes .exit,.onion --DNSPort $TOR_DNS_PORT --UseBridges $USE_BRIDGES --ClientTransportPlugin "snowflake exec /usr/local/bin/snowflake-client -log /dev/stdout" --Bridge "snowflake 192.0.2.3:80 2B280B23E1107BB62ABFC40DDCC8824814F80A72 fingerprint=2B280B23E1107BB62ABFC40DDCC8824814F80A72 url=https://1098762253.rsc.cdn77.org/ fronts=www.cdn77.com,www.phpmyadmin.net ice=stun:stun.l.google.com:19302,stun:stun.antisip.com:3478,stun:stun.bluesip.net:3478,stun:stun.dus.net:3478,stun:stun.epygi.com:3478,stun:stun.sonetel.com:3478,stun:stun.uls.co.za:3478,stun:stun.voipgate.com:3478,stun:stun.voys.nl:3478 utls-imitate=hellorandomizedalpn" --Bridge "snowflake 192.0.2.4:80 8838024498816A039FCBBAB14E6F40A0843051FA fingerprint=8838024498816A039FCBBAB14E6F40A0843051FA url=https://1098762253.rsc.cdn77.org/ fronts=www.cdn77.com,www.phpmyadmin.net ice=stun:stun.l.google.com:19302,stun:stun.antisip.com:3478,stun:stun.bluesip.net:3478,stun:stun.dus.net:3478,stun:stun.epygi.com:3478,stun:stun.sonetel.net:3478,stun:stun.uls.co.za:3478,stun:stun.voipgate.com:3478,stun:stun.voys.nl:3478 utls-imitate=hellorandomizedalpn" ) # use a configuration file if it exists [[ -f "/run/tor/config/torrc" ]] && TOR_RUN+=("-f" "/run/tor/config/torrc") # run tor with all arguments "${TOR_RUN[@]}" & # 0x80004005 when temporary directory is not writeable (/run should be tmpfs) export TMPDIR=/run # circuit checker for tor (queryable via $CHECK_CIRCUIT_PORT) /usr/local/bin/CheckCircuit \ -l $CHECK_CIRCUIT_PORT \ -c 127.0.0.1:8050 \ -p tor \ & # wait for any process to terminate wait -n