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
+87 -53
View File
@@ -2,36 +2,42 @@
import time
import os
import sys
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:
from stem import Signal
from stem.control import Controller
except ImportError:
print('[+] python3 stem is not installed')
os.system('pip3 install stem')
from stem import Signal
from stem.control import Controller
def check_dependencies():
"""Check and report missing dependencies."""
missing = []
try:
import requests
except ImportError:
missing.append("python3-requests")
try:
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)
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():
"""Request a new Tor identity."""
try:
from stem import Signal
from stem.control import Controller
with Controller.from_port(port=9051) as controller:
controller.authenticate() # Uses default cookie auth
controller.signal(Signal.NEWNYM)
@@ -39,7 +45,11 @@ def new_tor_identity():
except Exception as e:
print(f"[!] Failed to request new identity: {e}")
def ma_ip():
"""Get current IP through Tor SOCKS proxy."""
import requests
url = 'http://checkip.amazonaws.com'
proxies = {
'http': 'socks5h://127.0.0.1:9050',
@@ -48,12 +58,24 @@ def ma_ip():
get_ip = requests.get(url, proxies=proxies, timeout=10)
return get_ip.text.strip()
def change():
"""Change to a new Tor exit IP."""
new_tor_identity()
time.sleep(5) # Allow Tor to build a new circuit
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
_ _ _____
| \ | | _____ _|_ _|__ _ __
| \| |/ _ \ \/ / | |/ _ \| '__|
@@ -62,35 +84,47 @@ print('''\033[1;32;40m \n
1.1
''')
print("\033[1;40;31m https://github.com/Stalin-143\n")
print("Nexulean")
os.system("service tor start")
time.sleep(3)
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"
lin = input("[+] How many times do you want to change your IP? [0 = infinite] >> ") or "0"
try:
x = int(x)
lin = int(lin)
if lin == 0:
print("Starting infinite IP change. Press Ctrl+C to stop.")
while True:
try:
print("\033[1;40;31m https://github.com/Stalin-143\n")
print("Nexulean")
# 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)
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"
lin = input("[+] How many times do you want to change your IP? [0 = infinite] >> ") or "0"
try:
x = int(x)
lin = int(lin)
if lin == 0:
print("Starting infinite IP change. Press Ctrl+C to stop.")
while True:
try:
change()
time.sleep(x)
except KeyboardInterrupt:
print('\n[+] IP changer stopped.')
break
else:
for _ in range(lin):
change()
time.sleep(x)
except KeyboardInterrupt:
print('\n[+] IP changer stopped.')
break
else:
for _ in range(lin):
change()
time.sleep(x)
except ValueError:
print("Invalid input. Please enter valid numbers.")
except ValueError:
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 README.md
override_dh_auto_test:
# Skip tests during build - no test suite available
override_dh_auto_install:
dh_auto_install
# Create nextor wrapper script in /usr/bin