AppsNewssecurityTermux

How to Install and Use Tor on Termux for Android

How can Tor be installed and used on Android phones with Termux? What is Tor? Tor is a free network of computers or nodes that randomly route internet data among themselves so that it is unclear where the source of that information is. To put it simply, Tor is a network that helps hide users’ sensitive data such as IP addresses and location while browsing the internet, thereby helping to protect their privacy. Termux is a powerful tool in the technology world that allows you to experience Linux on your mobile phone. This article will introduce Termux and its practical uses.

How to Install and Use Tor on Termux for Android

Before we can use Tor, it is necessary to install it on Termux. If you have not downloaded Termux yet or are not familiar with it, click on what is Termux in the article. To start, install Termux from Google Play and run it.

Execute the following commands one by one in Termux to install some things we need.

To start, first, you must make sure that you have installed the correct version of Termux on your phone. You also need to ensure that the stable packages are installed as well. To do this, run the following commands:

apt update && apt upgrade
packages Termux

If you receive the [Y/N] message, press the Y key on your keyboard.

In the next step, you also need to enter the following commands:

apt install tor
apt install nano
Install and Use Tor on Termux

After entering the commands above, now install Privoxy with the following command:

apt install privoxy

However, if you do not use Twitter, you do not need to install Privoxy.

After the installation process is complete, execute the following command to start the Tor service:

tor
image 11
  • To activate Tor, execute the following command:
tor service start
  • To check the status of Tor, execute the following command:
tor service status
  • If Tor has been successfully installed and activated, the output of the Tor service status command will be as follows:
or.service - The Onion Router
   Loaded: loaded (/etc/systemd/system/tor.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2024-02-24 17:22:54 EST; 3s ago
 Main PID: 3426 (tor)
   Tasks: 1 (limit: 1154)
   CGroup: /system/fs/cgroup/systemd/tor.service
           ├─3426 /usr/bin/tor -f /etc/tor/torrc
           └─3424 /usr/bin/tor-gencert --create-identity-file /etc/tor/torrc --passphrase ''

Feb 24 17:22:54 termux systemd[1]: Starting The Onion Router...
Feb 24 17:22:54 termux systemd[1]: Started The Onion Router.

By completing these steps, Tor will be installed and ready for use on Termux.

Methods for configuring applications to use Tor:

Using Proxychains:

Steps: Install Proxychains:

pkg install proxychains-ng

Edit the Proxychains configuration file:

nano $PREFIX/etc/proxychains.conf

At the end of the file, add the following lines:

tor 127.0.0.1 9050
http 127.0.0.1 9050
https 127.0.0.1 9050

Save and close the file.

Using Proxychains:

Before any application that you want to run through Tor, execute the following command: proxychains4

Example:

proxychains4 firefox

Using application proxy settings:

  • Open your application.
  • Go to the application’s proxy settings.
  • Set the proxy address to 127.0.0.1 and the port to 9050.

Torsocks:

Install Torsocks:

pkg install torsocks
Install Torsocks

Run your desired application with Torsocks:

torsocks firefox

Torsocks is a tool that allows you to run applications through Tor. To use Torsocks, you must enter the command torsocks before the application name.

Example:

torsocks curl https://check.torproject.org/

To use Tor, you need to configure your applications to connect through the Tor proxy.

Checking Tor connection:

curl -s https://check.torproject.org/exit-addresses If the output includes "Your IP address is not publicly visible," Tor is correctly connected.

Installing obfs4proxy

obfs4proxy is a tool to conceal your Tor traffic. To install it, execute the following command:

pkg install obfs4proxy

Now, you need to obtain Bridges to enter the network through them. Send an email with the content get transport obfs4 to [email protected] and wait for a response.

Now, we need to input the bridges we have obtained into the torrc file. You can go to the desired path with your phone’s file manager and edit torrc, or you can do this with nano, which is an editor in the terminal environment:

nano /data/data/com.termux/files/usr/etc/tor/torrc

Add the following content at the end of the file. Note that you should use the Bridge obfs4 exactly as emailed to you.

To save the file in nano, use the combination Ctrl + X. After confirming (y), the file will be saved.

UseBridges 1
ClientTransportPlugin obfs4 exec /data/data/com.termux/files/usr/bin/obfs4proxy
Bridge obfs4 *** *** *** ***
Bridge obfs4 *** *** *** ***

Finally, in termux, run tor once and wait to see 100% and connect to the network. Obtain new Bridges every so often to maintain access. Note that different ISPs might block Tor.

In various applications, if there are proxy settings, you can use Tor with 127.0.0.1:9050. Otherwise, there are apps that change the system’s entire proxy. However, in this case, the phone must be rooted.

keleis andre

Keleis Andre is A tech writer specialising in cybersecurity expert, author, and Manager at SPY24 Company. On this and several other GDPR, MDR, and ethical hacking projects. Hacking, Social Engineering, and Security Awareness Training: My goal is to educate, inform and entertain as I write about my journeys in the tech and cyber space.

Leave a Reply

Your email address will not be published. Required fields are marked *