-
Notifications
You must be signed in to change notification settings - Fork 216
/
go.sh
executable file
·57 lines (44 loc) · 1.06 KB
/
go.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/bash
set -e
set -u
set -o pipefail
TORDIR=$HOME/tor/tor-dev
export PATH=$PATH:$TORDIR/src/or:$TORDIR/src/tools
# Check dependencies
dpkg -l git proxychains > /dev/null
# Install chutney locally
[ -e chutney ] || git clone https://git.torproject.org/chutney.git
# Remove previous setup
rm -rf chutney/net
# Configure new network
(cd chutney && ./chutney configure networks/basic)
# Amend generated torrc
cat <<EOF > torrc_patch
DisableDebuggerAttachment 0
TokenBucketRefillInterval 1 second
ServerDNSDetectHijacking 0
SocksTimeout 15 minutes
EOF
find chutney/net -name torrc -exec bash -c "cat torrc_patch >> {}" \;
# Most important: start the network
(cd chutney && ./chutney start networks/basic)
cat <<EOF > proxychains.conf
strict_chain
proxy_dns
tcp_read_time_out 180000
#quiet_mode
[ProxyList]
socks5 127.0.0.1 9008
EOF
# Wait until localhost responds via tor:
while [ 1 ]; do
set +e
proxychains curl http://127.0.0.1:22
R=$?
set -e
if [ "$R" == "0" ]; then
break
fi
done
# Clean up
(cd chutney && ./chutney stop networks/basic)