-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
70 lines (59 loc) · 3.18 KB
/
main.py
File metadata and controls
70 lines (59 loc) · 3.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python3
import subprocess
import socket
import sys
import os
from version import VERSION
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
PYTHON = sys.executable
SERVER = os.path.join(BASE_DIR, "server.py")
CLIENT = os.path.join(BASE_DIR, "client.py")
def check_system_tor():
"""Check if system Tor SOCKS proxy is available"""
try:
sock = socket.socket()
sock.settimeout(2)
sock.connect(("127.0.0.1", 9050))
sock.close()
return True
except Exception:
return False
def show_main_banner():
banner = f"""
╔══════════════════════════════════════════════════════════════╗
║ ████████╗ ██████╗ ██████╗ ██████╗██╗ ██╗ █████╗ ████████╗ ║
║ ╚══██╔══╝██╔═══██╗██╔══██╗██╔════╝██║ ██║██╔══██╗╚══██╔══╝ ║
║ ██║ ██║ ██║██████╔╝██║ ███████║███████║ ██║ ║
║ ██║ ██║ ██║██╔══██╗██║ ██╔══██║██╔══██║ ██║ ║
║ ██║ ╚██████╔╝██║ ██║╚██████╗██║ ██║██║ ██║ ██║ ║
║ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ║
║ ║
║ Anonymous P2P Chat over Tor Network ║
║ End-to-End Encrypted • Ephemeral ║
║ ║
║ AppImage Edition ║
║ ║
╚══════════════════════════════════════════════════════════════╝
v{VERSION}
🔒 Secure • 🧅 Anonymous • ⚡ Fast • 🎫 Ephemeral
[1] Host chat (Server) - Create new chat room
[2] Connect to peer (Client) - Join existing chat
"""
print(banner)
show_main_banner()
choice = input("Choose [1/2]: ").strip()
if choice == "1":
print("\n🚀 Starting server mode (using embedded Tor)...")
subprocess.run([PYTHON, SERVER], cwd=BASE_DIR)
elif choice == "2":
print("\n🔗 Starting client mode...")
if not check_system_tor():
print("❌ System Tor not detected on port 9050")
print("\n💡 Client mode requires system Tor.")
print(" sudo systemctl start tor")
print(" Or use Tor Browser (SOCKS on 9150)")
sys.exit(1)
print("✅ System Tor detected - proceeding with client...")
subprocess.run([PYTHON, CLIENT], cwd=BASE_DIR)
else:
print("❌ Invalid choice.")