├── install.sh ├── README.md └── torghost /install.sh: -------------------------------------------------------------------------------- 1 | # Edited by KP 2 | #!/bin/bash 3 | 4 | clear 5 | echo "******* Torghost installer ********" 6 | echo -e "\033[31mTorghost made by Technical Dada\033[0m" 7 | echo 8 | 9 | echo -e "\033[32m=====> Installing tor bundle \033[0m" 10 | sudo apt-get install tor -y 11 | 12 | echo -e "\033[32m=====> Installing dependencies \033[0m" 13 | sudo pip3 install stem 14 | 15 | echo -e "\033[32m=====> Installing TorGhost \033[0m" 16 | sudo cp torghost.py /usr/local/bin/torghost 17 | sudo chmod +x /usr/local/bin/torghost 18 | 19 | echo -e "\033[32m=====> Done \033[0m" 20 | echo "=====> Open terminal and type 'torghost' for usage" 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TorGhost 2 | This tool is for Kali Linux. This is a powerful tool that can connect your whole PC with Tor network. Forget the Tor Browser. Now you can even use `apt-get install` something ANONYMOUSLY. 3 | 4 | ## INSTALL 5 | 6 | Clone the repo or download the files, open the directory and follow the commands: 7 | 8 | chmod +x installer.sh 9 | ./installer.sh 10 | 11 | ----------------------------------------------------------------------------------------- 12 | 13 | _____ ____ _ _ 14 | |_ _|__ _ __ / ___| |__ ___ ___| |_ 15 | | |/ _ \| '__| | _| '_ \ / _ \/ __| __| 16 | | | (_) | | | |_| | | | | (_) \__ \ |_ 17 | |_|\___/|_| \____|_| |_|\___/|___/\__| 18 | v3.0 - Technical Dada | www.technicaldada.in 19 | 20 | 21 | USAGE: 22 | torghost start (start torghost) 23 | torghost stop (stop torghost) 24 | torghost switch (switch IP) 25 | torghost status (check status) 26 | torghost ip (show current IP) 27 | 28 | ----------------------------------------------------------------------------------------- 29 | -------------------------------------------------------------------------------- /torghost: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | """ 3 | TorGhost - Clean and Working Version 4 | """ 5 | 6 | import os 7 | import sys 8 | import subprocess 9 | import time 10 | import signal 11 | from stem import Signal 12 | from stem.control import Controller 13 | 14 | 15 | class bcolors: 16 | BLUE = '\033[94m' 17 | GREEN = '\033[92m' 18 | RED = '\033[31m' 19 | YELLOW = '\033[93m' 20 | ENDC = '\033[0m' 21 | BOLD = '\033[1m' 22 | 23 | 24 | def t(): 25 | return "[" + time.strftime('%H:%M:%S') + "]" 26 | 27 | 28 | def sigint_handler(signum, frame): 29 | print('\nUser interrupt! Shutting down') 30 | shutdown() 31 | 32 | 33 | def shutdown(): 34 | print(f"\n{t()} Shutting down torghost") 35 | sys.exit() 36 | 37 | 38 | def logo(): 39 | os.system("clear") 40 | print(f"{bcolors.RED}{bcolors.BOLD}") 41 | print(""" 42 | _____ ____ _ _ 43 | |_ _|__ _ __ / ___| |__ ___ ___| |_ 44 | | |/ _ \| '__| | _| '_ \ / _ \/ __| __| 45 | | | (_) | | | |_| | | | | (_) \__ \ |_ 46 | |_|\___/|_| \____|_| |_|\___/|___/\__| 47 | v2.0 - Koushik Pal 48 | """) 49 | print(f"{bcolors.ENDC}") 50 | 51 | 52 | def usage(): 53 | logo() 54 | print(""" 55 | USAGE: 56 | sudo torghost start (start torghost) 57 | sudo torghost stop (stop torghost) 58 | sudo torghost switch (switch IP) 59 | torghost status (show status) 60 | """) 61 | sys.exit() 62 | 63 | 64 | def get_ip(): 65 | try: 66 | result = subprocess.run(['curl', '-s', 'https://api.ipify.org'], 67 | capture_output=True, text=True) 68 | return result.stdout.strip() 69 | except: 70 | return "Unknown" 71 | 72 | 73 | def start_torghost(): 74 | # Configure torrc 75 | torrc_content = """ 76 | ## TorGhost Configuration 77 | VirtualAddrNetwork 10.0.0.0/10 78 | AutomapHostsOnResolve 1 79 | TransPort 9040 80 | DNSPort 53 81 | ControlPort 9051 82 | """ 83 | 84 | with open('/etc/tor/torrc', 'a') as f: 85 | f.write(torrc_content) 86 | 87 | # Configure DNS 88 | with open('/etc/resolv.conf', 'w') as f: 89 | f.write("nameserver 127.0.0.1\n") 90 | 91 | # Start services 92 | subprocess.run(['systemctl', 'start', 'tor']) 93 | 94 | # Setup iptables 95 | tor_uid = subprocess.run(['id', '-u', 'debian-tor'], 96 | capture_output=True, text=True).stdout.strip() 97 | 98 | iptables_script = f""" 99 | iptables -F 100 | iptables -t nat -F 101 | iptables -t nat -A OUTPUT -m owner --uid-owner {tor_uid} -j RETURN 102 | iptables -t nat -A OUTPUT -p udp --dport 53 -j REDIRECT --to-ports 53 103 | iptables -t nat -A OUTPUT -p tcp --dport 53 -j REDIRECT --to-ports 53 104 | iptables -t nat -A OUTPUT -d 192.168.1.0/24 -j RETURN 105 | iptables -t nat -A OUTPUT -d 192.168.0.0/24 -j RETURN 106 | iptables -t nat -A OUTPUT -d 127.0.0.0/8 -j RETURN 107 | iptables -t nat -A OUTPUT -p tcp --syn -j REDIRECT --to-ports 9040 108 | iptables -A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT 109 | iptables -A OUTPUT -d 192.168.1.0/24 -j ACCEPT 110 | iptables -A OUTPUT -d 192.168.0.0/24 -j ACCEPT 111 | iptables -A OUTPUT -d 127.0.0.0/8 -j ACCEPT 112 | iptables -A OUTPUT -m owner --uid-owner {tor_uid} -j ACCEPT 113 | iptables -A OUTPUT -j REJECT 114 | """ 115 | 116 | subprocess.run(['bash', '-c', iptables_script]) 117 | print(f"{t()} CURRENT IP: {bcolors.GREEN}{get_ip()}{bcolors.ENDC}") 118 | 119 | 120 | def stop_torghost(): 121 | # Flush iptables 122 | subprocess.run(['bash', '-c', """ 123 | iptables -P INPUT ACCEPT 124 | iptables -P FORWARD ACCEPT 125 | iptables -P OUTPUT ACCEPT 126 | iptables -t nat -F 127 | iptables -t mangle -F 128 | iptables -F 129 | iptables -X 130 | """]) 131 | 132 | # Restore network 133 | subprocess.run(['systemctl', 'restart', 'NetworkManager']) 134 | print(f"{t()} CURRENT IP: {bcolors.GREEN}{get_ip()}{bcolors.ENDC}") 135 | 136 | 137 | def switch_tor(): 138 | with Controller.from_port(port=9051) as controller: 139 | controller.authenticate() 140 | controller.signal(Signal.NEWNYM) 141 | time.sleep(5) 142 | print(f"{t()} CURRENT IP: {bcolors.GREEN}{get_ip()}{bcolors.ENDC}") 143 | 144 | 145 | def show_status(): 146 | ip = get_ip() 147 | tor_status = subprocess.run(['systemctl', 'is-active', 'tor'], 148 | capture_output=True, text=True).stdout.strip() 149 | print(f"Tor Status: {tor_status}") 150 | print(f"Current IP: {ip}") 151 | 152 | 153 | # Main execution 154 | signal.signal(signal.SIGINT, sigint_handler) 155 | 156 | if len(sys.argv) < 2: 157 | usage() 158 | 159 | command = sys.argv[1].lower() 160 | 161 | if command == "start": 162 | logo() 163 | start_torghost() 164 | elif command == "stop": 165 | logo() 166 | stop_torghost() 167 | elif command == "switch": 168 | switch_tor() 169 | elif command == "status": 170 | show_status() 171 | else: 172 | usage() 173 | --------------------------------------------------------------------------------