diff --git a/README.md b/README.md index 43c8008..4545e03 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,82 @@ -# Auto_Tor_IP_changer V 2.1 -change your Ip Address automatically This tool based on tor project +--- +# Auto\_Tor\_IP\_Changer v2.1 🚀 -how to install this tools : +Automatically change your IP address using the power of the TOR network. +Perfect for privacy enthusiasts, security researchers, and anyone who wants to automate IP rotation. -* : requirements: +--- - sudo apt-get install tor - pip3 install requests[socks] - or just run autoTor it will install everything +## 🧰 Features -1: git clone https://github.com/FDX100/Auto_Tor_IP_changer.git +* Auto IP change using the TOR network +* Set change intervals (in seconds) +* Infinite or limited IP changes +* Installs dependencies automatically (TOR, `requests[socks]`) +* Use anywhere with the simple `aut` command -2 : cd Auto_Tor_IP_changer +--- -3 : python3 install.py +## ⚙️ Requirements -4 : interminal type ( aut ) any where you want - -5 : type time to change IP +> These will be auto-installed if missing. -6: type how many time to change your ip +```bash +sudo apt-get install tor +pip3 install requests[socks] +``` -*[0 to infinte IP change] +--- -6 : go to your browser / pc change sock proxy to 127.0.0.1:9050 +## 🧑‍💻 Installation Steps + +```bash +git clone https://github.com/FDX100/Auto_Tor_IP_changer.git +cd Auto_Tor_IP_changer +python3 install.py +``` + +> 🎉 After installation, just type `aut` from anywhere in the terminal! + +--- + +## 🚀 Usage Guide + +1. Run the tool: + + ```bash + aut + ``` + +2. Enter the **time interval in seconds** between IP changes (e.g. `60` for 1 min). + +3. Enter how many times you want to change your IP: + + * Enter `0` for **infinite** IP changes. + +4. Configure your browser or PC SOCKS proxy settings to: + + ``` + 127.0.0.1:9050 + ``` + +5. Enjoy anonymous browsing with rotating IPs! + +--- + +## 📢 Notes + +* Make sure TOR is allowed through your firewall. +* This tool only works if TOR is functioning correctly on your system. +* Always use this ethically and legally. + +--- + +## 🤖 Developer + +Made with ❤️ by **mrFD** +[🔗 Facebook Page](http://facebook.com/ninja.hackerz.kurdish/) + +--- -7 : BOOOOOOMM -============ -http://facebook.com/ninja.hackerz.kurdish/ diff --git a/autoTOR.py b/autoTOR.py index 62182ea..e4d7e4c 100644 --- a/autoTOR.py +++ b/autoTOR.py @@ -1,82 +1,138 @@ # -*- coding: utf-8 -*- - import time import os import subprocess +import sys +import socket + +TOR_CONTROL_PASSWORD = "your_password_here" # Put your Tor control password here (plaintext) + +def str_to_hex(s): + return ''.join(f'{ord(c):02X}' for c in s) + +def install_python_packages(): + try: + import requests + import socks # from pysocks + except ImportError: + print('[+] Required Python packages not found. Installing now...') + os.system('pip3 install "requests[socks]" pysocks') + # Try importing again after installation + try: + import requests + import socks + except ImportError: + print('[!] Failed to install required Python packages. Please install them manually.') + sys.exit(1) + +install_python_packages() +import requests + +def ensure_tor_installed(): + try: + subprocess.check_output('which tor', shell=True) + except subprocess.CalledProcessError: + print('[+] Tor is not installed. Installing...') + subprocess.call('sudo apt update', shell=True) + subprocess.call('sudo apt install tor -y', shell=True) + print('[!] Tor installed successfully.') + +def start_tor(): + try: + subprocess.call('sudo service tor start', shell=True) + except: + try: + subprocess.call('sudo systemctl start tor', shell=True) + except Exception as e: + print(f'[!] Could not start Tor service: {e}') + +def send_newnym(): + """ + Sends the NEWNYM signal to Tor control port to request a new circuit/IP. + Requires Tor to be configured with ControlPort 9051 and password authentication. + """ + try: + s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) + s.connect(("127.0.0.1", 9051)) + hex_pass = str_to_hex(TOR_CONTROL_PASSWORD) + auth_cmd = f'AUTHENTICATE {hex_pass}\r\n'.encode() + s.send(auth_cmd) + response = s.recv(1024) + if b'250' not in response: + print("[!] Authentication failed with Tor control port") + s.close() + return False + s.send(b'SIGNAL NEWNYM\r\n') + response = s.recv(1024) + if b'250' in response: + print("[+] Successfully sent NEWNYM signal to Tor") + s.close() + return True + else: + print("[!] Failed to send NEWNYM signal") + s.close() + except Exception as e: + print(f"[!] Error communicating with Tor control port: {e}") + return False + +def get_ip(): + url = 'http://checkip.amazonaws.com' + proxies = { + 'http': 'socks5h://127.0.0.1:9050', + 'https': 'socks5h://127.0.0.1:9050' + } + try: + response = requests.get(url, proxies=proxies, timeout=10) + return response.text.strip() + except Exception as e: + return f'[!] Failed to get IP: {e}' + +def change_ip(): + if send_newnym(): + time.sleep(5) # Wait for the new circuit to be established + print('[+] Your IP has been changed to:', get_ip()) + else: + print('[!] Could not change IP via NEWNYM signal.') +def main(): + ensure_tor_installed() + os.system("clear") - - - - - -try: - - import requests -except Exception: - print('[+] python3 requests is not installed') - os.system('pip3 install requests') - os.system('pip3 install requests[socks]') - print('[!] python3 requests is installed ') -try: - - check_tor = subprocess.check_output('which tor', shell=True) -except subprocess.CalledProcessError: - - print('[+] tor is not installed !') - subprocess.check_output('sudo apt update',shell=True) - subprocess.check_output('sudo apt install tor -y',shell=True) - print('[!] tor is installed succesfully ') - -os.system("clear") -def ma_ip(): - url='http://checkip.amazonaws.com' - get_ip= requests.get(url,proxies=dict(http='socks5://127.0.0.1:9050',https='socks5://127.0.0.1:9050')) - return get_ip.text - -def change(): - os.system("service tor reload") - print ('[+] Your IP has been Changed to : '+str(ma_ip())) - -print('''\033[1;32;40m \n + print('''\033[1;32;40m _ _______ - /\ | | |__ __| - / \ _ _| |_ ___ | | ___ _ __ - / /\ \| | | | __/ _ \ | |/ _ \| '__| - / ____ \ |_| | || (_) | | | (_) | | - /_/ \_\__,_|\__\___/ |_|\___/|_| + /\\ | | |__ __| + / \\ _ _| |_ ___ | | ___ _ __ + / /\\ \\| | | | __/ _ \\ | |/ _ \\| '__| + / ____ \\ |_| | || (_) | | | (_) | | + /_/ \\_\\__,_|\\__\\___/ |_|\\___/|_| V 2.1 from mrFD ''') -print("\033[1;40;31m http://facebook.com/ninja.hackerz.kurdish/\n") - -os.system("service tor start") - - - - -time.sleep(3) -print("\033[1;32;40m change your SOCKES to 127.0.0.1:9050 \n") -os.system("service tor start") -x = input("[+] time to change Ip in Sec [type=60] >> ") -lin = input("[+] How many times do you want to change your IP? enter to infinite IP change] >> ") or "0" - -try: - lin = int(lin) - - if lin == 0: - print("Starting infinite IP change. Press Ctrl+C to stop.") - while True: - try: - time.sleep(int(x)) # Assuming 'x' is defined earlier in your code - change() # Assuming 'change()' is defined elsewhere - except KeyboardInterrupt: - print('\nAuto IP changer is closed.') - break - else: - for _ in range(lin): - time.sleep(int(x)) # Assuming 'x' is defined earlier in your code - change() # Assuming 'change()' is defined elsewhere - -except ValueError: - print("Invalid input. Please enter a valid number.") + print("\033[1;40;31m http://facebook.com/ninja.hackerz.kurdish/\n") + + start_tor() + time.sleep(3) + print("\033[1;32;40m Set your SOCKS to 127.0.0.1:9050 \n") + + delay_input = input("[+] Time delay to change IP in seconds [default=60] >> ") or "60" + count_input = input("[+] How many times to change IP? (Enter 0 or leave blank for infinite) >> ") or "0" + + try: + delay = int(delay_input) + count = int(count_input) + + if count == 0: + print("[*] Starting infinite IP change. Press Ctrl+C to stop.") + while True: + time.sleep(delay) + change_ip() + else: + for _ in range(count): + time.sleep(delay) + change_ip() + + except ValueError: + print("[!] Invalid input. Please enter valid numbers.") + +if __name__ == "__main__": + main() diff --git a/install.py b/install.py index e697d8f..02c48b5 100644 --- a/install.py +++ b/install.py @@ -1,18 +1,41 @@ import os -choice = input('[+] to install press (Y) to uninstall press (N) >> ') + +choice = input('[+] To install press (Y) or to uninstall press (N) >> ').strip().lower() run = os.system -if str(choice) =='Y' or str(choice)=='y': - run('chmod 777 autoTOR.py') - run('mkdir /usr/share/aut') - run('cp autoTOR.py /usr/share/aut/autoTOR.py') +INSTALL_DIR = "/usr/share/aut" +SCRIPT_PATH = os.path.join(INSTALL_DIR, "autoTOR.py") +LAUNCHER_PATH = "/usr/bin/aut" + +if choice == 'y': + try: + run('chmod 777 autoTOR.py') + if not os.path.exists(INSTALL_DIR): + run(f'mkdir {INSTALL_DIR}') + run(f'cp autoTOR.py {SCRIPT_PATH}') + + # Create launcher script + launcher_content = "#!/bin/sh\nexec python3 /usr/share/aut/autoTOR.py \"$@\"" + with open(LAUNCHER_PATH, 'w') as file: + file.write(launcher_content) + + run(f'chmod +x {LAUNCHER_PATH}') + run(f'chmod +x {SCRIPT_PATH}') + + print('\n\n[✓] AutoTOR IP Changer installed successfully!') + print('From now on, just type \x1b[6;30;42maut\x1b[0m in the terminal to run it.\n') + except Exception as e: + print(f"[!] Installation failed: {e}") + +elif choice == 'n': + try: + if os.path.exists(INSTALL_DIR): + run(f'rm -rf {INSTALL_DIR}') + if os.path.exists(LAUNCHER_PATH): + run(f'rm -f {LAUNCHER_PATH}') + print('[✓] AutoTOR IP Changer has been removed successfully.') + except Exception as e: + print(f"[!] Uninstallation failed: {e}") - cmnd=(' #! /bin/sh \n exec python3 /usr/share/aut/autoTOR.py "$@"') - with open('/usr/bin/aut','w')as file: - file.write(cmnd) - run('chmod +x /usr/bin/aut & chmod +x /usr/share/aut/autoTOR.py') - print('''\n\ncongratulation auto Tor Ip Changer is installed successfully \nfrom now just type \x1b[6;30;42maut\x1b[0m in terminal ''') -if str(choice)=='N' or str(choice)=='n': - run('rm -r /usr/share/aut ') - run('rm /usr/bin/aut ') - print('[!] now Auto Tor Ip changer has been removed successfully') +else: + print("[!] Invalid choice. Please enter Y or N.")