# Native Linux Deployment Guide (Ubuntu / Kali / Arch)

The current environment is a cloud-hosted web application. Web browsers enforce strict security sandboxes that prevent direct access to low-level hardware, raw sockets, and native system drivers. 

To achieve **full-scope hardware access** (raw Bluetooth LE, USB bridging, ADB daemon execution) natively on AMD64 Linux distributions (Ubuntu, Kali, Arch), you must export this codebase and wrap it in a desktop application framework or run it via a privileged container.

## Architecture for Native Hardware Access

To convert this React frontend into a native Linux tool, you should use **Electron** or **Tauri**.

1. **Frontend (React/Vite)**: The UI we have built here.
2. **Backend (Node.js or Rust)**: Runs locally on the host machine with root/sudo privileges.
3. **Hardware Libraries**:
   - **Bluetooth**: `@abandonware/noble` (Node.js) or `btleplug` (Rust) for raw BLE access via BlueZ.
   - **USB/ADB**: `usb` (Node.js libusb wrapper) for direct device interfacing.
   - **Terminal**: `node-pty` to spawn real bash/zsh/powershell processes.

## 1. Virtualization / Containerization (Docker)

If you want to deploy this in an isolated environment on your Linux host while maintaining hardware access, use the provided `Dockerfile` and `docker-compose.yml`.

To run this with hardware passthrough on your local Kali/Ubuntu machine:

```bash
# 1. Export this project as a ZIP from the AI Studio settings menu.
# 2. Extract it on your local Linux machine.
# 3. Run the privileged container:
docker-compose up --build
```

*Note: The `privileged: true` and `network_mode: "host"` flags in the docker-compose file are critical. They allow the container to access the host's `dbus` and `hci0` (Bluetooth) interfaces.*

## 2. Native Desktop Packaging (Electron)

To build a standalone `.deb`, `.rpm`, or `.AppImage` (which runs on any AMD64 Linux distro out of the box):

1. Install Electron and Electron Builder:
   ```bash
   npm install --save-dev electron electron-builder concurrently wait-on
   ```

2. Create an `electron/main.js` file to bootstrap the native window and handle hardware IPC (Inter-Process Communication).

3. Update your `package.json` to include build targets for Linux:
   ```json
   "build": {
     "appId": "com.forensic.viewer",
     "linux": {
       "target": ["AppImage", "deb", "pacman"],
       "category": "Utility"
     }
   }
   ```

4. Build the native Linux binaries:
   ```bash
   npm run build
   npx electron-builder --linux
   ```

## 3. Required Linux Dependencies

For the native hardware libraries (like `noble` for BlueZ) to compile on your AMD64 Linux machine, you will need the following system packages installed natively:

**Ubuntu / Kali / Debian:**
```bash
sudo apt-get install bluetooth bluez libbluetooth-dev libudev-dev build-essential
```

**Arch Linux:**
```bash
sudo pacman -S bluez bluez-utils base-devel
```
