Commit 4e907aaf authored by Eduard Toloza's avatar Eduard Toloza

Improve performance and compatibility

parent 5b80ee78
#!/bin/bash
#!/bin/sh
# Script that automate the procces for setting up TOR as a tranparent proxy
# Autor: Edu4rdSHL @edu4rdshl
#Defining variables
istor=$(which tor 2> /dev/null)
istor=$(command -v tor > /dev/null)
torconfig="/etc/tor/torrc"
torconfigbackup="/etc/tor/torrc.backup"
issystemd=$(which systemctl 2> /dev/null)
executablerules="./files/tor-router"
servicefile="./files/tor-router.service"
iscurl=$(which curl 2> /dev/null)
issystemd=$(command -v systemctl > /dev/null)
executablerules="$PWD/files/tor-router"
servicefile="$PWD/files/tor-router.service"
iscurl=$(command -v curl > /dev/null)
#Check if the current user have root privileges
if [ "$UID" -ne "0" ] ; then
......@@ -19,34 +19,34 @@ fi
echo -e "Checking if TOR and Systemd are installed..."
if [ -x "$istor" ] && [ -f "$torconfig" ] && [ -x "$issystemd" ] ; then
echo -e "\nAll fundamentals tools are installed, proceding..."
echo -e "\nPLEASE, RUN IT SCRIPT ONLY A TIME, IF YOU RUN IT TWO OR MORE TIMES WILL CAUSE ISSUES WITH YOUR $torconfig FILE!"
echo -e "\nMaking a backup of your torrc file, if you have problems with the new configuration, delete $torconfig and move $torconfigbackup to $torconfig"
cp "$torconfig" "$torconfigbackup"
echo -e "\nConfiguring the torrc file to use TOR as a transparent proxy..."
echo -e "\n# Seting up TOR for transparent proxy\nVirtualAddrNetwork 10.192.0.0/10\nAutomapHostsOnResolve 1\nTransPort 9040\nDNSPort 5353" >> "$torconfig"
echo -e "\nCreating, enabling and starting the service file tor transparent proxy..."
cp "$executablerules" "/usr/bin/"
chmod +x "/usr/bin/tor-router"
cp "$servicefile" "/etc/systemd/system/"
systemctl enable tor-router.service && systemctl start tor-router.service
echo -e "\nEnabling and restarting the TOR daemon using systemctl..."
systemctl enable tor && systemctl restart tor
if [ "$?" == 0 ] ; then
echo -e "Checking if all are working..."
if [ -x "$iscurl" ] ; then
curl https://check.torproject.org/ | grep "Congratulations."
if [ "$?" == 0 ] ; then
echo -e "\nAll is OK, from now on all your network traffic is under the TOR Network, look for your IP addres in your browser."
exit
fi
else
echo -e "\nYou haven't curl installed, try opening https://check.torproject.org/ in your browser and look for 'Congratulations.'"
fi
else
echo -e "\nAn error as ocurrer, please open a issue in https://gitlab.com/Edu4rdSHL/tor-router/issues including log info and your Linux distribution."
fi
echo -e "\nAll fundamentals tools are installed, proceding..."
echo -e "\nPLEASE, RUN IT SCRIPT ONLY A TIME, IF YOU RUN IT TWO OR MORE TIMES WILL CAUSE ISSUES WITH YOUR $torconfig FILE!"
echo -e "\nMaking a backup of your torrc file, if you have problems with the new configuration, delete $torconfig and move $torconfigbackup to $torconfig"
cp "$torconfig" "$torconfigbackup"
echo -e "\nConfiguring the torrc file to use TOR as a transparent proxy..."
echo -e "\n# Seting up TOR for transparent proxy\nVirtualAddrNetwork 10.192.0.0/10\nAutomapHostsOnResolve 1\nTransPort 9040\nDNSPort 5353" >> "$torconfig"
echo -e "\nCreating, enabling and starting the service file tor transparent proxy..."
cp "$executablerules" "/usr/bin/"
chmod +x "/usr/bin/tor-router"
cp "$servicefile" "/etc/systemd/system/"
systemctl enable tor-router.service && systemctl start tor-router.service
echo -e "\nEnabling and restarting the TOR daemon using systemctl..."
systemctl enable tor && systemctl restart tor
if [ "$?" == 0 ] ; then
echo -e "Checking if all are working..."
if [ -x "$iscurl" ] ; then
curl https://check.torproject.org/ | grep "Congratulations."
if [ "$?" == 0 ] ; then
echo -e "\nAll is OK, from now on all your network traffic is under the TOR Network, look for your IP addres in your browser."
exit
fi
else
echo -e "\nYou haven't curl installed, try opening https://check.torproject.org/ in your browser and look for 'Congratulations.'"
fi
else
echo -e "\nAn error as ocurrer, please open a issue in https://gitlab.com/Edu4rdSHL/tor-router/issues including log info and your Linux distribution."
fi
else
echo -e "Systemd or TOR are not installed, the script dont work."
exit
echo -e "Systemd or TOR are not installed, the script dont work."
exit
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment