Important: In the example, "wlan0" is specified. Depending on the network interface, you may need to change this.
iwconfig
ip link set wlan0 down
sudo apt install macchanger
nohup bash -c 'while true; do
ip link set wlan0 down
macchanger -r wlan0 > /dev/null 2>&1
ip link set wlan0 up
sleep 600
done' > /dev/null 2>&1 &
ps aux | grep macchanger
kill process_id (e.g 1234)
- More information: https://www.kali.org/tools/macchanger/
iw dev wlan0 set type monitor
ip link set wlan0 up
- Install Tor (if not installed):
sudo apt update
sudo apt install tor -y
- Start the Tor service:
sudo service tor start
- To check that Tor is working properly:
sudo service tor status
We will configure a system-wide routing using iptables to route all your internet traffic through the Tor network.
sudo nano /etc/tor/torrc
AutomapHostsOnResolve 1
TransPort 9040
DNSPort 53
- This will redirect Tor's DNS requests and general network traffic. Save the file and exit (CTRL+O, Enter, CTRL+X).
sudo iptables -t nat -A OUTPUT -m owner ! --uid-owner debian-tor -p tcp --dport 9050 -j REDIRECT --to-port 9040
sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 9040
sudo iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-port 9040
sudo iptables -A OUTPUT -m owner ! --uid-owner debian-tor -d 127.0.0.0/8 -j REJECT
sudo iptables -A OUTPUT -m owner ! --uid-owner debian-tor -d 0.0.0.0/8 -j REJECT
- These rules will direct all TCP traffic to Tor's forwarded ports (9040) and block traffic outside of Tor.
sudo sh -c 'iptables-save > /etc/iptables/rules.v4'
curl --socks5 127.0.0.1:9050 https://check.torproject.org
- If you are connecting through Tor, you should see the message "Congratulations. This browser is configured to use Tor."
sudo iptables -A OUTPUT -m owner ! --uid-owner debian-tor -d 127.0.0.1 -j REJECT
- This command will prevent your system from connecting to the internet when the Tor service is not running.
- Install Proxychains:
sudo apt install proxychains -y
- Configure Proxychains settings:
sudo nano /etc/proxychains.conf
- In the configuration file, make sure the following line is set correctly:
socks4 127.0.0.1 9050
- Save and exit the file (use CTRL + O, press Enter, and CTRL + X).
- To run an application through the Tor network using Proxychains, use the following command:
proxychains firefox
sudo service tor stop
sudo iptables -t nat -F
sudo iptables -F
sudo nano /etc/proxychains.conf
-
Delete or comment out the line socks4 127.0.0.1 9050.
-
Save the file and exit.
curl https://check.torproject.org
- Route all traffic through the Tor network may cause problems for some applications, as Tor may not be suitable for some services (for example, tasks that require very high speeds). Tor is very effective for providing anonymity and privacy, but it is not 100% secure. You should be careful when using Tor and take additional precautions for anonymity. The Tor network may be restricted in some countries, in which case you can use alternative tools such as VPN to access Tor.