#!/data/data/com.termux/files/usr/bin/bash # Install required packages pkg install proot proot-distro bsdtar libxml2 axel fastfetch -y clear # Display neofetch with custom ASCII art fastfetch --logo kali # Get device architecture case $(getprop ro.product.cpu.abi) in arm64-v8a) SYS_ARCH=arm64 ;; armeabi|armeabi-v7a) SYS_ARCH=armhf ;; *) echo "[*] Unsupported Architecture!" exit 1 ;; esac # Set image strings echo && echo "" if [[ ${SYS_ARCH} == "arm64" ]]; then echo "[1] Kali NetHunter ARM64 Full" echo "[2] Kali NetHunter ARM64 Minimal" echo "[3] Kali NetHunter ARM64 Nano" read -rp "Select the number to install: " wimg echo " " case $wimg in 1) wimg="full" ;; 2) wimg="minimal" ;; 3) wimg="nano" ;; *) wimg="minimal" ;; esac elif [[ ${SYS_ARCH} == "armhf" ]]; then echo "[1] Kali NetHunter ARMHF Full" echo "[2] Kali NetHunter ARMHF Minimal" echo "[3] Kali NetHunter ARMHF Nano" read -rp "Select the number to install: " wimg echo " " case $wimg in 1) wimg="full" ;; 2) wimg="minimal" ;; 3) wimg="nano" ;; *) wimg="minimal" ;; esac fi # Set directory and image names DIR="kali-${SYS_ARCH}" IMAGE_NAME="kali-nethunter-rootfs-${wimg}-${SYS_ARCH}.tar.xz" FS=kali NM=Kali # Create necessary directories mkdir -p "$PREFIX/var/lib/proot-distro/installed-rootfs/$FS" # Change directory cd "$PREFIX/var/lib/proot-distro/installed-rootfs/" # Download the rootfs using axel echo "[*] Downloading $NM Linux Rootfs..." axel -o "$FS.tar.xz" "https://kali.download/nethunter-images/current/rootfs/$IMAGE_NAME" # Check file integrity echo " " echo "[*] Checking $NM Linux File Integrity...!!!" echo " " echo "[*] MD5" md5sum "$FS.tar.xz" echo " " echo "[*] SHA256" sha256sum "$FS.tar.xz" echo " " echo "[*] SHA512" sha512sum "$FS.tar.xz" # Extract the rootfs echo " " echo "[*] Extracting ${NM} Linux Rootfs, Please wait...!!!" proot --link2symlink bsdtar -xpJf "$FS.tar.xz" >/dev/null 2>&1 mv -f "$DIR"/* "$FS" # Create a proot-distro configuration file for the Kali minimal rootfs cat > "$PREFIX/etc/proot-distro/$FS.sh" << EOF DISTRO_NAME="$NM Linux" TARBALL_URL['aarch64']="https://kali.download/nethunter-images/current/rootfs/$IMAGE_NAME" TARBALL_SHA256['aarch64']="$(sha256sum "$FS.tar.xz" | awk '{print $1}')" TARBALL_URL['arm']="https://kali.download/nethunter-images/current/rootfs/$IMAGE_NAME" TARBALL_SHA256['arm']="$(sha256sum "$FS.tar.xz" | awk '{print $1}')" EOF # Create a shortcut command to launch the distro cat > "$PREFIX/bin/$FS" << EOF #!/data/data/com.termux/files/usr/bin/bash termux-wake-lock proot-distro login $FS EOF chmod 755 "$PREFIX/bin/$FS" # Add start-up login notification sed -i '/echo "Login $NM Linux: $FS"/d' $PREFIX/etc/bash.bashrc cat >> "$PREFIX/etc/bash.bashrc" << EOF echo "Login $NM Linux: $FS" EOF # Add support for uninstallation cat > "$PREFIX/bin/uninstall-$FS" << EOF #!/data/data/com.termux/files/usr/bin/bash proot-distro remove $FS sed -i '/termux-wake-lock/d' $PREFIX/etc/bash.bashrc sed -i '/echo "Login $NM Linux: $FS"/d' $PREFIX/etc/bash.bashrc rm -f $PREFIX/bin/uninstall-$FS rm -f $PREFIX/bin/$FS rm -f $PREFIX/var/lib/proot-distro/dlcache/$FS.tar.xz EOF chmod 755 "$PREFIX/bin/uninstall-$FS" # DNS resolver cat > "$FS/etc/resolv.conf" << EOF nameserver 9.9.9.10 nameserver 8.8.4.4 nameserver 1.1.1.1 EOF # Fastfetch sed -i '/fastfetch/d' "$FS/root/.zshrc" cat >> "$FS/root/.zshrc" << EOF sudo apt update sudo apt install fastfetch -y sed -i '/sudo apt update/d' "/root/.zshrc" sed -i '/sudo apt install fastfetch -y/d' "/root/.zshrc" fastfetch EOF # Backup tarball to the cache mkdir -p "$PREFIX/var/lib/proot-distro/dlcache" mv -f "$FS.tar.xz" "$PREFIX/var/lib/proot-distro/dlcache" # Display final instructions cat <<- EOF To login $NM Linux, Type: $FS EOF