3 # Wrapper script for use of the tsocks(8) transparent socksification library
4 # See the tsocks(1) and torify(1) manpages.
6 # Copyright (c) 2004, 2006, 2009 Peter Palfrader
7 # Modified by Jacob Appelbaum <jacob@appelbaum.net> April 16th 2006
8 # May be distributed under the same terms as Tor itself
10 # taken from Debian's Developer's Reference, 6.4
15 if [ -x "$p/$*" ]; then
24 # Check for any argument list
26 echo "Usage: $0 [-hv] <command> [<options>...]" >&2
30 if [ "$#" = 1 ] && ( [ "$1" = "-h" ] ||
[ "$1" = "--help" ] ); then
31 echo "Usage: $0 [-hv] <command> [<options>...]"
35 if [ "$1" = "-v" ] ||
[ "$1" = "--verbose" ]; then
42 if pathfind torsocks
; then
43 ! [ "$verbose" -ge 1 ] ||
echo "Using torsocks as socksifier." >&2
46 echo "$0: Failed to exec torsocks $@" >&2
49 elif pathfind tsocks
; then
50 ! [ "$verbose" -ge 1 ] ||
echo "Using tsocks as socksifier." >&2
52 # Define our tsocks config file
53 TSOCKS_CONF_FILE
="/etc/tor/tor-tsocks.conf"
54 export TSOCKS_CONF_FILE
56 # Check that we've got a tsocks config file
57 if [ -r "$TSOCKS_CONF_FILE" ]
59 echo "WARNING: tsocks is known to leak DNS and UDP data. If you had torsocks we would use that." >&2
61 echo "$0: Failed to exec tsocks $@" >&2
64 echo "$0: Missing tsocks configuration file \"$TSOCKS_CONF_FILE\"." >&2
69 echo "$0: Can't find either tsocks or torsocks in your PATH. Perhaps you haven't installed either?" >&2