-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_linux.sh
More file actions
executable file
·527 lines (469 loc) · 21.1 KB
/
setup_linux.sh
File metadata and controls
executable file
·527 lines (469 loc) · 21.1 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
#!/bin/bash
# ─────────────────────────────────────────────────────────────────────────────
# Pentester Terminal — Linux Setup & Launcher
# Checks and installs all dependencies, then starts the server.
# ─────────────────────────────────────────────────────────────────────────────
set -e
# ── Colors ────────────────────────────────────────────────────────────────────
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
CYAN='\033[0;36m'
BOLD='\033[1m'
RESET='\033[0m'
ok() { echo -e "${GREEN} ✓ $1${RESET}"; }
warn() { echo -e "${YELLOW} ⚠ $1${RESET}"; }
info() { echo -e "${CYAN} → $1${RESET}"; }
err() { echo -e "${RED} ✗ $1${RESET}"; }
hdr() { echo -e "\n${BOLD}${CYAN}$1${RESET}"; echo -e "${CYAN}$(printf '─%.0s' {1..52})${RESET}"; }
# ── Banner ────────────────────────────────────────────────────────────────────
echo -e "${BOLD}${RED}"
echo " ██████╗ ███████╗███╗ ██╗████████╗███████╗███████╗████████╗███████╗██████╗ "
echo " ██╔══██╗██╔════╝████╗ ██║╚══██╔══╝██╔════╝██╔════╝╚══██╔══╝██╔════╝██╔══██╗"
echo " ██████╔╝█████╗ ██╔██╗ ██║ ██║ █████╗ ███████╗ ██║ █████╗ ██████╔╝"
echo " ██╔═══╝ ██╔══╝ ██║╚██╗██║ ██║ ██╔══╝ ╚════██║ ██║ ██╔══╝ ██╔══██╗"
echo " ██║ ███████╗██║ ╚████║ ██║ ███████╗███████║ ██║ ███████╗██║ ██║"
echo " ╚═╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚══════╝╚══════╝ ╚═╝ ╚══════╝╚═╝ ╚═╝"
echo ""
echo " ████████╗███████╗██████╗ ███╗ ███╗██╗███╗ ██╗ █████╗ ██╗ "
echo " ╚══██╔══╝██╔════╝██╔══██╗████╗ ████║██║████╗ ██║██╔══██╗██║ "
echo " ██║ █████╗ ██████╔╝██╔████╔██║██║██╔██╗ ██║███████║██║ "
echo " ██║ ██╔══╝ ██╔══██╗██║╚██╔╝██║██║██║╚██╗██║██╔══██║██║ "
echo " ██║ ███████╗██║ ██║██║ ╚═╝ ██║██║██║ ╚████║██║ ██║███████╗"
echo " ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝╚══════╝"
echo -e "${RESET}"
echo -e " ${BOLD}Linux Setup & Launcher${RESET}"
echo -e " ${CYAN}https://pentesterhelper.in${RESET}\n"
# ── 0. Must NOT be root for pywebview safety, but allow with warning ──────────
if [ "$EUID" -eq 0 ]; then
warn "Running as root. Proceeding anyway (some GUI features may differ)."
fi
# ── 1. Detect distro & package manager ───────────────────────────────────────
hdr "[ 1/6 ] Detecting System"
DISTRO="unknown"
PKG_MGR=""
if command -v apt-get &>/dev/null; then
PKG_MGR="apt"
DISTRO=$(grep '^ID=' /etc/os-release 2>/dev/null | cut -d= -f2 | tr -d '"' || echo "debian-based")
elif command -v dnf &>/dev/null; then
PKG_MGR="dnf"
DISTRO=$(grep '^ID=' /etc/os-release 2>/dev/null | cut -d= -f2 | tr -d '"' || echo "fedora-based")
elif command -v pacman &>/dev/null; then
PKG_MGR="pacman"
DISTRO="arch"
elif command -v zypper &>/dev/null; then
PKG_MGR="zypper"
DISTRO="opensuse"
else
warn "Unknown package manager. Will try pip-only install."
PKG_MGR="unknown"
fi
ok "Distro : $DISTRO"
ok "Pkg Mgr: $PKG_MGR"
ok "Arch : $(uname -m)"
# ── 2. Python 3.10+ check ─────────────────────────────────────────────────────
hdr "[ 2/6 ] Python"
install_python() {
info "Installing Python 3..."
case "$PKG_MGR" in
apt) sudo apt-get update -qq && sudo apt-get install -y python3 python3-pip python3-venv ;;
dnf) sudo dnf install -y python3 python3-pip ;;
pacman) sudo pacman -Sy --noconfirm python python-pip ;;
zypper) sudo zypper install -y python3 python3-pip ;;
*) err "Cannot auto-install Python. Please install Python 3.10+ manually."; exit 1 ;;
esac
}
if ! command -v python3 &>/dev/null; then
warn "Python3 not found — installing..."
install_python
else
PYVER=$(python3 -c 'import sys; print(f"{sys.version_info.major}.{sys.version_info.minor}")')
PYMIN=$(python3 -c 'import sys; print(1 if sys.version_info >= (3,10) else 0)')
if [ "$PYMIN" -eq 0 ]; then
warn "Python $PYVER found but 3.10+ required — attempting upgrade..."
install_python
else
ok "Python $PYVER ✓"
fi
fi
# Ensure pip
if ! python3 -m pip --version &>/dev/null 2>&1; then
info "pip not found — installing..."
case "$PKG_MGR" in
apt) sudo apt-get install -y python3-pip ;;
dnf) sudo dnf install -y python3-pip ;;
pacman) sudo pacman -Sy --noconfirm python-pip ;;
zypper) sudo zypper install -y python3-pip ;;
*) python3 -m ensurepip --upgrade || true ;;
esac
fi
ok "pip ✓"
# ── 3. System packages (GTK / WebKit for pywebview) ──────────────────────────
hdr "[ 3/6 ] System Dependencies"
install_sys_pkg() {
local pkg="$1"
case "$PKG_MGR" in
apt) sudo apt-get install -y "$pkg" ;;
dnf) sudo dnf install -y "$pkg" ;;
pacman) sudo pacman -Sy --noconfirm "$pkg" ;;
zypper) sudo zypper install -y "$pkg" ;;
esac
}
check_and_install_sys() {
local cmd="$1"
local pkg="$2"
local label="$3"
if command -v "$cmd" &>/dev/null || python3 -c "import $cmd" &>/dev/null 2>&1; then
ok "$label ✓"
else
info "Installing $label ($pkg)..."
install_sys_pkg "$pkg" && ok "$label installed ✓" || warn "$label install failed — continuing"
fi
}
# apt-specific system libs needed for pywebview
if [ "$PKG_MGR" = "apt" ]; then
SYS_PKGS=(
"python3-gi"
"python3-gi-cairo"
"gir1.2-gtk-3.0"
"gir1.2-webkit2-4.1"
"libgtk-3-dev"
"libwebkit2gtk-4.1-dev"
"python3-dev"
"libgirepository1.0-dev"
"gcc"
"pkg-config"
"openvpn"
"xdg-utils"
)
info "Updating apt cache..."
sudo apt-get update -qq 2>/dev/null || true
for pkg in "${SYS_PKGS[@]}"; do
if dpkg -s "$pkg" &>/dev/null 2>&1; then
ok "$pkg ✓"
else
info "Installing $pkg..."
sudo apt-get install -y "$pkg" 2>/dev/null && ok "$pkg installed ✓" || warn "$pkg failed — continuing"
fi
done
elif [ "$PKG_MGR" = "dnf" ]; then
SYS_PKGS=("python3-gobject" "webkit2gtk4.1" "gtk3" "openvpn" "xdg-utils")
for pkg in "${SYS_PKGS[@]}"; do
rpm -q "$pkg" &>/dev/null && ok "$pkg ✓" || { info "Installing $pkg..."; sudo dnf install -y "$pkg" && ok "$pkg ✓" || warn "$pkg failed"; }
done
elif [ "$PKG_MGR" = "pacman" ]; then
SYS_PKGS=("python-gobject" "webkit2gtk" "gtk3" "openvpn" "xdg-utils")
for pkg in "${SYS_PKGS[@]}"; do
pacman -Q "$pkg" &>/dev/null && ok "$pkg ✓" || { info "Installing $pkg..."; sudo pacman -Sy --noconfirm "$pkg" && ok "$pkg ✓" || warn "$pkg failed"; }
done
else
warn "Skipping system package install for unknown package manager."
warn "Please ensure: gtk3, webkit2gtk, openvpn, xdg-utils are installed."
fi
# ── 4. Python pip packages ────────────────────────────────────────────────────
hdr "[ 4/6 ] Python Packages"
PIP_PKGS=(
"aiohttp>=3.9"
"psutil>=5.9"
"pywebview>=5.0"
)
PIP_CMD="python3 -m pip install --upgrade"
# Use --break-system-packages on newer Debian/Ubuntu
if python3 -m pip install --help 2>&1 | grep -q "break-system-packages"; then
PIP_CMD="$PIP_CMD --break-system-packages"
fi
for pkg in "${PIP_PKGS[@]}"; do
pkg_name=$(echo "$pkg" | sed 's/[>=<].*//')
if python3 -c "import ${pkg_name//-/_}" &>/dev/null 2>&1; then
ok "$pkg_name ✓"
else
info "Installing $pkg..."
$PIP_CMD "$pkg" && ok "$pkg_name installed ✓" || {
warn "$pkg_name failed via pip — trying with sudo..."
sudo $PIP_CMD "$pkg" && ok "$pkg_name installed ✓" || err "$pkg_name install failed!"
}
fi
done
# Verify critical imports
hdr "[ 5/6 ] Verifying Imports"
IMPORTS=("aiohttp" "psutil" "webview")
ALL_OK=true
for mod in "${IMPORTS[@]}"; do
if python3 -c "import $mod" &>/dev/null 2>&1; then
ok "$mod ✓"
else
err "$mod FAILED to import!"
ALL_OK=false
fi
done
# stdlib checks
STD_MODS=("pty" "sqlite3" "asyncio" "json" "fcntl" "termios")
for mod in "${STD_MODS[@]}"; do
python3 -c "import $mod" &>/dev/null 2>&1 && ok "$mod ✓" || warn "$mod missing (unusual)"
done
if [ "$ALL_OK" = false ]; then
echo ""
err "Some dependencies failed to install."
err "Try running manually: sudo pip3 install aiohttp psutil pywebview"
echo ""
fi
# ── 5.5. Create Desktop Launcher ─────────────────────────────────────────────
hdr "[ 5.5 ] Desktop Launcher"
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
APP_PY="$SCRIPT_DIR/app.py"
DESKTOP_FILE="$HOME/Desktop/pentester-terminal.desktop"
APPS_FILE="$HOME/.local/share/applications/pentester-terminal.desktop"
ICON_DIR="$HOME/.local/share/icons"
# Prefer ui/logo.png from app directory — fallback to generated icon
if [ -f "$SCRIPT_DIR/ui/logo.png" ]; then
ICON_PATH="$SCRIPT_DIR/ui/logo.png"
ok "Using app logo → $ICON_PATH"
else
ICON_PATH="$ICON_DIR/pentester-terminal.png"
fi
# ── Create icon (PNG via Python) only if ui/logo.png not available ──────────
mkdir -p "$ICON_DIR"
# Write icon generation script to temp file and run it (fallback only)
if [ -f "$SCRIPT_DIR/ui/logo.png" ]; then
true # Already using app logo
else
cat > /tmp/_phtty_icon.py << 'ICONEOF'
import os, struct, zlib
icon_dir = os.path.expanduser("~/.local/share/icons")
os.makedirs(icon_dir, exist_ok=True)
out = os.path.join(icon_dir, "pentester-terminal.png")
try:
from PIL import Image, ImageDraw
img = Image.new("RGBA", (128, 128), (10, 6, 8, 255))
draw = ImageDraw.Draw(img)
draw.rectangle([6, 6, 122, 122], fill=(26, 13, 16, 255), outline=(232, 25, 44, 255), width=4)
draw.rectangle([18, 42, 110, 86], fill=(10, 6, 8, 255))
draw.polygon([(26, 52), (46, 64), (26, 76)], fill=(232, 25, 44, 255))
draw.rectangle([52, 72, 74, 78], fill=(232, 25, 44, 255))
img.save(out)
print(" Icon created (PIL) OK")
except ImportError:
def w32(n): return struct.pack(">I", n)
def chunk(t, d):
return w32(len(d)) + t + d + w32(zlib.crc32(t + d) & 0xffffffff)
W = H = 64
bg = (10, 6, 8)
bdr = (232, 25, 44)
sur = (26, 13, 16)
acc = (232, 25, 44)
rows = []
for y in range(H):
row = [0]
for x in range(W):
if x < 4 or x >= W-4 or y < 4 or y >= H-4:
row += list(bdr) + [255]
elif 18 <= y <= 46 and 8 <= x <= 56:
if 10 <= x <= 24 and 26 <= y <= 38:
row += list(acc) + [255]
elif 30 <= x <= 46 and 38 <= y <= 42:
row += list(acc) + [255]
else:
row += list(sur) + [255]
else:
row += list(bg) + [255]
rows.append(bytes(row))
raw = zlib.compress(b"".join(rows), 9)
sig = b"\x89PNG\r\n\x1a\n"
ihdr_data = w32(W) + w32(H) + bytes([8,2,0,0,0])
png = sig + chunk(b"IHDR", ihdr_data) + chunk(b"IDAT", raw) + chunk(b"IEND", b"")
# Fix PNG signature
png = bytes([0x89,0x50,0x4e,0x47,0x0d,0x0a,0x1a,0x0a]) + png[8:]
open(out, "wb").write(png)
print(" Icon created (fallback) OK")
ICONEOF
python3 /tmp/_phtty_icon.py && ok "Icon created → $ICON_PATH" || warn "Icon creation failed"
rm -f /tmp/_phtty_icon.py
fi # end: if logo not found
# ── Write .desktop file ──────────────────────────────────────────────────────
write_desktop() {
local target="$1"
mkdir -p "$(dirname "$target")"
cat > "$target" << DESKTOP_EOF
[Desktop Entry]
Version=1.0
Type=Application
Name=Pentester Terminal
GenericName=Hacking Terminal
Comment=Pentester Helper Terminal — Nmap, VPN, RevShell, Fuzzer
Exec=bash -c "cd $SCRIPT_DIR && sudo python3 $APP_PY"
Icon=$ICON_PATH
Terminal=false
Categories=Security;Network;System;
Keywords=pentest;nmap;vpn;revshell;fuzz;hacking;terminal;
StartupNotify=true
DESKTOP_EOF
chmod +x "$target"
}
# Write to Desktop — try multiple common locations
DESKTOP_DIR=""
for _try_dir in "$HOME/Desktop" "/root/Desktop" "$HOME/desktop" "$(xdg-user-dir DESKTOP 2>/dev/null)" "/home/$SUDO_USER/Desktop"
do
if [ -n "$_try_dir" ] && [ -d "$_try_dir" ]; then
DESKTOP_DIR="$_try_dir"
break
fi
done
# Still not found — create it
if [ -z "$DESKTOP_DIR" ]; then
mkdir -p "$HOME/Desktop" 2>/dev/null && DESKTOP_DIR="$HOME/Desktop"
fi
if [ -n "$DESKTOP_DIR" ]; then
DESKTOP_FILE="$DESKTOP_DIR/PentesterTerminal.desktop"
write_desktop "$DESKTOP_FILE"
gio set "$DESKTOP_FILE" metadata::trusted true 2>/dev/null || true
chmod +x "$DESKTOP_FILE" 2>/dev/null || true
ok "Desktop shortcut created → $DESKTOP_FILE"
else
warn "Could not create desktop shortcut"
fi
# Write to applications menu (always)
write_desktop "$APPS_FILE"
update-desktop-database "$HOME/.local/share/applications" 2>/dev/null || true
ok "App menu entry created → $APPS_FILE"
# ── Auto-add to XFCE panel (no dialog popup) ─────────────────────────────────
add_to_xfce_panel() {
# Find real user (not root) for xfconf operations
local REAL_USER="${SUDO_USER:-$USER}"
local REAL_HOME
REAL_HOME=$(getent passwd "$REAL_USER" 2>/dev/null | cut -d: -f6 || echo "$HOME")
local PANEL_CFG_DIR="$REAL_HOME/.config/xfce4/panel"
mkdir -p "$PANEL_CFG_DIR"
# Only run if xfce4-panel is active
if ! pgrep -x xfce4-panel &>/dev/null; then
return 1
fi
# Get DBUS address of the real user session (not root)
local USER_DBUS=""
if [ -n "$SUDO_USER" ]; then
local UID_REAL
UID_REAL=$(id -u "$SUDO_USER" 2>/dev/null || echo "")
USER_DBUS=$(cat /run/user/${UID_REAL}/bus 2>/dev/null | head -1 || ls /run/user/${UID_REAL}/ 2>/dev/null | grep -i dbus | head -1 || echo "")
[ -n "$UID_REAL" ] && USER_DBUS="unix:path=/run/user/${UID_REAL}/bus"
fi
# Run xfconf as real user with correct DBUS session
local XQ_CMD
if [ -n "$SUDO_USER" ] && [ -n "$USER_DBUS" ]; then
XQ_CMD="sudo -u $SUDO_USER env DBUS_SESSION_BUS_ADDRESS=$USER_DBUS xfconf-query"
elif [ -n "$SUDO_USER" ]; then
XQ_CMD="sudo -u $SUDO_USER xfconf-query"
else
XQ_CMD="xfconf-query"
fi
# Find next available launcher slot number
local EXISTING
EXISTING=$($XQ_CMD -c xfce4-panel -p /panels/panel-1/plugin-ids 2>/dev/null || echo "")
if [ -z "$EXISTING" ]; then
return 1
fi
# Find highest plugin ID currently used
local MAX_ID=0
for id in $($XQ_CMD -c xfce4-panel -p /panels/panel-1/plugin-ids 2>/dev/null | grep -Eo '[0-9]+'); do
[ "$id" -gt "$MAX_ID" ] && MAX_ID=$id
done
local NEW_ID=$((MAX_ID + 1))
# Create launcher config directory (owned by real user)
local LAUNCHER_DIR="$PANEL_CFG_DIR/launcher-${NEW_ID}"
mkdir -p "$LAUNCHER_DIR"
chown "$REAL_USER:$REAL_USER" "$LAUNCHER_DIR" 2>/dev/null || true
# Write .desktop file into launcher dir
cat > "$LAUNCHER_DIR/pentester-terminal.desktop" << LEOF
[Desktop Entry]
Version=1.0
Type=Application
Name=Pentester Terminal
Comment=Pentester Helper Terminal
Exec=bash -c "cd $SCRIPT_DIR && sudo python3 $APP_PY"
Icon=$ICON_PATH
Terminal=false
Categories=Security;Network;System;
StartupNotify=true
LEOF
# Register plugin with xfconf (as real user)
$XQ_CMD -c xfce4-panel -p /plugins/plugin-${NEW_ID} -t string -s launcher --create 2>/dev/null || true
$XQ_CMD -c xfce4-panel -p /plugins/plugin-${NEW_ID}/items -t string -s "pentester-terminal.desktop" --create --force-array 2>/dev/null || true
# Add plugin ID to panel
local CURRENT_IDS
CURRENT_IDS=$($XQ_CMD -c xfce4-panel -p /panels/panel-1/plugin-ids 2>/dev/null | grep -Eo '[0-9]+' | tr '
' ' ')
local NEW_IDS_ARGS=""
for id in $CURRENT_IDS $NEW_ID; do
NEW_IDS_ARGS="$NEW_IDS_ARGS -t int -s $id"
done
eval "$XQ_CMD -c xfce4-panel -p /panels/panel-1/plugin-ids --force-array $NEW_IDS_ARGS" 2>/dev/null || true
# Reload panel config by writing directly — NO xfce4-panel --restart (causes DBus error dialog)
# Just touch the config so panel picks it up on next interaction
touch "$PANEL_CFG_DIR" 2>/dev/null || true
# Send SIGUSR1 to reload launchers without full restart
pkill -SIGUSR1 -x xfce4-panel 2>/dev/null || true
return 0
}
# ── Auto-add to GNOME/KDE favorites (taskbar) ────────────────────────────────
add_to_gnome_favorites() {
if ! command -v gsettings &>/dev/null; then return 1; fi
local CURRENT
CURRENT=$(gsettings get org.gnome.shell favorite-apps 2>/dev/null || echo "[]")
if echo "$CURRENT" | grep -q "pentester-terminal"; then
return 0 # already there
fi
# Insert before last ]
local NEW_FAVS
NEW_FAVS=$(echo "$CURRENT" | sed "s/]$/, 'pentester-terminal.desktop']/")
gsettings set org.gnome.shell favorite-apps "$NEW_FAVS" 2>/dev/null || true
return 0
}
# Detect desktop environment and add accordingly
DE="${XDG_CURRENT_DESKTOP:-}"
DE_LOWER=$(echo "$DE" | tr '[:upper:]' '[:lower:]')
if echo "$DE_LOWER" | grep -q "xfce"; then
if add_to_xfce_panel; then
ok "XFCE panel launcher added ✓"
else
warn "XFCE panel auto-add failed — drag the desktop icon to panel manually"
fi
elif echo "$DE_LOWER" | grep -qE "gnome|ubuntu"; then
if add_to_gnome_favorites; then
ok "GNOME taskbar launcher added ✓"
else
warn "GNOME taskbar auto-add failed"
fi
else
# Try both silently
add_to_xfce_panel 2>/dev/null || true
add_to_gnome_favorites 2>/dev/null || true
ok "Panel launcher attempted (DE: ${DE:-unknown})"
fi
# Also create a quick-launch shell alias
BASHRC="$HOME/.bashrc"
ALIAS_LINE="alias pentester-terminal='cd $SCRIPT_DIR && sudo python3 $APP_PY'"
if ! grep -q "alias pentester-terminal=" "$BASHRC" 2>/dev/null; then
echo "" >> "$BASHRC"
echo "# Pentester Terminal" >> "$BASHRC"
echo "$ALIAS_LINE" >> "$BASHRC"
ok "Shell alias added → ~/.bashrc"
info "Run: source ~/.bashrc (or open new terminal)"
else
ok "Shell alias already exists in ~/.bashrc"
fi
# ── 6. Launch ─────────────────────────────────────────────────────────────────
hdr "[ 6/6 ] Launching Pentester Terminal"
# Check app.py exists
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
APP_PY="$SCRIPT_DIR/app.py"
if [ ! -f "$APP_PY" ]; then
err "app.py not found in $SCRIPT_DIR"
err "Make sure setup_linux.sh is in the same directory as app.py"
exit 1
fi
ok "Found app.py → $APP_PY"
info "Starting Pentester Terminal..."
echo ""
echo -e " ${BOLD}${GREEN}● Pentester Terminal is starting...${RESET}"
echo -e " ${CYAN}Open: http://localhost:3004${RESET}"
echo ""
cd "$SCRIPT_DIR"
sudo python3 app.py