-
Notifications
You must be signed in to change notification settings - Fork 0
/
torifier.sh
175 lines (124 loc) · 4.35 KB
/
torifier.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
#!/bin/bash
clear
echo "
████████╗ ██████╗ ██████╗ ██╗███████╗██╗███████╗██████╗
╚══██╔══╝██╔═══██╗██╔══██╗██║██╔════╝██║██╔════╝██╔══██╗
██║ ██║ ██║██████╔╝██║█████╗ ██║█████╗ ██████╔╝
██║ ██║ ██║██╔══██╗██║██╔══╝ ██║██╔══╝ ██╔══██╗
██║ ╚██████╔╝██║ ██║██║██║ ██║███████╗██║ ██║
╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝
"
sleep 0.5
echo "
Author: rock-dotcom (zappit)
Creation Date: 20/3-21 - modified 10/1-23
Description: Torproxy for Ubuntu and Debian Distros bash and zsh shell compatible.
"
#update environment credentials to avoid asking for credentials everytime
sudo -v
sleep 2
#Update system package
sudo apt update && sudo apt upgrade -f -y
sleep 0.5
clear
#Remove unneeded packages
sudo apt autoremove -f -y
sleep 0.5
clear
#install tor package
sudo apt install tor -f -y
sleep 0.2
clear
echo "Please set a password to protect your TOR connection:"
read -p "Enter password: " NEWPASS
sleep 1
#create config.txt file
sudo echo > config.txt
sleep 1
#update password in config.txt
sed -i -e"s/^pass=.*/pass=$NEWPASS/" config.txt
sleep 0.5
#hash the password
torpass=$(tor --hash-password '$NEWPASS')
sleep 2
clear
#append hashed password to torrc file
printf "HashedControlPassword $torpass\nControlPort 9051\n" | sudo tee -a /etc/tor/torrc
echo "Your connection is now secured with a password"
sleep 2
clear
echo "Restarting TOR to apply changes"
# Restarting tor service if it is running
if systemctl is-active --quiet tor; then
sudo systemctl restart tor
else
echo "tor service is not running, please check and start it"
fi
sleep 1
clear
echo "--------------------------------------------------------------
The torified shell will only persist for the current session.
If you open new terminals or reboot your PC, the shell will
default back to your ordinary connection.
Do you want to turn torsocks on permanently
for all new shell sessions and after reboot?
--------------------------------------------------------------
"
sleep 0.5
while true; do
read -p "Do you want to have shell persistancy y/n? " yn
case $yn in
[Yy]* )
echo "Turning torsocks on permanently"
sleep 2
#Both medthod for Enabling/Disabling added
# ->
torsocks off
source torsocks off
sleep 2
echo "Modifying ~/.bashrc - Please Wait"
echo ". torsocks on" >> ~/.bashrc
sleep 2
echo "Modifying ~/.zshrc - Please Wait"
echo ". torsocks on" >> ~/.zshrc
sleep 2
echo "Restarting TOR - Please Wait"
sudo systemctl restart tor
sleep 2
echo "Setting torsocks on - Please Wait"
sleep 2
#Both method for Enabling/Disabling added
# ->
torsocks on
source torsocks on
sleep 2
clear
break;;
[Nn]* )
clear
echo "You chose to set torsocks manually."
sleep 1
break ;;
* ) echo "Please answer yes or no.";;
esac
done
echo "--------------------------------------------------------------
Please use the following commands to activate/deactivate TOR:
$ source torsocks on
(( Tor mode activated ))
$ source torsocks off
(( Tor mode deactivated ))
"
#Checking IP outide the tor network
echo "Please wait, checking your ip outside the TOR network"
wget -qO - https://api.ipify.org; echo
sleep 0.25
#Checking IP inside the tor network
echo "Please wait, checking your TOR ip."
torsocks wget -qO - https://api.ipify.org; echo
sleep 0.25
echo " Thank you for using this script. "
echo " Have a great day! "
echo "--------------------------------------------------------------"
sleep 5
exit