Reverse Tethering & Screen Mirroring Qube for Android Device 📱

Original forum link
https://forum.qubes-os.org/t/28920
Original poster
glockmane
Created at
2024-09-12 15:42:55
Last wiki edit
2024-11-09 10:57:25
Revisions
4 revisions
Posts count
8
Likes count
0
Tags
hardware, networking, template

Reverse Tethering & Screen Mirroring Qube for Android Device 📱 Control your Android Device from Qubes OS while providing Network to the Android Device

🛑 Guide utilizes USB Debugging which can add significant Attack Surface to your Android Device, use at your own risk! 🛑

1) Create Template Qube from fedora-40-xfce Template 2) Install scrcpy with

sudo dnf copr enable zeno/scrcpy && sudo dnf install scrcpy

3) Create App Qube from the Template we just created 4) Passthrough USB Controller to App Qube, switch Virt Mode to hvm 5) Run Terminal on App Qube 6) Install homebrew with

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

8) Install gnirehtet with

brew install gnirehtet

9) Create connect_android.sh

nano ~/.local/connect_android.sh

With the following Content:

sudo adb devices
/home/user/start_scrcpy.sh &
/home/user/start_gnirehtet.sh

Make it executable:

chmod u+x ~/.local/connect_android.sh

10) Create start_scrcpy.sh

nano ~/.local/start_scrcpy.sh

With the following Content:

scrcpy

Make it executable:

chmod u+x ~/.local/start_scrcpy.sh

11) Create start_gnirehtet.sh

nano ~/.local/start_gnirehtet.sh

With the following Content:

/home/linuxbrew/.linuxbrew/Cellar/gnirehtet/2.5.1/bin/gnirehtet run

Make it executable:

chmod u+x ~/.local/start_gnirehtet.sh

12) Create connect_android.desktop

nano ~/.local/share/applications/connect_android.desktop

With the following Content:

[Desktop Entry]
Name=Connect Android
GenericName=Connect Android Hardware Device
Comment=Authorize ADB, Control & Reverse Tether
Exec=/home/user/connect_android.sh
Icon=terminal
Terminal=true
Type=Application
Categories=Utility;Network;
StartupNofity=true

Make it executable:

chmod u+x ~/.local/share/applications/connect_android.desktop

13) Refresh App List in Qubes Settings 14) Enable Developer Settings & USB Debugging on Android Device 15) Connect Android Device via USB 16) Make sure other Qubes which passthrough the same USB Controller (e.g. sys-usb) are shutted down 17) Launch "Connect Android" Shortcut 18) Authorize ADB when prompt is shown on Android Device