forked from Hax4us/Nethunter-In-Termux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kalinethunter
executable file
·289 lines (251 loc) · 5.9 KB
/
kalinethunter
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
#!/data/data/com.termux/files/usr/bin/bash -e
# Copyright ©2018 by Hax4Us. All rights reserved. 🌎 🌍 🌏 🌐 🗺
#
# https://hax4us.com
################################################################################
# colors
red='\033[1;31m'
yellow='\033[1;33m'
blue='\033[1;34m'
reset='\033[0m'
# url's of all possibls architectures
urlaarch64="https://build.nethunter.com/kalifs/kalifs-20171013/kalifs-arm64-minimal.tar.xz"
urlarm="https://build.nethunter.com/kalifs/kalifs-20171013/kalifs-armhf-minimal.tar.xz"
printrerunerror="Sorry :( to say your downloaded linux file was corrupted or half downloaded but dont worry just rerun my script"
# utility function to initialize arch
getarch() {
SETARCH=$1
}
# Utility function to check integrity
checkintegrity() {
integritycheck=PASS
echo
printf "$blue [*] Checking integrity of file ..."
echo
echo " [*] Script will be terminate immediately in case of integrity failure"
if [ $SETARCH = "aarch64" ]
then
sha512sum -c kalifs-arm64-minimal.sha512sum && echo || integritycheck=FAIL
if [ $integritycheck = "FAIL" ]
then
printf "$red $printrerunerror $reset"
exit
else
extract
fi
elif [ $SETARCH = "armhf" ]
then
sha512sum -c kalifs-armhf-minimal.sha512sum && echo "" || integritycheck=FAIL
if [ $integritycheck = "FAIL" ]
then
printf"$red $printrerunerror $reset"
exit
else
extract
fi
fi
}
# Utility function to get tar file
gettarfile() {
cd $HOME
printf "$blue [*] Getting tar file ...$reset"
echo
if [ $SETARCH = "aarch64" ]
then
URL=$urlaarch64
echo
axel $URL
getsha
checkintegrity
elif [ $SETARCH = "armhf" ]
then
URL=$urlarm
echo
axel $URL
getsha
checkintegrity
fi
}
# Utility function for Unknown Arch
unknownarch() {
printf "$red"
echo "[*] Unknown Architecture :("
printf "$reset"
exit
}
# Utility function for detect system
checksysinfo() {
if [ $(getprop ro.product.cpu.abi) = "arm64-v8a" ]
then
checkdeps
getarch aarch64
gettarfile
elif [ $(getprop ro.product.cpu.abi) = "armeabi" ]; then
checkdeps
getarch armhf
gettarfile
elif [ $(getprop ro.product.cpu.abi) = "armeabi-v7a" ]; then
checkdeps
getarch armhf
gettarfile
else
unknownarch
fi
}
# Utility function for login file
createloginfile() {
bin=$PREFIX/bin/startkali
cat > $bin <<- EOM
#!/data/data/com.termux/files/usr/bin/bash -e
unset LD_PRELOAD
exec proot --link2symlink -0 -r $HOME/kali/ -b /dev/ -b /sys/ -b /proc/ -b /storage/ -b $HOME -w $HOME /usr/bin/env -i HOME=/root TERM="$TERM" LANG=$LANG PATH=/bin:/usr/bin:/sbin:/usr/sbin /bin/sh --login
EOM
chmod 700 $bin
}
# Utility function to extract tar file
extract() {
printf "$blue [*] Extracting ... $reset"
echo
if [ $SETARCH = aarch64 ]; then
OUTPUT=kalifs-arm64-minimal.tar.xz
cd $HOME && proot --link2symlink -0 bsdtar -xpf $OUTPUT 2> /dev/null || :
mv kali-arm64 kali
else
OUTPUT=kalifs-armhf-minimal.tar.xz
cd $HOME && proot --link2symlink -0 bsdtar -xpf $OUTPUT 2> /dev/null || :
mv kali-armhf kali
fi
createloginfile
}
checkdeps() {
printf "$blue \n"
echo " [*] Updating termux ..."
apt update -y &> /dev/null
echo " [*] Checking all required tools ..."
if [ -e $PREFIX/bin/proot ]
then
echo " • Proot is OK"
else
apt install proot -y &> /dev/null
if [ ! -e $PREFIX/bin/proot ]
then
printf "$red \n"
echo " ERROR : check your internet connection or apt"
printf "\n"
echo " Exiting ..."
printf "$reset"
exit
fi
fi
if [ -e $PREFIX/bin/bsdtar ]
then
echo " • Bsdtar is Ok"
else
apt install bsdtar -y &> /dev/null
if [ ! -e $PREFIX/bin/bsdtar ]
then
printf "$red"
echo " ERROR : check your internet connection or apt"
echo " [*] Exiting ..."
printf "$reset"
sleep 1
exit
fi
fi
if [ -e $PREFIX/bin/axel ]
then
echo " • Axel is OK"
else
apt install axel -y &> /dev/null
if [ ! -e $PREFIX/bin/axel ]
then
printf "$red"
echo " ERROR : check your internet connection or apt "
echo " Exiting ..."
printf "$reset"
exit
fi
fi
}
# Utility function to get SHA
getsha() {
echo
printf "$blue [*] Getting SHA ... $reset"
echo
echo
if [ $SETARCH = "aarch64" ]
then
axel https://build.nethunter.com/kalifs/kalifs-20171013/kalifs-arm64-minimal.sha512sum
elif [ $SETARCH = "armhf" ]
then
axel https://build.nethunter.com/kalifs/kalifs-20171013/kalifs-armhf-minimal.sha512sum
else
printf "$red Your phone is supported but cant download SHA file plz contact to [email protected] $reset"
exit
fi
}
# Utility function to touchup (under construction)
#finalwork() {
# if [ ! -e $HOME/finaltouchup.sh ]
# then
#
# curl -LO https://raw.githubusercontent.com/Hax4us/TermuxAlpine/master/finaltouchup.sh
# . finaltouchup.sh
#else
# . finaltouchup.sh
# fi
#}
# Utility function for cleanup
#cleanup() {
# if [ -d $DESTINATION ]
# then
# rm -rf $DESTINATION
#else
# printf "$red not installed so not removed"
# echo
# fi
# if [ -e $PREFIX/bin/startalpine ]
# then
# rm $PREFIX/bin/startalpine
# printf "$yellow uninstalled :) $reset"
# echo
#else
# printf "$red not installed so not removed $reset"
# echo
# fi
#}
# Start
clear
#EXTRAARGS="default"
#if [[ ! -z $1 ]]
# then
#EXTRAARGS=$1
#if [[ $EXTRAARGS = "uninstall" ]]
# then
# cleanup
# exit
# fi
# fi
echo
printf "$yellow You are going to install Kali Nethunter in termux ;) Cool"
echo
echo
echo
printf "$blue [*] Checking host architecture ..."
checksysinfo
printf "$blue [*] Configuring Nethunter For You ..."
#cd $HOME && finalwork
printf "$blue"
echo
echo
echo " #-----------------------------------------------#"
echo
printf "$blue [∆] My Official Mail : $yellow [email protected]"
echo
printf "$blue [∆] My Website : $yellow https://hax4us.com"
echo
printf "$blue [∆] My Channel : $yellow https://youtube.com/hax4us $reset"
printf "$blue"
echo
echo " #-----------------------------------------------#"
printf "$reset"