├── README.md └── kali.sh /README.md: -------------------------------------------------------------------------------- 1 | # kali-nethunter-termux -------------------------------------------------------------------------------- /kali.sh: -------------------------------------------------------------------------------- 1 | #!/data/data/com.termux/files/usr/bin/bash 2 | folder=kali-fs 3 | if [ -d "$folder" ]; then 4 | first=1 5 | echo "skipping downloading" 6 | fi 7 | tarball="kali-rootfs.tar.gz" 8 | if [ "$first" != 1 ];then 9 | if [ ! -f $tarball ]; then 10 | echo "Download Rootfs, this may take a while base on your internet speed." 11 | case `dpkg --print-architecture` in 12 | aarch64) 13 | archurl="arm64" ;; 14 | arm) 15 | archurl="armhf" ;; 16 | amd64) 17 | archurl="amd64" ;; 18 | x86_64) 19 | archurl="amd64" ;; 20 | i*86) 21 | archurl="i386" ;; 22 | x86) 23 | archurl="i386" ;; 24 | *) 25 | echo "unknown architecture"; exit 1 ;; 26 | esac 27 | wget "https://raw.githubusercontent.com/EXALAB/AnLinux-Resources/master/Rootfs/Kali/${archurl}/kali-rootfs-${archurl}.tar.gz" -O $tarball 28 | fi 29 | cur=`pwd` 30 | mkdir -p "$folder" 31 | cd "$folder" 32 | echo "Decompressing Rootfs, please be patient." 33 | proot --link2symlink tar -xf ${cur}/${tarball}||: 34 | cd "$cur" 35 | fi 36 | mkdir -p kali-binds 37 | bin=start-kali.sh 38 | echo "writing launch script" 39 | cat > $bin <<- EOM 40 | #!/bin/bash 41 | cd \$(dirname \$0) 42 | ## unset LD_PRELOAD in case termux-exec is installed 43 | unset LD_PRELOAD 44 | command="proot" 45 | command+=" --link2symlink" 46 | command+=" -0" 47 | command+=" -r $folder" 48 | if [ -n "\$(ls -A kali-binds)" ]; then 49 | for f in kali-binds/* ;do 50 | . \$f 51 | done 52 | fi 53 | command+=" -b /dev" 54 | command+=" -b /proc" 55 | command+=" -b kali-fs/tmp:/dev/shm" 56 | ## uncomment the following line to have access to the home directory of termux 57 | #command+=" -b /data/data/com.termux/files/home:/root" 58 | ## uncomment the following line to mount /sdcard directly to / 59 | #command+=" -b /sdcard" 60 | command+=" -w /root" 61 | command+=" /usr/bin/env -i" 62 | command+=" HOME=/root" 63 | command+=" PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games" 64 | command+=" TERM=\$TERM" 65 | command+=" LANG=C.UTF-8" 66 | command+=" /bin/bash --login" 67 | com="\$@" 68 | if [ -z "\$1" ];then 69 | exec \$command 70 | else 71 | \$command -c "\$com" 72 | fi 73 | EOM 74 | 75 | echo "fixing shebang of $bin" 76 | termux-fix-shebang $bin 77 | echo "making $bin executable" 78 | chmod +x $bin 79 | echo "removing image for some space" 80 | rm $tarball 81 | echo "You can now launch Kali with the ./${bin} script" 82 | --------------------------------------------------------------------------------