Portable Pentesting VR Rig & Linux Workstation with Samsung Gear, the Jelly Comb Foldable Keyboard, Termux, and Kali NetHunter

Syed R Ali
15 min readFeb 23, 2020
Neuromancer
Image by Rafael Moco from ArtStation

In 1980s Cyberpunk science fiction, a cyberdeck is a device used to access the virtual representation of Cyberspace. It is a simulated, “consensual hallucination” that facilitates the handling and exchanging of massive data, humanity’s extended electronic nervous system. The deck is connected to a tiara-like device that uses electrodes to stimulate the user’s brain while drowning out other external stimulation.

A standard cyberdeck is about the size of a paperback book, is made of plastic and weighs about half a kilogram. A standard trope in the fiction was users with these devices testing and penetrating data networks via this virtual reality device. Most of this fiction was set in the first half of the 21st century.

Oculus Rift S PC-powered VR gaming headset
Image by Oculus from Amazon

Oculus is an American technology company founded in July 2012 in Irvine, California, now based in Menlo Park. It specializes in virtual reality hardware and software products. Palmer Luckey, a Head-Mounted Display designer at the University of Southern California, earned a reputation for having the largest personal collection of HMDs globally and was a longtime moderator in Meant to be Seen’s discussion forums.

Through MTBS’s forums, Palmer developed the idea of creating a new head-mounted display that was both more effective than what was currently on the market and was also inexpensive for gamers. To develop the new product, Luckey founded Oculus VR.

Gear VR headset
Image by Gear from Samsung

Samsung Gear VR is a virtual reality headset developed by Samsung Electronics in collaboration with Oculus VR and manufactured by Samsung. Samsung first released the headset on November 27, 2015. When in use, a compatible Samsung Galaxy device acts as the headset’s display and processor, while the Gear VR unit itself acts as the controller, which contains the field of view, as well as a custom Inertial Measurement Unit, for rotational tracking, which connects to the smartphone via USB-C or micro-USB. The Gear VR headset also includes a touchpad and back button on the side and a proximity sensor to detect when the headset is on.

Foldable Bluetooth keyboard
Image by Jelly Comb from Amazon

The Tri-fold Wireless Ultra-Slim Portable Bluetooth Keyboard with touchpad function is a keyboard from Jelly Comb with convenience and mini size for the user. Made of aluminium, ultra-slim foldable design and pocket size. It has the quality of Aircraft-grade aluminium for superior stiffness, light & fast heat dissipation, and a sleek design.

The keyboard also features a QWERTY layout with hotkeys, compatible with iOS / Mac OS, Android, Windows, and all Bluetooth enabled devices using the advanced Bluetooth 3.0 chip, providing high-speed connection and signal distance up to 15m.

Termux
Image by Termux from Google Play

Termux is an Android terminal emulator and Linux environment application that works directly with no rooting or setup. A minimal base system is installed automatically; additional packages are available using the APT package manager. Termux combines powerful terminal emulation with an extensive Linux package collection.

Complete hacking tools in Kali Linux
Image by Nhà Sách Tin Học from Blogspot

Kali Linux is a Debian-derived Linux distribution designed for digital forensics and penetration testing. It is maintained and funded by Offensive Security. It is a sophisticated, modern-day Linux distribution aimed at penetration testers and security experts. Kali comes with a pre-installed set of advanced, security-focused tools such as Nmap, Aircrack-ng, and Wireshark.

If you are a security enthusiast or a starting ethical hacker, this can be the ideal platform for you. Kali has become the de-facto platform for security professionals due to several reasons. It includes most of the tools required in modern penetration testing, such as reconnaissance and delivery of payloads.

Kali NetHunter for Android Devices
Image by Kali Nethunter from Kali

The Kali Linux NetHunter project is the first open-source Android penetration testing platform for Google-based devices, created as a joint effort between the Kali Linux community member BinkyBear and Offensive Security. NetHunter supports Wireless 802.11 frame injection, one-click MANA Evil Access Point setups, HID keyboard (Teensy like attacks), and BadUSB MITM attacks built upon the sturdy shoulders of the Kali Linux distribution and toolsets. The Kali Linux NetHunter Edition software is the same as the parent OS but designed to be suitable for the Arm processor chip used in smartphones.

All in one tool for information gathering and vulnerability scanning
Image by Tuhinshubhra from GitHub

Red Hawk is a Kali Linux all-in-one tool for information gathering and vulnerability scanning. It is a PHP based web application scanner used for information gathering purpose. Red Hawk detects Content Management Systems used by a target web application, IP address, web server record, Cloudflare information, and robots.txt data. It can detect WordPress, Drupal, Joomla, and Magento CMS.

Red Hawk's other scanning features include WHOIS data collection, Geo-IP lookup, Banner grabbing, DNS lookup, port scanning, sub-domain information, reverse IP, and MX records lookup. As a vulnerability scanner, Red Hawk looks for error based SQL injections, WordPress sensitive files, and WordPress version related vulnerabilities.

Samsung PhoneCast VR
Image by Samsung Mobile Press from Samsung

Samsung PhoneCast VR allows you to view your favourite mobile media content on the Gear VR. You can mirror compatible 2D mobile media applications on a virtual 200-inch screen with a scenic 360-degree background. You can enjoy viewing your favourite mobile video application in your private theatre at a scenic lakeside campground.

To do more than viewing, you can ‘Go to Labs’. Here Samsung brought mobile applications installed on your device into your VR world so you can do anything else you can do on your mobile phone in immersive 3 dimensional VR.

Termux unixporn
Image by boseka from Reddit

To get started building a portable pentesting and Linux VR workstation with the above hardware and software, first install Termux on your Samsung Galaxy device. Open the Termux page in the Google Play Store or F-Droid and click on download. To get Termux working as a regular Linux system, first, open it and run:

pkg update && pkg upgrade
Hacker’s keyboard for Android
Image by Ryan Cullen from The Artesea

Regardless of using a Bluetooth physical keyboard, you will still need a good Android keyboard when using Termux without it. The Hacker’s Keyboard has the missing key layout you’re used to from your computer when using an Android device without a physical keyboard.

This software keyboard has separate number keys, punctuation in the usual places, and arrow keys. It is based on the AOSP Gingerbread soft keyboard, so it supports multitouch for the modifier keys. This or an alternative are needed with Samsung devices as Samsung keyboards show behaviour not expected by Android API.

Termux styled
Image by FingerTips SN from YouTube

Termux:Styling is a Termux add-on app to customize the terminal font and colour theme. It will allow you to customise your Termux terminal to fit the aesthetics that you desire. For installation, the Termux: you can obtain styling application from Google Play or F-Droid.

Important: Do not mix installations of Termux and Addons between Google Play and F-Droid. They are presented at these portals for your convenience. There are compatibility issues when mixing installations from these Internet portals.

This is because each download website uses a specific key for key-signing, Termux and Addons. When developing (or packaging), note that this app needs to be signed with the same key as the main Termux app to have permission to modify the required font or colour files.

How to use:

  1. When inside Termux, long press anywhere on the terminal.
  2. Select More… in the resulting dialogue.
  3. Select Style in the next dialogue.
  4. Click either CHOOSE COLOR or CHOOSE FONT, depending on what you want to customize.
Allow Termux to access photos, media, and files on your device
Image source unknown

To access shared and external storage in Termux, you need to run the below command. You will then be prompted to “Allow Termux access photos, media and files on your device”, which you should allow.

termux-setup-storage

Shared storage will then be available in the ~storage directory in Termux. The contents of the created folder are symlinks to different storage folders on your device.

Edit configuration file in Vim
Image by Waraqa from Blogspot

Vim is a highly configurable text editor for efficiently creating and changing any text. It is included as “vi” with most Unix-based systems and with Apple OS X. You can install vim in Termux with:

pkg install vim

The Ultimate Vim Configuration has Vim configurations based on the author’s decade of Vim usage. There are two versions:

  • The Basic: If you want something small, just copy basic.vim into your ~/.vimrc and you will have a good basic setup
  • The Awesome: Includes a ton of useful plugins, colour schemes, and configurations

The basic version is useful to install on remote servers where you don’t need many plugins and you don’t do a lot of the main editing. This version should be fine for a retrofuturist/low-fi themed Android-based terminal.

git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime
sh ~/.vim_runtime/install_basic_vimrc.sh
Zsh
Image source unknown

The Z shell (Zsh) is a Unix shell that can be used as an interactive login shell and a command interpreter for shell scripting. Zsh is an extended Bourne shell with many useful improvements for day-to-day usage, including some features of bash, ksh, and tcsh. Oh My Zsh is an open-source, community-driven framework for managing your zsh configuration. To install zsh and Oh My Zsh on Termux, update the Packages:

pkg up

Install the required packages (curl, git,zsh and nano):

pkg install curl
pkg install git
pkg install zsh
pkg install nano

Clone the Oh My Zsh Github repository:

git clone https://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh

Create a New ZSH configuration file:

cp ~/.oh-my-zsh/templates/zshrc.zsh-template ~/.zshrc

Set up a theme for your Terminal (the agnoster ZSH Theme is popular, although I prefer the default robbyrussell theme) You can select one from the full list of Oh My Zsh Themes). Open .zshrc an editor:

vi .zshrc

Find the line ZSH_THEME=”robbyrussell” replace robbyrussell with agnoster theme in the .zshrc file.

ZSH_THEME="agnoster"

Use Z-shell as Default Shell:

chsh -s zsh

For Fish Shell-like syntax highlighting, install ZSH Syntax Highlighting for Oh My Zsh:

git clone https://github.com/zsh-users/zsh-syntax-highlighting.git "$HOME/.zsh-syntax-highlighting" --depth 1

Now add the syntax-highlighting to .zshrc configuration:

echo "source $HOME/.zsh-syntax-highlighting/zsh-syntax-highlighting.zsh" >> "$HOME/.zshrc"
Termux-Banner
Image source unknown

Termux-Banner is a banner maker script. It’s simply for giving your terminal a retrofuturist aesthetic when opened in VR. To install it for Zsh, follow the below steps and enter in your banner messages when it asks:

git clone https://github.com/Bhai4You/Termux-Bannercd Termux-Banner/zshchmod +x requirement.shchmod +x t-ban.shbash requirement.shbash t-ban.sh
CMatrix
Image source unknown

CMatrix is based on the screensaver from The Matrix website. It shows text flying in and out in a terminal, as seen in “The Matrix” movie. It can scroll lines all at the same rate or asynchronously and at a user-defined speed. The only purpose of this is for the cyberpunk aesthetics it provides in your terminal when viewed in VR.

pkg install cmatrixcmatrix

CMatrix, by default, operates in eye candy mode. You must abort it with Ctrl C or by pressing q. If you wish for more of a screen saver effect, you must specify -s on the command line. For usage info, use cmatrix -h.

Tmux
Image source unknown

Tmux is a terminal multiplexer: it enables several terminals to be created, accessed, and controlled from a single screen. tmux may be detached from a screen and continue running in the background, then later reattached. It will be needed to manage user input into a terminal screen in the VR environment. To install and run tmux, type the commands:

pkg install tmuxtmux

To split your single pane into a left and a right pane, you press Ctrl and b at the same time, release both, and then type the % key. There’s an option to split into left and right, and there’s also a split into top and bottom pane. To split a pane into the top and bottom panes, use the C-b " shortcut.

Switching to a different pane uses the C-b <arrow key> shortcut, where <arrow key> is the arrow key pointing to the pane you want to switch to. Closing a pane is as simple as closing a regular terminal session. Either type exit or hit Ctrl-d And it’s gone.

Creating new windows is done by typing C-b c. tmux will then present the new window to you in tmux’s status bar. This window can be divided into panes as above. To switch to the previous window (according to the order in your status bar) use C-b n and to switch to the next window use C-b n.

If you’ve created many windows, you might find it useful to go to a window directly by typing its number (the status bar will tell you which window has which number); use C-b <number> where <number> is the number in front of the window’s name in your status bar.

Neofetch
Image source unknown

Neofetch is a command-line system information tool written in bash 3.2+. Neofetch displays information about your operating system, software and hardware in an aesthetic and visually pleasing way. The information by default is displayed alongside your operating system’s logo.

It is a useful application to have on a Linux-based workstation for information purposes. You can further configure Neofetch to use an image, a custom ASCII file, your wallpaper or nothing at all. It can be installed and run with the following two commands:

pkg install neofetchneofetch
Tracepath output
Image source unknown

Tracepath traces the path to a network host discovering MTU along this path. It is similar to traceroute, only it does not require superuser privileges and has no fancy options. tracepath is a good replacement for traceroute and a classic example of an application of Linux error queues. It traces the given IP by hopping from many devices/IP until it meets its target. Located at the stable repository. You need to install it first then you can perform tracing.

pkg install tracepath

Then the commands are:

tracepath [IP address or hostname]
ssh in Termux
Image by Parichay Barpanda from Medium

SSH provides a secure way for accessing remote hosts and replaces tools such as telnet, rlogin, rsh, FTP. Termux provides SSH via two packages: dropbear and OpenSSH. If you never used these tools before, it is recommended to install OpenSSH as it is more common.

pkg install openssh

This allows you to connect from your Android to your desktop or servers by SSH connection. To login to a remote machine where the ssh daemon is running at the standard port (22):

ssh user@hostname_or_ip

Same as above, but if the ssh daemon running on a different port, e.g. 8022:

ssh -p 8022 user@hostname_or_ip

Using public key authentication with ssh running on the standard port and a private key stored in the file `id_rsa`:

ssh -i id_rsa user@hostname_or_ip

Note that if id_rsa and will be stored in ~/.ssh directory, you can omit to specify it in the command. But if you have multiple keys, it is necessary to pick a specific key with -i {path_to_privkey}

If you wish to use an SSH agent to avoid entering passwords, the Termux OpenSSH package provides a wrapper script named ssha (note the a at the end) for ssh, which:

  • Starts the ssh-agent if necessary (or connect to it if already running).
  • Runs the ssh-add
  • Runs the ssh and with the provided arguments.

This means that the agent will initially prompt a key password but remember the subsequent runs' authorisation.

Kali Nethunter App Store
Image source unknown

The Kali NetHunter App Store is an installable catalogue of Android applications for penetration testing and forensics. It provides the Kali NetHunter Rootless Edition, which you can install on any stock, unrooted Android device without voiding the warranty.

Install the NetHunter-Store app and from there install the NetHunter installer, updater, and interface for Kali Linux on Android. Then to make NetHunter available in Termux, open a Termux terminal and type:

pkg install wgetwget -O install-nethunter-termux https://gitlab.com/kalilinux/nethunter/build-scripts/kali-nethunter-project/raw/master/nethunter-rootless/install-nethunter-termuxchmod +x install-nethunter-termux./install-nethunter-termux

After this has completed, start a NetHunter session and update the installation with the following commands:

nethunterapt update && apt full-upgrade

If you have plenty of storage space available, you might want to run apt install kali-linux-full as well.

Red Hawk banner
Image source unknown

Now, you need to download the Red Hawk scanning tool by typing in your Termux Kali NetHunter session:

git clone https://github.com/Tuhinshubhra/RED_HAWK.git

After downloading the tool, you can run it with:

cd RED_HAWK/php rhawk.php
New Gear VR and Gear VR controller
Image by Joshua Goldman from CNET

Your phone doesn’t come with the Gear VR software already installed, so you need to download it. To do that, you need to:

  1. Insert your phone into the Gear VR.
  2. Wait for a voice instructing you to remove the phone.
  3. Remove your phone from the Gear VR.
  4. Read the Agreement on the screen and tap Agree, then Next.
  5. Tap Install to download the Gear VR software.

How to set up your Gear VR software and pair your Gear VR Controller:

  1. Open the Oculus App on your phone.
  2. Sign in with your Facebook account.
  3. Tap Update Now to get the latest Gear VR software,
  4. Tap Pair and hold down the Home button on your Gear VR Controller to connect,
  5. Calibrate your Gear VR controller using the on-screen video guide
    Tap Left Handed or Right Handed to set Gear VR Controller preference,

And you’re finished! Your Gear VR is now fully ready to be used.

Android pair with Bluetooth keyboard
Image by Matt Klein and Cameron Summerson from How To Geek

It’s advisable to now get the folding keyboard or another Bluetooth keyboard of your choice paired and working with your Samsung Galaxy device to interact with the Termux terminal in VR. A full-sized keyboard is advisable as this will be easier to touch-type on when used in VR. In Android, enable Bluetooth if it isn’t already on. To enable Bluetooth, go to Settings > Bluetooth and tap the slider button to “On”.

Please turn on your Bluetooth keyboard and put it into pairing mode. It will usually go into pairing mode automatically after turning it on, though some keyboards may require an extra step. On the Bluetooth screen, your Android device should automatically search for and find your keyboard.

When Android finds your keyboard, select it under “Available Devices”, and you should be prompted to type in a code. If successful, you will see that the device is now “Connected”, and you’re ready to go.

If you find during use the key mappings are a mess, i.e. you can't use the esc button in vim etc., making sure the right language (e.g. English, UK) is set in the Android Bluetooth keyboard settings should fix that.

Samsung PhoneCast Beta
Image by Jen Karner from VRHeads

While it’s true that the main Samsung PhoneCast VR functionality is only available with specific compatible apps, your options open up dramatically if you are to opt-in for Samsung Labs.

This is an unstable version of the app, and you’ll need to agree to some terms and conditions before you can access it. Once you do that and have installed the PhoneCast VR Beta from the Oculus Gear VR Store, though, you’ll be able to launch just about any app that is installed on your phone.

Video by sxp from Reddit

As first demonstrated by Reddit user -sxp- in the HMDProgramming sub, you can open the PhoneCast app, navigate to Go to Labs, and from here, you can run the available apps on your phone, which include a Termux session.

This will now be configured as above as with zsh, vim, network diagnostic tools, and Kali NetHunter with Red Hawk on a 200 inch immersive VR screen in a 3D VR setting.

Video by syed-r-ali from Medium

This video demonstrates the complete set-up, running the Red Hawk pentesting scanner in Kali Linux NetHunter in Tmux alongside Neofetch in VR.

Tested use cases are editing scripts with Vim, running basic network diagnostics like traceroute, and pentesting my app server with NetHunter, all in immersive VR.

Video by syed-r-ali from Medium

The hardware consisting of just two physical pieces, the VR headset (with the attached smartphone) and foldable keyboard combined with the software consisting of standard Linux workstation and security tools demonstrate the functionality and aesthetics of the fictional cyberpunk cyberdeck as a modern useful workstation and pentesting device.

Bluetooth tethered Raspberry Pi Zero W-based Pwnagotchi
Image by syed-r-ali from Medium

Update 2020–03–13: This set-up goes great with a Bluetooth tethered Raspberry Pi Zero W-based Pwnagotchi. The pentesting VR rig/workstation gets an adorable connected semi-autonomous little AI buddy that learns from its surrounding WiFi environments to collect crackable WPA material, including full and half WPA handshakes as well as PMKIDs, to audit Wi-Fi keys automatically.

📝 Save this story in Journal.

👩‍💻 Wake up every Sunday morning to the week’s most noteworthy stories in Tech waiting in your inbox. Read the Noteworthy in Tech newsletter.

--

--

Syed R Ali

Londoner, desi, financial technologist, geek, weight training & combat sports junkie.