Showing posts with label On. Show all posts
Showing posts with label On. Show all posts

Wednesday, October 26, 2022

Install Kali Linux On Non-Rooted Android Phone

Install Kali Linux On Non-Rooted Android Phone


Install Kali Linux On Non-Rooted Android Phone

While we believe that this content benefits our community, we have not yet thoroughly reviewed it. If you have any suggestions for improvements, please let us know by clicking the “report an issue“ button at the bottom of the tutorial.

In this module, we are going to learn how we can install Kali Linux on non-rooted Android devices and turn them into pockets hacking machines! Let’s get started

Steps to install Kali Linux on non-rooted Android

Below we’ve outlined the steps to install Kali Linux on Android devices that are not rooted. During the tutorial, if you wish to access your android device from your computer using SSH or even setup a web server, you can read through this tutorial.

1. Prerequisites

First things first, we need to install Termux and Hacker’s Keyboard on our Android Device.

You can fetch these apps from Google Playstore.

2. Setting Up Our Environment

Next up, we would need some packages which we would need during the installation process.

First, update and upgrade the system with :

$ pkg update && pkg upgrade -y

Next up we need to setup our system so that we can access the files created by Termux outside of our Termux session as well. This can be done with :

$ termux-setup-storage

Once you have granted the required Permissions, finally install the required packages with :

$ pkg install wget fish

Once done, we can proceed to the actual installation step.

3. Fetching And Executing Our Script

Next we need to fetch and execute a script which will install Kali Linux for us. To fetch the script, type:

$ wget https://gitlab.com/kalilinux/nethunter/build-scripts/kali-nethunter-project/raw/master/nethunter-rootless/install-nethunter-termux

Now, we need to make the script executable and run it with:

$ chmod +x install-nethunter-termux

$ ./install-nethunter-termux

This will fetch Kali Linux files and install them for us on our Android device. The script would fetch around 1.5GB of files so naturally, it might take a lot of time depending upon your network speed. Once the script is done extracting the rootfs file, you can even delete it.

Once the script has finished, you can run Kali Nethunter from the CLI.

Kali In Termux
Kali In Termux

To launch Kali Linux in CLI mode, type:

$ nethunter 

This would drop into a shell on Kali Linux. You can now use Kali Tools or check your OS with

$ cat /etc/os-release | grep "\bNAME="
NAME="Kali GNU/Linux"

Now we have successfully completed our install of Kali Linux on our non-rooted Android as well !

Conclusion

Note that on non-rooted you cannot use some tools which require root permissions . However, this still remains utilitarian when performing memory intensive operations like Password cracking and bruteforcing. Most mobile devices nowadays come with a lot of RAM and brilliant processors which can help to crack password hashes or bruteforce our way into systems all the while retaining the functionalities of a normal Android Device.

Refer: https://www.digitalocean.com/community/tutorials/install-kali-linux-non-rooted-android


—————

Installing NetHunter

Installing NetHunter requires the following steps:

  1. Download a pre-built image or build your own image
  2. Put your device in developer mode
  3. Unlock your device
  4. Install TWRP
  5. Flash Magisk
  6. Android 9 and above: Format “data” and flash Universal DM-Verity & ForceEncrypt Disabler
  7. Install NetHunter
  8. Android 10 and above: Update NetHunter App from the NetHunter Store
  9. Run the NetHunter App to finish the installation

 

1. NetHunter support and pre-built images

You can confirm that your device and Android version is supported via our gitlab live reports: List of quarterly published NetHunter images NetHunter kernel statistics NetHunter kernel table with

The NetHunter team builds and publishes images for a selected list of devices, on the official NetHunter download page.

If you devices is supported by NetHunter but not available as a pre-build image, you can easily build your own image by following the steps in our “Building NetHunter” documentation

 

2. Putting your device in “Developer Mode”

Before the installation begins, you must enable Developer mode on your device. This is done by navigating to Settings -> About and tapping on the Build numberfield 7 times until you receive the notification that developer mode has been enabled. Go back to the main settings page and you will have a new section titled Developer options. Tap on the new Developer options section and enable both the Advanced Reboot and Android Debugging options.

 

3. - 5. Unlocking, rooting, and installing a custom recovery on your android device

NetHunter supports over 60 different devices running Android versions from Kitkat though to Android Q. Whilst we have standardised the NetHunter installation procedure, the steps to unlock, root, and install a custom recovery varies from device to device and even differs between Android versions. The preferred custom recovery for NetHunter is TWRP. The preferred software to root the device for NetHunter is Magisk. Please refer to the appropriate guide to unlock, root, and install a custom recovery on your device from your preferred internet resource, such as the XDA Developers Forum

 

6. Flashing Universal DM-Verity & ForceEncrypt Disabler

IMPORTANT NOTE for Android 9, 10, & 11 users: Please ensure that you flash the Universal DM-Verity, ForceEncrypt Disabler and format the data partition prior to installing NetHunter. Magisk does not support user context changes on encrypted data partitions, which leads to errors when connecting to the Kali rootfs via ssh (i.e. “Required key not available”) if the data partition is encrypted.

 

7. - 9. Installing the NetHunter Image

Now that your Android phone is ready, transfer the NetHunter image to it, reboot in recovery mode, and flash the zip on your phone. Once done, reboot and launch the NetHunter app to complete the setup!

IMPORTANT NOTE for Android 10 & 11 users: Please update the NetHunter app from the NetHunter store after flashing NetHunter. Android 10 introduced “scoped storage” restrictions which prevents NetHunter from using the storage location we traditionally used to save configuration files. We are in the process of moving the location and implementing an import/export function but updating the app after flashing NetHunter provides a workaround that allows us to continue accessing the current storage location until the new features are implemented.


Updated on: 2022-Aug-08
Author: re4son

Kali: https://www.kali.org/docs/nethunter/installing-nethunter/#7-9-installing-the-nethunter-image

Monday, October 24, 2022

Installing VMware on Kali (Host)

Installing VMware on Kali (Host)

You can install VMware workstation or player on Kali Linux, allowing you to use Virtual Machines (VMs) inside of Kali Linux. However if you wish to use Kali Linux as a virtual machine, you will want our Kali Linux Guest VMware guide.

VMs are great, as there are many reasons why to use them. One of the being, able to run multiple Operating Systems at the same time. You can have your host machine “untouched”, and then only interact with the guest VMs. Another is when something is going right, take a snapshot. When something goes wrong, revert back.

VMware Workstation & Fusion is a commercial software (there is VMware Player which is free but it is limited in features). There are various free or open source solution (such as VirtualBox, QEMU, KVM/Xen with virt-manager).

Preparation

Before trying to install VMware, please make sure your version of Kali Linux is up-to-date, and if required, reboot the machine.

kali@kali:~$ sudo apt update
[...]
kali@kali:~$
kali@kali:~$ sudo apt full-upgrade -y
[...]
kali@kali:~$
kali@kali:~$ [ -f /var/run/reboot-required ] && sudo reboot -f
kali@kali:~$

Download

To start with, you will need to download VMware. You can do this by going to VMware’s download page. At the time of writing, the latest version is 15.5.1-15018445.

Alternatively, you can do the following command line method.

kali@kali:~$ sudo apt install -y curl
[...]
kali@kali:~$
kali@kali:~$ curl -L https://www.vmware.com/go/getworkstation-linux \
  > ~/Downloads/vmware.bin
kali@kali:~$
kali@kali:~$ file Downloads/vmware.bin
Downloads/vmware.bin: a /usr/bin/env bash script executable (binary data)
kali@kali:~$
kali@kali:~$ ls -lah Downloads/vmware.bin
-rwxr-xr-x 1 kali kali 511M Feb 14 20:46 Downloads/vmware.bin
kali@kali:~$

When everything is up-to-date, and ready to go, make sure the file is executable and then call it.

kali@kali:~$ chmod +x ~/Downloads/vmware.bin
kali@kali:~$
kali@kali:~$ sudo ~/Downloads/vmware.bin
Extracting VMware Installer...done.
Installing VMware Workstation 15.5.1
    Configuring...
[######################################################################] 100%
Installation was successful.
kali@kali:~$

We can see we have installed VMware Workstation 15.5.1. The version number may be needed later on.

After the installer is installed, you should be able to just run vmware to continue setup.

kali@kali:~$ vmware
kali@kali:~$

At this point, you should be be straight forward, often just clicking through.


Setup

The first part may be VMware Kernel Modules.


If vmware wasn’t called with superuser privileges, you may be prompted for a password.


At this point, it may not install correctly, and get the error message: Unable to install all modules. See log /tmp/vmware-kali/vmware-*.log for details. (Exit code 1). This is often due to Kali’s kernel being newer than what VMware is expecting.

Looking at the log may help with troubleshooting the issue as well as the guide at the end of this postvmware-host-modules.

You will need to accept the legal agreement.


You may wish for it VMware to check for any updates.


You may wish to join “VMware Customer Experience Improvement Program”.


Enter the current username.


Enter a location for Shared VMs (this is different to each users own VMs).


Enter a port for HTTPS access


If you have a product key, you can enter it now, else it will be a trial for 30 days.


You may be once again prompt for superuser privileges if you didn’t execute the setup file with it.


The final screen should look like this.


If you now wish, you are able to install Kali Linux in a VMware VM (on Kali Linux).

Troubleshooting

libaio missing

If you see the following problem, upon trying to run vmware.

Try installing the libaio1 package.

kali@kali:~$ vmware
[AppLoader] Use shipped Linux kernel AIO access library.
An up-to-date "libaio" or "libaio1" package from your system is preferred.
kali@kali:~$
kali@kali:~$ sudo apt install -y libaio1
[...]
kali@kali:~$

Then the next time you start vmware, it should of gone away.


Missing Packages

From time to time, things may not go right. There could be a number of reasons why VMware may not install. The first thing to check would be you have all the necessary packages installed.

kali@kali:~$ sudo apt install -y build-essential linux-headers-$( uname -r ) vlan libaio1
[...]
kali@kali:~$

Try running vmware again, and see if now setup continues.


Too Newer Kernel

A common issue is because the setup file for VMware isn’t supporting the latest kernels, which could be an issue as Kali Linux is a rolling distribution and receives frequent updates. If this is the case, we can patch VMware modules to support this.

kali@kali:~$ sudo apt install -y git
[...]
kali@kali:~$
kali@kali:~$ sudo git clone \
  -b workstation-$( grep player.product.version /etc/vmware/config | sed '/.*\"\(.*\)\".*/ s//\1/g' ) \
  https://github.com/mkubecek/vmware-host-modules.git \
  /opt/vmware-host-modules/
[...]
kali@kali:~$
kali@kali:~$ cd /opt/vmware-host-modules/
kali@kali:/opt/vmware-host-modules$ sudo make
kali@kali:/opt/vmware-host-modules$
kali@kali:/opt/vmware-host-modules$ sudo make install
kali@kali:/opt/vmware-host-modules$

Try now to install VMware, by doing vmware.

If you are still having issues, you may need to restart your Kali Linux before trying one more final time.


vmware-host-modules + Kernel Updates

As VMware has various kernel modules, we need to make sure they are kept up-to-date and re-patched when Kali Linux’s kernel gets updated. This can be achieved by the steps in the following guide.

kali@kali:~$ cat<<EOF | sudo tee /etc/kernel/install.d/99-vmmodules.install
#!/bin/bash

export LANG=C

COMMAND="\$1"
KERNEL_VERSION="\${2:-\$( uname -r )}"
BOOT_DIR_ABS="\$3"
KERNEL_IMAGE="\$4"

VMWARE_VERSION=\$(
  grep player.product.version /etc/vmware/config \
    | sed '/.*\"\(.*\)\".*/ s//\1/g'
)

ret=0

case "\${COMMAND}" in
    add)
       [ -z \${VMWARE_VERSION} ] \
         && exit 0

       git clone -b workstation-\${VMWARE_VERSION} https://github.com/mkubecek/vmware-host-modules.git /opt/vmware-host-modules-\${VMWARE_VERSION}/
       cd /opt/vmware-host-modules-\${VMWARE_VERSION}/
       make VM_UNAME=\${KERNEL_VERSION}
       make install VM_UNAME=\${KERNEL_VERSION}

       ((ret+=\$?))
       ;;
    remove)
        exit 0
        ;;
    *)
        usage
        ret=1;;
esac

exit \${ret}
EOF
kali@kali:~$

Still can’t start up VMware? vmware-modconfi

If VMware is unsuccessful, we can dig a little further by running the following.

kali@kali:~$ sudo vmware-modconfig --console --install-all
[...]
kali@kali:~$
kali@kali:~$ sudo vmware-modconfig --console --install-all 2>&1 | grep error
[...]
kali@kali:~$

Looking at the output, may either give us the exact issue, or at the very least something to search the Internet for.


Can’t Power on a Virtual Machine

You may also face the following issues, when trying to power on a VM.

  • Failed to initialize monitor device
  • Could not open /dev/vmmon: No such file or directory. Please make sure that kernel module 'vmmon' is loaded
  • Unable to change virtual machine power state: Transport (VMDB) error -14: Pipe connection has been broken.

The quickest solution to fix these would be to reboot Kali Linux and try again.


Source: https://www.kali.org/docs/virtualization/install-vmware-host/
Author: g0tmi1k