|
1 |
| -import subprocess |
2 |
| -import requests |
3 |
| -import time |
4 |
| -import sys |
5 | 1 | import os
|
| 2 | +import sys |
| 3 | +from scr import main_win |
| 4 | +from scr import main_linux |
6 | 5 |
|
7 |
| -if os.name == 'nt': |
8 |
| - sys.exit("This tool can only run on Linux!") |
9 |
| - |
10 |
| -def display_banner(): |
11 |
| - os.system('cls' if os.name == 'nt' else 'clear') |
12 |
| - DEFAULT, GREEN, RED, YELLOW, YELLOW2, ITALIC, BLINK = '\033[0m', '\033[1;92m', '\033[1;31m', '\033[1;33m', '\033[1;93m', '\033[3m', '\033[5m' |
13 |
| - |
14 |
| - print(''' |
15 |
| -{4} █████ ███████████ █████████ █████ █████ █████████ ██████ █████ █████████ ██████████ ███████████{0} |
16 |
| -{4}░░███ ░░███░░░░░███ ███░░░░░███░░███ ░░███ ███░░░░░███ ░░██████ ░░███ ███░░░░░███░░███░░░░░█░░███░░░░░███{0} |
17 |
| -{4} ░███ ░███ ░███ ███ ░░░ ░███ ░███ ░███ ░███ ░███░███ ░███ ███ ░░░ ░███ █ ░ ░███ ░███{0} |
18 |
| -{4} ░███ ░██████████ ░███ ░███████████ ░███████████ ░███░░███░███ ░███ ░██████ ░██████████{0} |
19 |
| -{4} ░███ ░███░░░░░░ ░███ ░███░░░░░███ ░███░░░░░███ ░███ ░░██████ ░███ █████ ░███░░█ ░███░░░░░███{0} |
20 |
| -{4} ░███ ░███ ░░███ ███ ░███ ░███ ░███ ░███ ░███ ░░█████ ░░███ ░░███ ░███ ░ █ ░███ ░███{0} |
21 |
| -{4} █████ █████ ░░█████████ █████ █████ █████ █████ █████ ░░█████ ░░█████████ ██████████ █████ █████{0} |
22 |
| -{4}░░░░░ ░░░░░ ░░░░░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░░░░░░ ░░░░░░░░░░ ░░░░░ ░░░░░{0} |
23 |
| -
|
24 |
| - {1}{5}================ {1}{5}====================== |
25 |
| - {3}{5}Version: {2}1.0{2} {3}{5}Code Author: {2}isPique |
26 |
| - {1}{5}================ {1}{5}====================== |
27 | 6 |
|
28 |
| - {3}{5}GitHub Profile {2}{6}:{0}{1} https://github.com/isPique{0} |
29 |
| - '''.format(DEFAULT, GREEN, RED, YELLOW, YELLOW2, ITALIC, BLINK)) |
| 7 | +def run_windows_script(): |
| 8 | + print("Running Windows script...") |
| 9 | + main_win.main() |
30 | 10 |
|
31 |
| -def install_tor(): |
32 |
| - if subprocess.run(['which', 'tor'], stdout = subprocess.PIPE, stderr = subprocess.PIPE).returncode != 0: |
33 |
| - print("\033[1;91m[!]\033[1;93m Tor is not installed. Installing it...\033[0m") |
34 |
| - if os.system("sudo apt install tor -y > /dev/null 2>&1"): |
35 |
| - print("\033[1;91m[!]\033[1;93m Failed to install Tor!\n\033[1;91m[!]\033[1;93m Please check your network connection.\033[0m") |
36 |
| - return False |
37 |
| - else: |
38 |
| - print("\033[1;92m[+] Tor has been successfully installed.\033[0m") |
39 |
| - time.sleep(1) |
40 |
| - return True |
| 11 | +def run_linux_script(): |
| 12 | + print("Running Linux script...") |
| 13 | + main_linux.main() |
41 | 14 |
|
42 | 15 | def main():
|
43 |
| - # Check if script is running with root privileges |
44 |
| - if os.geteuid() != 0: |
45 |
| - print("\033[1;91m[!]\033[1;93m This script must be run with root privileges.\033[0m") |
46 |
| - return |
47 |
| - |
48 |
| - url = "https://httpbin.org/ip" |
49 |
| - proxy = { |
50 |
| - 'http': 'socks5://127.0.0.1:9050', |
51 |
| - 'https': 'socks5://127.0.0.1:9050' |
52 |
| - } |
53 |
| - |
54 |
| - try: |
55 |
| - print("\033[1;34m[*] Checking if Tor is installed...\033[0m") |
56 |
| - time.sleep(1) |
57 |
| - if not install_tor(): |
58 |
| - return |
59 |
| - else: |
60 |
| - print("\033[1;92m[+] Tor is already installed.\033[0m") |
61 |
| - time.sleep(1) |
62 |
| - |
63 |
| - display_banner() |
64 |
| - |
65 |
| - try: |
66 |
| - version_info = os.popen("tor --version").read().strip() |
67 |
| - version = version_info.split('\n')[0].split(' ')[2] |
68 |
| - print(f"\033[1;34m[*] Your Tor version is: {version}\033[0m") |
69 |
| - except Exception: |
70 |
| - pass |
71 |
| - |
72 |
| - try: |
73 |
| - response = requests.get(url) |
74 |
| - current_ip = response.json()["origin"] |
75 |
| - print(f"\033[1;34m[*] Your current IP address is: {current_ip}\033[0m") |
76 |
| - except: |
77 |
| - pass |
78 |
| - |
79 |
| - try: |
80 |
| - time_interval = int(input("\033[1;92m[>] How often do you want to change your IP? (in seconds) \xBB\033[0m\033[1;77m ")) |
81 |
| - if time_interval <= 0: |
82 |
| - raise Exception |
83 |
| - |
84 |
| - except Exception: |
85 |
| - print("\033[1;91m[!]\033[1;93m Time interval must be a positive integer.\033[0m") |
86 |
| - return |
87 |
| - |
88 |
| - print(f"\033[1;91m[!]\033[1;93m Your IP address will be changed every {time_interval} seconds until you stop the script!") |
89 |
| - print("\033[1;91m[!]\033[1;93m Press Ctrl + C to stop.") |
90 |
| - time.sleep(1) |
91 |
| - |
92 |
| - print("\033[1;34m[*] Checking for Tor connection...\033[0m") |
93 |
| - |
94 |
| - tor_status = subprocess.run(["sudo", "service", "tor", "status"], capture_output = True, text = True) |
95 |
| - if "Active: active" in tor_status.stdout: |
96 |
| - print("\033[1;92m[+] Tor is already running.\033[0m") |
97 |
| - |
98 |
| - else: |
99 |
| - print("\033[1;93m[-] Tor is not running.\033[0m") |
100 |
| - print("\033[1;34m[*] Starting Tor service...\033[0m") |
101 |
| - subprocess.run("sudo service tor start", shell = True, stdout = subprocess.DEVNULL, stderr = subprocess.DEVNULL) |
102 |
| - time.sleep(3) |
103 |
| - |
104 |
| - while True: |
105 |
| - try: |
106 |
| - response = requests.get(url, proxies = proxy) |
107 |
| - changed_ip = response.json().get('origin') |
108 |
| - print(f"\033[1;92m[+] Your IP has been changed to {changed_ip}\033[0m") |
109 |
| - |
110 |
| - except Exception: |
111 |
| - print(f"\033[1;91m[-] Error!\033[1;93m Failed to change IP. Retrying...\033[0m") |
112 |
| - |
113 |
| - time.sleep(time_interval) |
114 |
| - subprocess.run("sudo service tor reload", shell = True, stdout = subprocess.DEVNULL, stderr = subprocess.DEVNULL) |
115 |
| - |
116 |
| - except KeyboardInterrupt: |
117 |
| - print("\n\033[1;91m[!]\033[1;93m Exiting...\033[0m") |
118 |
| - print("\033[1;34m[*] Stopping Tor service...\033[0m") |
119 |
| - subprocess.run("sudo service tor stop", shell = True, stdout = subprocess.DEVNULL, stderr = subprocess.DEVNULL) |
| 16 | + if os.name == 'nt': |
| 17 | + run_windows_script() |
| 18 | + elif os.name == 'posix': |
| 19 | + run_linux_script() |
| 20 | + else: |
| 21 | + print("Unsupported operating system") |
| 22 | + sys.exit(1) |
120 | 23 |
|
121 | 24 | if __name__ == '__main__':
|
122 | 25 | main()
|
0 commit comments