mirror of
https://github.com/0x5t4l1n/NexTOR_IP_CHANGER.git
synced 2026-05-26 19:56:30 +00:00
Fix build issues: move code to main() and skip tests
This commit is contained in:
@@ -2,36 +2,42 @@
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
try:
|
|
||||||
import requests
|
|
||||||
except Exception:
|
|
||||||
print('[+] python3 requests is not installed')
|
|
||||||
os.system('pip3 install requests requests[socks]')
|
|
||||||
print('[!] python3 requests is installed ')
|
|
||||||
|
|
||||||
try:
|
def check_dependencies():
|
||||||
from stem import Signal
|
"""Check and report missing dependencies."""
|
||||||
from stem.control import Controller
|
missing = []
|
||||||
except ImportError:
|
|
||||||
print('[+] python3 stem is not installed')
|
|
||||||
os.system('pip3 install stem')
|
|
||||||
from stem import Signal
|
|
||||||
from stem.control import Controller
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
check_tor = subprocess.check_output('which tor', shell=True)
|
import requests
|
||||||
except subprocess.CalledProcessError:
|
except ImportError:
|
||||||
print('[+] tor is not installed !')
|
missing.append("python3-requests")
|
||||||
subprocess.check_output('sudo apt update', shell=True)
|
|
||||||
subprocess.check_output('sudo apt install tor -y', shell=True)
|
try:
|
||||||
print('[!] Tor installed successfully')
|
from stem import Signal
|
||||||
|
from stem.control import Controller
|
||||||
|
except ImportError:
|
||||||
|
missing.append("python3-stem")
|
||||||
|
|
||||||
|
try:
|
||||||
|
subprocess.check_output('which tor', shell=True, stderr=subprocess.DEVNULL)
|
||||||
|
except subprocess.CalledProcessError:
|
||||||
|
missing.append("tor")
|
||||||
|
|
||||||
|
if missing:
|
||||||
|
print("[!] Missing dependencies:", ", ".join(missing))
|
||||||
|
print("[!] Install with: sudo apt install", " ".join(missing))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
os.system("clear")
|
|
||||||
|
|
||||||
def new_tor_identity():
|
def new_tor_identity():
|
||||||
|
"""Request a new Tor identity."""
|
||||||
try:
|
try:
|
||||||
|
from stem import Signal
|
||||||
|
from stem.control import Controller
|
||||||
|
|
||||||
with Controller.from_port(port=9051) as controller:
|
with Controller.from_port(port=9051) as controller:
|
||||||
controller.authenticate() # Uses default cookie auth
|
controller.authenticate() # Uses default cookie auth
|
||||||
controller.signal(Signal.NEWNYM)
|
controller.signal(Signal.NEWNYM)
|
||||||
@@ -39,7 +45,11 @@ def new_tor_identity():
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"[!] Failed to request new identity: {e}")
|
print(f"[!] Failed to request new identity: {e}")
|
||||||
|
|
||||||
|
|
||||||
def ma_ip():
|
def ma_ip():
|
||||||
|
"""Get current IP through Tor SOCKS proxy."""
|
||||||
|
import requests
|
||||||
|
|
||||||
url = 'http://checkip.amazonaws.com'
|
url = 'http://checkip.amazonaws.com'
|
||||||
proxies = {
|
proxies = {
|
||||||
'http': 'socks5h://127.0.0.1:9050',
|
'http': 'socks5h://127.0.0.1:9050',
|
||||||
@@ -48,12 +58,24 @@ def ma_ip():
|
|||||||
get_ip = requests.get(url, proxies=proxies, timeout=10)
|
get_ip = requests.get(url, proxies=proxies, timeout=10)
|
||||||
return get_ip.text.strip()
|
return get_ip.text.strip()
|
||||||
|
|
||||||
|
|
||||||
def change():
|
def change():
|
||||||
|
"""Change to a new Tor exit IP."""
|
||||||
new_tor_identity()
|
new_tor_identity()
|
||||||
time.sleep(5) # Allow Tor to build a new circuit
|
time.sleep(5) # Allow Tor to build a new circuit
|
||||||
print('[+] Your IP has been changed to:', ma_ip())
|
print('[+] Your IP has been changed to:', ma_ip())
|
||||||
|
|
||||||
print('''\033[1;32;40m \n
|
|
||||||
|
def main():
|
||||||
|
"""Main entry point for the NexTOR IP changer."""
|
||||||
|
# Check dependencies first
|
||||||
|
check_dependencies()
|
||||||
|
|
||||||
|
# Clear screen
|
||||||
|
os.system("clear")
|
||||||
|
|
||||||
|
# Print banner
|
||||||
|
print('''\033[1;32;40m \n
|
||||||
_ _ _____
|
_ _ _____
|
||||||
| \ | | _____ _|_ _|__ _ __
|
| \ | | _____ _|_ _|__ _ __
|
||||||
| \| |/ _ \ \/ / | |/ _ \| '__|
|
| \| |/ _ \ \/ / | |/ _ \| '__|
|
||||||
@@ -63,34 +85,46 @@ print('''\033[1;32;40m \n
|
|||||||
1.1
|
1.1
|
||||||
''')
|
''')
|
||||||
|
|
||||||
print("\033[1;40;31m https://github.com/Stalin-143\n")
|
print("\033[1;40;31m https://github.com/Stalin-143\n")
|
||||||
print("Nexulean")
|
print("Nexulean")
|
||||||
|
|
||||||
os.system("service tor start")
|
# Start Tor service
|
||||||
|
try:
|
||||||
|
subprocess.check_call(['sudo', 'systemctl', 'start', 'tor'],
|
||||||
|
stdout=subprocess.DEVNULL,
|
||||||
|
stderr=subprocess.DEVNULL)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"[!] Failed to start tor service: {e}")
|
||||||
|
print("[!] Make sure tor is installed and you have sudo access")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
print("\033[1;32;40m Change your SOCKS to 127.0.0.1:9050 \n")
|
print("\033[1;32;40m Change your SOCKS to 127.0.0.1:9050 \n")
|
||||||
|
|
||||||
x = input("[+] Set time to change IP in seconds [default=60] >> ") or "60"
|
x = input("[+] Set time to change IP in seconds [default=60] >> ") or "60"
|
||||||
lin = input("[+] How many times do you want to change your IP? [0 = infinite] >> ") or "0"
|
lin = input("[+] How many times do you want to change your IP? [0 = infinite] >> ") or "0"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
x = int(x)
|
x = int(x)
|
||||||
lin = int(lin)
|
lin = int(lin)
|
||||||
|
|
||||||
if lin == 0:
|
if lin == 0:
|
||||||
print("Starting infinite IP change. Press Ctrl+C to stop.")
|
print("Starting infinite IP change. Press Ctrl+C to stop.")
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
change()
|
||||||
|
time.sleep(x)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
print('\n[+] IP changer stopped.')
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
for _ in range(lin):
|
||||||
change()
|
change()
|
||||||
time.sleep(x)
|
time.sleep(x)
|
||||||
except KeyboardInterrupt:
|
|
||||||
print('\n[+] IP changer stopped.')
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
for _ in range(lin):
|
|
||||||
change()
|
|
||||||
time.sleep(x)
|
|
||||||
|
|
||||||
except ValueError:
|
except ValueError:
|
||||||
print("Invalid input. Please enter valid numbers.")
|
print("Invalid input. Please enter valid numbers.")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
|
|||||||
Vendored
+3
@@ -12,6 +12,9 @@ override_dh_installdocs:
|
|||||||
dh_installdocs
|
dh_installdocs
|
||||||
dh_installdocs README.md
|
dh_installdocs README.md
|
||||||
|
|
||||||
|
override_dh_auto_test:
|
||||||
|
# Skip tests during build - no test suite available
|
||||||
|
|
||||||
override_dh_auto_install:
|
override_dh_auto_install:
|
||||||
dh_auto_install
|
dh_auto_install
|
||||||
# Create nextor wrapper script in /usr/bin
|
# Create nextor wrapper script in /usr/bin
|
||||||
|
|||||||
Reference in New Issue
Block a user