#!/bin/bash
# Wrapper script to run pcileech-tui with sudo while preserving Python path

# Get the path to the installed pcileech-tui script
PCILEECH_TUI_PATH=$(which pcileech-tui)

if [ -z "$PCILEECH_TUI_PATH" ]; then
    echo "Error: pcileech-tui not found in PATH"
    exit 1
fi

# Get Python site-packages directories
PYTHON_USER_SITE=$(python3 -m site --user-site)
PYTHON_SITE_PACKAGES=$(python3 -c "import site; print(':'.join(site.getsitepackages()))")

# Run with sudo, preserving the PYTHONPATH and PATH
echo "Running pcileech-tui with sudo and preserved Python paths..."
sudo PATH="$PATH" PYTHONPATH="$PYTHONPATH:$PYTHON_USER_SITE:$PYTHON_SITE_PACKAGES" "$PCILEECH_TUI_PATH"