├── README.md └── install.sh /README.md: -------------------------------------------------------------------------------- 1 | *** 2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
*This is **official** repository maintained by us* 17 | ######
*[**@Bhavik_Tutorials**](https://www.instagram.com/bhavik_tutorials/) ❤️* 18 | ######
*You can check [youtube](https://www.youtube.com/channel/UCMhYgk0-nIHHtnRNkL9zpgQ)✌* 19 | --- 20 | ###
**Instagram Tutorial :-**
21 |
22 | ####
[**IGTV**]() 23 | --- 24 | ###
Android
25 | ####
```pkg update -y``` 26 | ####
```pkg install wget``` 27 | ####
```wget -N https://github.com/Bhaviktutorials/Kali-Nethunter/raw/main/install.sh``` 28 | ####
``` bash install.sh``` 29 | --- 30 | ##
Workflow ⚙️
31 |
32 |
33 |
34 | ***
35 | ##
Support
36 |
![]() |
39 | ![]() |
40 |
---|---|
Ashish Singh |
43 | Bhavik Tutorials |
44 |
Developer |
47 | Publisher |
48 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/install.sh:
--------------------------------------------------------------------------------
1 | #!/data/data/com.termux/files/usr/bin/bash -e
2 |
3 | ## Re-developed by Ashish Singh
4 | ## This script will installed kali-nethuntern in termux without any error
5 | ## If you like my work please subscribe us on youtube.
6 |
7 | VERSION=2020011601
8 | BASE_URL=https://images.kali.org/nethunter
9 | USERNAME=kali
10 |
11 | function unsupported_arch() {
12 | printf "${red}"
13 | echo "[*] Unsupported Architecture\n\n"
14 | printf "${reset}"
15 | exit
16 | }
17 |
18 | function ask() {
19 | # http://djm.me/ask
20 | while true; do
21 |
22 | if [ "${2:-}" = "Y" ]; then
23 | prompt="Y/n"
24 | default=Y
25 | elif [ "${2:-}" = "N" ]; then
26 | prompt="y/N"
27 | default=N
28 | else
29 | prompt="y/n"
30 | default=
31 | fi
32 |
33 | # Ask the question
34 | printf "${light_cyan}\n[?] "
35 | read -p "$1 [$prompt] " REPLY
36 |
37 | # Default?
38 | if [ -z "$REPLY" ]; then
39 | REPLY=$default
40 | fi
41 |
42 | printf "${reset}"
43 |
44 | # Check if the reply is valid
45 | case "$REPLY" in
46 | Y*|y*) return 0 ;;
47 | N*|n*) return 1 ;;
48 | esac
49 | done
50 | }
51 |
52 | function get_arch() {
53 | printf "${blue}[*] Checking device architecture ..."
54 | case $(getprop ro.product.cpu.abi) in
55 | arm64-v8a)
56 | SYS_ARCH=arm64
57 | ;;
58 | armeabi|armeabi-v7a)
59 | SYS_ARCH=armhf
60 | ;;
61 | *)
62 | unsupported_arch
63 | ;;
64 | esac
65 | }
66 |
67 | function set_strings() {
68 | CHROOT=kali-${SYS_ARCH}
69 | IMAGE_NAME=kalifs-${SYS_ARCH}-full.tar.xz
70 | SHA_NAME=kalifs-${SYS_ARCH}-full.sha512sum
71 | }
72 |
73 | function prepare_fs() {
74 | unset KEEP_CHROOT
75 | if [ -d ${CHROOT} ]; then
76 | if ask "Existing rootfs directory found. Delete and create a new one?" "N"; then
77 | rm -rf ${CHROOT}
78 | else
79 | KEEP_CHROOT=1
80 | fi
81 | fi
82 | }
83 |
84 | function cleanup() {
85 | if [ -f ${IMAGE_NAME} ]; then
86 | if ask "Delete downloaded rootfs file?" "N"; then
87 | if [ -f ${IMAGE_NAME} ]; then
88 | rm -f ${IMAGE_NAME}
89 | fi
90 | if [ -f ${SHA_NAME} ]; then
91 | rm -f ${SHA_NAME}
92 | fi
93 | fi
94 | fi
95 | }
96 |
97 | function check_dependencies() {
98 | printf "${blue}\n[*] Checking package dependencies...${reset}\n"
99 | ## Workaround for termux-app issue #1283 (https://github.com/termux/termux-app/issues/1283)
100 | ##apt update -y &> /dev/null
101 | apt-get update -y &> /dev/null || apt-get -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confnew" dist-upgrade -y &> /dev/null
102 |
103 | for i in proot tar python; do
104 | if [ -e $PREFIX/bin/$i ]; then
105 | echo " $i is OK"
106 | else
107 | printf "Installing ${i}...\n"
108 | apt install -y $i || {
109 | printf "${red}ERROR: Failed to install packages.\n Exiting.\n${reset}"
110 | exit
111 | }
112 | fi
113 | done
114 | apt upgrade -y
115 | pip install gdown
116 | }
117 |
118 |
119 | function get_url() {
120 | ROOTFS_URL="${BASE_URL}/${IMAGE_NAME}"
121 | SHA_URL="${BASE_URL}/${SHA_NAME}"
122 | }
123 |
124 | function get_rootfs() {
125 | unset KEEP_IMAGE
126 | if [ -f ${IMAGE_NAME} ]; then
127 | if ask "Existing image file found. Delete and download a new one?" "N"; then
128 | rm -f ${IMAGE_NAME}
129 | else
130 | printf "${yellow}[!] Using existing rootfs archive${reset}\n"
131 | KEEP_IMAGE=1
132 | return
133 | fi
134 | fi
135 | printf "${blue}[*] Downloading rootfs...${reset}\n\n"
136 | if [ "${SYS_ARCH}" != "arm64" ];then
137 | # ROOTFS ARMHF
138 | gdown https://drive.google.com/uc?id=1cWCuxhTotNMMdLZpB5G7cednhRz2hWeY
139 | else
140 | # ROOTFS ARM64
141 | gdown https://drive.google.com/uc?id=1DbP2LCZGWAH-A9IUHxXZqxoT9Sx8fGFb
142 | fi
143 | #get_url
144 | #axel ${EXTRA_ARGS} --alternate "$ROOTFS_URL"
145 | }
146 |
147 | function get_sha() {
148 | if [ -z $KEEP_IMAGE ]; then
149 | printf "\n${blue}[*] Getting SHA ... ${reset}\n\n"
150 | if [ "${SYS_ARCH}" != "arm64" ];then
151 | # SHA 512 SUM ARMHF
152 | gdown https://drive.google.com/uc?id=1AF-29oLlrdDNMFotmzk0oi5QWTHI8aFJ
153 | else
154 | # SHA 512 SUM ARM64
155 | gdown https://drive.google.com/uc?id=1ORCr_kzE-d3vCj--FZVjK66I5Y7_EivH
156 | fi
157 | #get_url
158 | if [ -f ${SHA_NAME} ]; then
159 | #rm -f ${SHA_NAME}
160 | image=ok
161 | fi
162 | #axel ${EXTRA_ARGS} --alternate "${SHA_URL}"
163 | fi
164 | }
165 |
166 | function verify_sha() {
167 | if [ -z $KEEP_IMAGE ]; then
168 | printf "\n${blue}[*] Verifying integrity of rootfs...${reset}\n\n"
169 | sha512sum -c $SHA_NAME || {
170 | printf "${red} Rootfs corrupted. Please run this installer again or download the file manually\n${reset}"
171 | exit 1
172 | }
173 | fi
174 | }
175 |
176 | function extract_rootfs() {
177 | if [ -z $KEEP_CHROOT ]; then
178 | printf "\n${blue}[*] Extracting rootfs... ${reset}\n\n"
179 | proot --link2symlink tar -xf $IMAGE_NAME 2> /dev/null || :
180 | else
181 | printf "${yellow}[!] Using existing rootfs directory${reset}\n"
182 | fi
183 | }
184 |
185 |
186 | function create_launcher() {
187 | NH_LAUNCHER=${PREFIX}/bin/nethunter
188 | NH_SHORTCUT=${PREFIX}/bin/nh
189 | cat > $NH_LAUNCHER <<- EOF
190 | #!/data/data/com.termux/files/usr/bin/bash -e
191 | cd \${HOME}
192 | ## termux-exec sets LD_PRELOAD so let's unset it before continuing
193 | unset LD_PRELOAD
194 | ## Workaround for Libreoffice, also needs to bind a fake /proc/version
195 | if [ ! -f $CHROOT/root/.version ]; then
196 | touch $CHROOT/root/.version
197 | fi
198 |
199 | ## Default user is "kali"
200 | user="$USERNAME"
201 | home="/home/\$user"
202 | start="sudo -u kali /bin/bash"
203 |
204 | ## NH can be launched as root with the "-r" cmd attribute
205 | ## Also check if user kali exists, if not start as root
206 | if grep -q "kali" ${CHROOT}/etc/passwd; then
207 | KALIUSR="1";
208 | else
209 | KALIUSR="0";
210 | fi
211 | if [[ \$KALIUSR == "0" || ("\$#" != "0" && ("\$1" == "-r" || "\$1" == "-R")) ]];then
212 | user="root"
213 | home="/\$user"
214 | start="/bin/bash --login"
215 | if [[ "\$#" != "0" && ("\$1" == "-r" || "\$1" == "-R") ]];then
216 | shift
217 | fi
218 | fi
219 |
220 | cmdline="proot \\
221 | --link2symlink \\
222 | -0 \\
223 | -r $CHROOT \\
224 | -b /dev \\
225 | -b /proc \\
226 | -b $CHROOT\$home:/dev/shm \\
227 | -w \$home \\
228 | /usr/bin/env -i \\
229 | HOME=\$home \\
230 | PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin \\
231 | TERM=\$TERM \\
232 | LANG=C.UTF-8 \\
233 | \$start"
234 |
235 | cmd="\$@"
236 | if [ "\$#" == "0" ];then
237 | exec \$cmdline
238 | else
239 | \$cmdline -c "\$cmd"
240 | fi
241 | EOF
242 |
243 | chmod 700 $NH_LAUNCHER
244 | if [ -L ${NH_SHORTCUT} ]; then
245 | rm -f ${NH_SHORTCUT}
246 | fi
247 | if [ ! -f ${NH_SHORTCUT} ]; then
248 | ln -s ${NH_LAUNCHER} ${NH_SHORTCUT} >/dev/null
249 | fi
250 |
251 | }
252 |
253 | function create_kex_launcher() {
254 | KEX_LAUNCHER=${CHROOT}/usr/bin/kex
255 | cat > $KEX_LAUNCHER <<- EOF
256 | #!/bin/bash
257 |
258 | function start-kex() {
259 | if [ ! -f ~/.vnc/passwd ]; then
260 | passwd-kex
261 | fi
262 | USR=\$(whoami)
263 | if [ \$USR == "root" ]; then
264 | SCREEN=":2"
265 | else
266 | SCREEN=":1"
267 | fi
268 | export HOME=\${HOME}; export USER=\${USR}; LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgcc_s.so.1 nohup vncserver \$SCREEN >/dev/null 2>&1 $CHROOT/etc/sudoers.d/kali
341 |
342 | # https://bugzilla.redhat.com/show_bug.cgi?id=1773148
343 | echo "Set disable_coredump false" > $CHROOT/etc/sudo.conf
344 | }
345 |
346 | function fix_uid() {
347 | ## Change kali uid and gid to match that of the termux user
348 | USRID=$(id -u)
349 | GRPID=$(id -g)
350 | nh -r usermod -u $USRID kali 2>/dev/null
351 | nh -r groupmod -g $GRPID kali 2>/dev/null
352 | }
353 |
354 | function print_banner() {
355 | clear
356 | printf "${blue}##################################################\n"
357 | printf "${blue}## ##\n"
358 | printf "${blue}## 88 a8P db 88 88 ##\n"
359 | printf "${blue}## 88 .88' d88b 88 88 ##\n"
360 | printf "${blue}## 88 88' d8''8b 88 88 ##\n"
361 | printf "${blue}## 88 d88 d8' '8b 88 88 ##\n"
362 | printf "${blue}## 8888'88. d8YaaaaY8b 88 88 ##\n"
363 | printf "${blue}## 88P Y8b d8''''''''8b 88 88 ##\n"
364 | printf "${blue}## 88 '88. d8' '8b 88 88 ##\n"
365 | printf "${blue}## 88 Y8b d8' '8b 888888888 88 ##\n"
366 | printf "${blue}## ##\n"
367 | printf "${yellow}## Re-developed by Ashish Singh ##\n"
368 | printf "${blue}#### ############# NetHunter ####################${reset}\n\n"
369 | }
370 |
371 |
372 | ##################################
373 | ## Main ##
374 |
375 | # Add some colours
376 | red='\033[1;31m'
377 | green='\033[1;32m'
378 | yellow='\033[1;33m'
379 | blue='\033[1;34m'
380 | light_cyan='\033[1;96m'
381 | reset='\033[0m'
382 |
383 | EXTRA_ARGS=""
384 | if [[ ! -z $1 ]]; then
385 | EXTRA_ARGS=$1
386 | if [[ $EXTRA_ARGS != "--insecure" ]]; then
387 | EXTRA_ARGS=""
388 | fi
389 | fi
390 |
391 | cd $HOME
392 | print_banner
393 | get_arch
394 | set_strings
395 | prepare_fs
396 | check_dependencies
397 | get_rootfs
398 | get_sha
399 | verify_sha
400 | extract_rootfs
401 | create_launcher
402 | cleanup
403 |
404 | printf "\n${blue}[*] Configuring NetHunter for Termux ...\n"
405 | fix_profile_bash
406 | fix_sudo
407 | create_kex_launcher
408 | fix_uid
409 |
410 | print_banner
411 | printf "${green}[=] NetHunter for Termux installed successfully${reset}\n\n"
412 | printf "${green}[+] To start NetHunter, type:${reset}\n"
413 | printf "${green}[+] nethunter # To start NetHunter cli${reset}\n"
414 | printf "${green}[+] nethunter kex passwd # To set the KeX password${reset}\n"
415 | printf "${green}[+] nethunter kex & # To start NetHunter gui${reset}\n"
416 | printf "${green}[+] nethunter kex stop # To stop NetHunter gui${reset}\n"
417 | printf "${green}[+] nethunter -r # To run NetHunter as root${reset}\n"
418 | printf "${green}[+] nh # Shortcut for nethunter${reset}\n\n"
419 |
--------------------------------------------------------------------------------