Monday, September 5, 2016

Installing Kali Linux on an Android smarthphone

The problem

In the time of writing a lot of the HOW-TOs available online, including Offensive Security's own guide, simply do not work. This post aims to guide anyone trying to install Kali Linux on his android smartphone.

The Requirements

  • A ROOTED android smartphone (Tested on Android 4.4.4, MTK6752)
  • A 16 GB class 10 SD card (It should work with internal storage somehow but haven't tested)
  • Linux Deploy
  • BusyBox
  • Link2SD
  • (Optional) An ssh app (I used ConnectBot)
  • (Optional) A VNC viewer app (I used VNC Viewer

Preparation

  1. Partition the SD and format each partition (THIS WILL DELETE YOUR DATA). You'll need:
    • 1st Partition 512 MB formatted in FAT32
    • 2nd Partition the rest of the SD formatted in EXT2
  2.  Install the APPs listed above
  3. Open Link2SD
  4. You should be greeted by this screen

    1. Select ext4 and press ok
    2. When prompted reboot your device
  5. Open BusyBox
    1. Press INSALL 

Installation

Update 2/2/17

  'sana' suit has now been removed from Kali's repositories and kali-rolling is installing correctly.
    1. Open Linux Deploy (From here on ensure constant Wifi connection and power)
      1. Press your phone's menu buton
      2. Press status
      3. Under Available mount point there should be something like /data/sdext2, make note of that.
      4. Press the button on the right (looks like a download icon)
      5. In Distribution select Kali Linux
      6. In Distribution Suite select kali-rolling
      7. In Architecture select armhf
      8. In Installation type select Directory
      9. In Installation Path type in the path you took note of before
      10. (Optional)  Change Username & Password
      11. Set DNS server to 8.8.8.8 (Google's Public DNS server) since the default tends to fail
      12. Finally, set Localization to en_US.UTF-8

      13. Make sure in Select Components that Kali Components IS NOT SELECTED
      14. Press Install
      15. This might take a while ...
      16. When you see "<<<install" on Linux Deploy's logs the installation has finished
      17. (If there was no error your system is now ready to boot).
      18. Press Start 
      19. Press Ok
      20. You should see something like this

      21. If you see a lot of skips then something went wrong during the installation
    2. Now from ConnectBot (or a machine in your local network) ssh to yourusername@theipontopofLinuxDeploy (in this case xxxx@192.168.1.2)
      1. sudo dpkg-reconfigure locales
      2. sudo locale-gen
      3. sudo nano /etc/apt/sources.list
      4. Delete all its contents and replace them with the following
      5. deb http://http.kali.org/kali/ kali-rolling main contrib non-free
        deb-src http://http.kali.org/kali/ kali-rolling main contrib non-free
        deb http://security.kali.org/kali-security kali-current/updates main contrib non-free
        deb-src http://security.kali.org/kali-security kali-current/updates main contrib non-free
      6. Send Ctrl+O (to save the file)
      7. Send Ctrl+X (to exit nano)
      8. sudo apt-get update
      9. sudo apt-get dist-upgrade
      10. (if prompted)
        sudo apt-get autoremove
      11. sudo apt-get install kali-linux-full
      12. PATIENCE, since this will download around 4GB of data
    3.  If everything went right you should now have a working setup of Kali Linux on your Android phone
    Hope this helps a few people skip a bit of the frustration. Have fun!

    Clarification: There is a reason behind selecting sana suite (initially) and then changing the deb sources to kali-rolling (and kali-current for security). When selecting Kali-Rolling as a suite the installation (step 15) was observed to repeatedly fail. On the other hand, sana suit being discontinued is lacking a few dependence (or has wrong versions) and will fail during upgrade sending you on a long trip of compiling dependencies from source and iterating.  

      No comments:

      Post a Comment