Fix build issues: move code to main() and skip tests

This commit is contained in:
Stalin
2026-04-15 00:30:00 +05:30
parent 6015643c9c
commit c96b001f47
2 changed files with 90 additions and 53 deletions
+53 -19
View File
@@ -2,36 +2,42 @@
import time import time
import os import os
import sys
import subprocess import subprocess
def check_dependencies():
"""Check and report missing dependencies."""
missing = []
try: try:
import requests import requests
except Exception: except ImportError:
print('[+] python3 requests is not installed') missing.append("python3-requests")
os.system('pip3 install requests requests[socks]')
print('[!] python3 requests is installed ')
try: try:
from stem import Signal from stem import Signal
from stem.control import Controller from stem.control import Controller
except ImportError: except ImportError:
print('[+] python3 stem is not installed') missing.append("python3-stem")
os.system('pip3 install 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)
def new_tor_identity():
"""Request a new Tor identity."""
try:
from stem import Signal from stem import Signal
from stem.control import Controller from stem.control import Controller
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 installed successfully')
os.system("clear")
def new_tor_identity():
try:
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,11 +58,23 @@ 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())
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 print('''\033[1;32;40m \n
_ _ _____ _ _ _____
| \ | | _____ _|_ _|__ _ __ | \ | | _____ _|_ _|__ _ __
@@ -66,7 +88,15 @@ print('''\033[1;32;40m \n
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")
@@ -94,3 +124,7 @@ try:
except ValueError: except ValueError:
print("Invalid input. Please enter valid numbers.") print("Invalid input. Please enter valid numbers.")
if __name__ == "__main__":
main()
+3
View File
@@ -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