stay hidden
This commit is contained in:
commit
cac59a25b0
|
@ -0,0 +1,47 @@
|
|||
#!/bin/sh
|
||||
# Script that automate the procces for setting up TOR as a tranparent proxy
|
||||
# Autor: Abdennour.py
|
||||
|
||||
#Defining variables
|
||||
torconfig="/etc/tor/torrc"
|
||||
torconfigbackup="/etc/tor/torrc.backup"
|
||||
|
||||
|
||||
#Check if the current user have root privileges
|
||||
if [ "$UID" -ne "0" ] ; then
|
||||
echo -e "\nYou need root permisions to run it script."
|
||||
exit
|
||||
fi
|
||||
|
||||
echo -e "Checking if TOR and Systemd are installed..."
|
||||
if command -v tor >/dev/null && command -v systemctl > /dev/null ; then
|
||||
if grep -iq "# Seting up TOR transparent proxy for tor-router" "$torconfig" ; then
|
||||
echo -e "\ntor-router is already configured in $torconfig"
|
||||
else
|
||||
echo -e "\nAll fundamentals tools are installed, proceding..."
|
||||
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 transparent proxy for tor-router\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..."
|
||||
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 command -v curl >/dev/null ; 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."
|
||||
fi
|
||||
fi
|
||||
else
|
||||
echo -e "Systemd or TOR are not installed, the script dont work."
|
||||
exit
|
||||
fi
|
|
@ -0,0 +1,3 @@
|
|||
requests
|
||||
rich
|
||||
jsons
|
|
@ -0,0 +1,103 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
# Script By : Abdennour.py
|
||||
|
||||
import sys
|
||||
import os
|
||||
import requests
|
||||
import json
|
||||
import time
|
||||
from rich.console import Console
|
||||
console = Console()
|
||||
|
||||
# Tor Router Funcion :
|
||||
def main():
|
||||
os.system("clear")
|
||||
console.print("""
|
||||
_ _
|
||||
| | | |
|
||||
| |_ ___ _ __ ___ _ _| |_ ___ _ __
|
||||
| __/ _ \| '__/ _ \| | | | __/ _ \ '__|
|
||||
| || (_) | | | (_) | |_| | || __/ |
|
||||
\__\___/|_| \___/ \__,_|\__\___|_|
|
||||
""", style="bold green")
|
||||
console.print("🧅#####-Tool By Lucapy-#####🧅", style="bold green")
|
||||
print("\n")
|
||||
console.print(f"[+] Your IP Address ️️👁️: {net_status.ip}", style="bold magenta")
|
||||
# runing the service
|
||||
if net_status.status == True:
|
||||
console.print("[+] Connection Status : Connected ✅", style="bold green")
|
||||
console.print("[*] Do you want to connect again ?", style="bold cyan")
|
||||
console.print("*** [1] Yes / [2] No / [3] Disconnect ***", style="bold cyan")
|
||||
# choosing to connect again :
|
||||
res = input("[*] Enter Number : ")
|
||||
if res == "1":
|
||||
console.print("[+] Connecting again ...", style="bold magenta")
|
||||
anim()
|
||||
print("\n")
|
||||
os.system(conecting.cmd)
|
||||
net_status()
|
||||
console.print(f"[+] Your IP Address ️️👁️: {net_status.ip}", style="bold magenta")
|
||||
if net_status.status == True:
|
||||
console.print("[+] Connection Status : Connected ✅", style="bold green")
|
||||
exit()
|
||||
else :
|
||||
console.print("[*] Connection Status : Not Connected ❌", style="bold red")
|
||||
exit()
|
||||
|
||||
elif res == "3":
|
||||
console.print("[+] Disconnecting ...", style="bold red")
|
||||
anim()
|
||||
print("\n")
|
||||
os.system(disconecting.cmd)
|
||||
console.print("[*] Goodbye 👋", style="bold yellow")
|
||||
else :
|
||||
console.print("[*] Goodbye 👋", style="bold yellow")
|
||||
exit()
|
||||
# Starting the service :
|
||||
else :
|
||||
console.print("[+] Connection Status : Not Connected ❌", style="bold red")
|
||||
console.print("[*] Do you Want to Connect ??", style="bold cyan")
|
||||
console.print("*** [1] Yes / [2] No ***", style="bold cyan")
|
||||
choice = input("Enter Number : ")
|
||||
if choice == "1":
|
||||
console.print("[+] Connecting ...", style="bold magenta")
|
||||
anim()
|
||||
print("\n")
|
||||
os.system(conecting.cmd)
|
||||
net_status()
|
||||
console.print(f"[+] Your IP Address ️️👁️: {net_status.ip}", style="bold magenta")
|
||||
if net_status.status == True:
|
||||
console.print("[+] Connection Status : Connected ✅", style="bold green")
|
||||
exit()
|
||||
else :
|
||||
console.print("[*] Connection Status : Not Connected ❌", style="bold red")
|
||||
console.print("[*] Goodbye 👋", style="bold yellow")
|
||||
exit()
|
||||
else :
|
||||
console.print("[*] Goodbye 👋", style="bold yellow")
|
||||
exit()
|
||||
|
||||
# Cheking if Tor Service is on :
|
||||
def net_status():
|
||||
net_status.tor_req = requests.get("https://check.torproject.org/api/ip")
|
||||
net_status.ip = net_status.tor_req.json()['IP']
|
||||
net_status.status = net_status.tor_req.json()['IsTor']
|
||||
|
||||
def anim():
|
||||
animation = ["[■□□□□□□□□□]","[■■□□□□□□□□]", "[■■■□□□□□□□]", "[■■■■□□□□□□]", "[■■■■■□□□□□]", "[■■■■■■□□□□]", "[■■■■■■■□□□]", "[■■■■■■■■□□]", "[■■■■■■■■■□]", "[■■■■■■■■■■]"]
|
||||
for i in range(len(animation)):
|
||||
time.sleep(0.1)
|
||||
sys.stdout.write("\r" + animation[i % len(animation)])
|
||||
sys.stdout.flush()
|
||||
|
||||
def conecting():
|
||||
conecting.cmd = "doas systemctl restart tor && doas ./torouter-rules/tor-rules"
|
||||
|
||||
def disconecting():
|
||||
disconecting.cmd = "doas systemctl restart iptables && doas systemctl restart tor"
|
||||
|
||||
net_status()
|
||||
conecting()
|
||||
disconecting()
|
||||
main()
|
|
@ -0,0 +1,48 @@
|
|||
#!/bin/bash
|
||||
# Executable file to create rules for transparent proxy
|
||||
# Destinations you do not want routed through Tor
|
||||
NON_TOR="192.168.1.0/24 192.168.0.0/24"
|
||||
# the UID Tor runs as, actually only support for Debian, ArchLinux and Fedora as been added.
|
||||
if command -v pacman > /dev/null; then
|
||||
TOR_UID=$(id -u tor)
|
||||
elif command -v apt > /dev/null; then
|
||||
TOR_UID=$(id -u debian-tor)
|
||||
elif command -v dnf > /dev/null; then
|
||||
TOR_UID=$(id -u toranon)
|
||||
else
|
||||
echo "Unknown distro"
|
||||
exit
|
||||
fi
|
||||
|
||||
# Tor's TransPort
|
||||
TRANS_PORT="9040"
|
||||
|
||||
if ! command -v tor > /dev/null; then
|
||||
echo "You need to install the tor package."
|
||||
exit
|
||||
elif ! systemctl start tor > /dev/null; then
|
||||
echo "The tor service is not active, please start the tor service before running the script."
|
||||
exit
|
||||
elif ! command -v iptables > /dev/null; then
|
||||
echo "You need to install the iptables package."
|
||||
exit
|
||||
else
|
||||
iptables -F
|
||||
iptables -t nat -F
|
||||
iptables -t nat -A OUTPUT -m owner --uid-owner $TOR_UID -j RETURN
|
||||
iptables -t nat -A OUTPUT -p udp --dport 53 -j REDIRECT --to-ports 5353
|
||||
|
||||
for NET in $NON_TOR 127.0.0.0/9 127.128.0.0/10; do
|
||||
iptables -t nat -A OUTPUT -d $NET -j RETURN
|
||||
done
|
||||
|
||||
iptables -t nat -A OUTPUT -p tcp --syn -j REDIRECT --to-ports $TRANS_PORT
|
||||
iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
|
||||
|
||||
for NET in $NON_TOR 127.0.0.0/8; do
|
||||
iptables -A OUTPUT -d $NET -j ACCEPT
|
||||
done
|
||||
|
||||
iptables -A OUTPUT -m owner --uid-owner $TOR_UID -j ACCEPT
|
||||
iptables -A OUTPUT -j ACCEPT
|
||||
fi
|
Loading…
Reference in New Issue