-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_client.sh
More file actions
executable file
·88 lines (72 loc) · 2.29 KB
/
run_client.sh
File metadata and controls
executable file
·88 lines (72 loc) · 2.29 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
# PCQ Messenger - Client Launcher
# This script starts a chat client and connects to the server
set -e
echo "╔════════════════════════════════════════════════════════════╗"
echo "║ PCQ Messenger - Client Launcher ║"
echo "╚════════════════════════════════════════════════════════════╝"
echo ""
# Get server address
if [ -z "$1" ]; then
read -p "Enter server IP address (default: localhost): " SERVER_IP
SERVER_IP=${SERVER_IP:-localhost}
else
SERVER_IP=$1
fi
# Get username
read -p "Enter your username: " USERNAME
if [ -z "$USERNAME" ]; then
echo "❌ Username cannot be empty"
exit 1
fi
# Get encryption mode
echo ""
echo "Select encryption mode:"
echo " 1) Hybrid (Classical + Post-Quantum) [Recommended]"
echo " 2) Post-Quantum Only"
echo " 3) Classical Only"
read -p "Enter choice (1-3, default: 1): " MODE_CHOICE
MODE_CHOICE=${MODE_CHOICE:-1}
case $MODE_CHOICE in
1) ENCRYPTION_MODE="hybrid" ;;
2) ENCRYPTION_MODE="pq" ;;
3) ENCRYPTION_MODE="classical" ;;
*) ENCRYPTION_MODE="hybrid" ;;
esac
echo ""
echo "🔐 Encryption Mode: $ENCRYPTION_MODE"
echo "🌐 Server: $SERVER_IP:8080"
echo "👤 Username: $USERNAME"
echo ""
# Check if Python is installed
if ! command -v python3 &> /dev/null; then
echo "❌ Python 3 is not installed. Please install Python 3 first."
exit 1
fi
# Start web UI
echo "🚀 Starting web interface..."
WEB_PORT=5000
# Start Flask server in background
python3 -m app.web_ui --port $WEB_PORT &
WEB_PID=$!
# Wait for web server to start
sleep 2
# Open browser
WEB_URL="http://localhost:$WEB_PORT/?username=$USERNAME&server=ws://$SERVER_IP:8080"
echo ""
echo "✅ Web interface started!"
echo "🌐 Opening browser at: $WEB_URL"
echo ""
if command -v xdg-open &> /dev/null; then
xdg-open "$WEB_URL" 2>/dev/null &
elif command -v open &> /dev/null; then
open "$WEB_URL" 2>/dev/null &
else
echo "Please open this URL in your browser:"
echo "$WEB_URL"
fi
echo ""
echo "Press Ctrl+C to stop the client"
echo ""
# Wait for web server
wait $WEB_PID