forked from nathanakalish/NetHunter-Utility
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkfu.sh
executable file
·1231 lines (1130 loc) · 34 KB
/
kfu.sh
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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/sh
printf '\033[8;27;100t'
###########################
###Device Selection Menu###
###########################
f_deviceselect(){
clear
echo "Kali Flash Utility v1.8.2"
echo "Select your device:"
echo ""
echo "[1] Nexus 4 2012 Cellular [Mako] [EXPERIMENTAL]"
echo "[2] Nexus 5 2013 Cellular [Hammerhead]"
echo "[3] Nexus 7 2012 Wifi [Grouper]"
echo "[4] Nexus 7 2012 Cellular [Tilapia]"
echo "[5] Nexus 7 2013 Wifi [Flo]"
echo "[6] Nexus 7 2013 LTE [Deb]"
echo "[7] Nexus 10 2012 Wifi [Manta]"
echo ""
echo "[8] Other Unsupported Device [Use at your own risk. Make a backup]"
echo ""
echo "[Q] Exit"
echo ""
read -p "Please make a selection: " device
case $device in
1) currentdevice="mako"; currentmodel="Nexus 4 2012"; clear; echo "SUPPORT FOR THIS DEVICE IS EXPERIMENTAL. USE AT YOUR OWN RISK."; echo ""; read -p "Press [Enter] to continue" null; f_mkdir; f_menu;;
2) currentdevice="hammerhead"; currentmodel="Nexus 5 2013"; f_mkdir; f_menu;;
3) currentdevice="grouper"; currentmodel="Nexus 7 2012 Wifi"; f_mkdir; f_menu;;
4) currentdevice="tilapia"; currentmodel="Nexus 7 2012 Cellular"; f_mkdir; f_menu;;
5) currentdevice="flo"; currentmodel="Nexus 7 2013 Wifi"; f_mkdir; f_menu;;
6) currentdevice="deb"; currentmodel="Nexus 7 2013 LTE"; f_mkdir; f_menu;;
7) currentdevice="manta"; currentmodel="Nexus 10 Wifi"; f_mkdir; f_menu;;
8) clear; read -p "What do you want the device to be referred to as?" currentdevice; currentmodel="Custom Device"; f_mkdir; f_custommenu; clear;;
q) clear; exit;;
*) f_deviceselect;;
esac
}
######################
###Make Directories###
######################
f_mkdir(){
maindir=~/Kali
commondir=$maindir/All
devicedir=$maindir/$currentdevice
apkdir=$maindir/APKs
mkdir -p $commondir
mkdir -p $apkdir
mkdir -p $devicedir
}
###############
###Main Menu###
###############
f_menu(){
clear
echo "Kali Flash Utility v1.8.2"
echo "Current Device: $currentmodel ($currentdevice)"
echo ""
echo "Please make a selection:"
echo "[1] Install Kali NetHunter [6] Erase device and restore to stock"
echo "[2] Unlock Bootloader [7] Delete All Existing Files"
echo "[3] Install MultiROM [8] Build Kali (Kali Linux Only)"
echo "[4] Remove MultiROM and Secondary ROMs [9] Select A Different Device"
echo "[5] Install Additional Tools [10] Update Script"
echo ""
echo "[Q] Exit"
echo ""
read -p "Please make a selection: " menuselection
case $menuselection in
1) f_nethuntermenu;;
2) f_dl_tools; f_unlock; f_menu;;
3) f_dl_tools; f_dl_multirom; f_unlock; f_multirom; f_menu;;
4) f_dl_twrp; f_dl_rmmultirom; f_rmmultirom; f_menu;;
5) f_dl_tools; f_kalitools;;
6) f_restore; f_menu;;
7) f_delete; f_deviceselect;;
8) f_build; f_menu;;
9) f_deviceselect;;
10) f_update;;
q) clear; exit;;
lpv) f_lpreview; f_menu;;
*) f_menu;;
esac
}
#############################
###Custom Device Main Menu###
#############################
f_custommenu(){
customdevice=1
clear
echo "Kali Flash Utility v1.6.2"
echo "Current Device: $currentmodel ($currentdevice)"
echo "Your device MUST have TWRP recovery installed in order to continue"
echo ""
echo "Please make a selection:"
echo "[1] Install Kali NetHunter"
echo "[2] Install Additional Tools"
echo "[3] Build Kali (Kali Linux Only)"
echo "[4] Delete All Existing Files"
echo "[5] Select A Different Device"
echo "[6] Update Script"
echo ""
echo "[Q] Exit"
echo ""
read -p "Please make a selection: " menuselection
case $menuselection in
1) f_dl_tools; f_dl_su; f_dl_kali; f_kalinotwrp; f_menu;;
2) f_dl_tools; f_kalitools;;
3) f_build; f_menu;;
4) f_delete; f_deviceselect;;
5) f_deviceselect;;
6) f_update;;
q) clear; exit;;
*) f_menu;;
esac
}
####################
###NetHunter Menu###
####################
f_nethuntermenu(){
clear
echo "Nethunter Menu"
echo ""
echo "[1] Install NetHunter and MultiROM"
echo "[2] Install NetHunter with MultiROM Already Installed"
echo "[3] Install Nethunter to Existing ROM"
echo "[4] Download Files for manual install"
echo ""
echo "[Q] Return to Device Menu"
echo ""
read -p "Please make a selection: " nhselect
case $nhselect in
1) nmr=0; f_questions; f_dl_tools; f_dl_multirom; f_dl_kalirom; f_dl_gapps; f_dl_su; f_dl_kali; f_unlock; f_multirom; f_kali; f_menu;;
2) nmr=1; f_questions; f_dl_tools; f_dl_kalirom; f_dl_gapps; f_dl_su; f_dl_kali; f_kali; f_menu;;
3) f_dl_tools; f_dl_su; f_dl_kali; f_unlock; f_kalionly; f_menu;;
4) f_questions; f_dl_tools; f_dl_multirom; f_dl_twrp; f_dl_rmmultirom; f_dl_kalirom; f_dl_gapps; f_dl_su; f_dl_kali; f_menu;;
q) f_menu;;
*) f_nethuntermenu;;
esac
}
#######################
###Installable Tools###
#######################
f_kalitools(){
clear
echo "Kali Tools (ADB Debugging must be enabled, and device must be plugged in!)"
echo ""
echo "[1] Install dSploit"
echo "[2] Install Zimperium ANTI"
echo "[3] Install Network Spoofer"
echo "[4] Install USB Keyboard"
echo "[5] Install DriveDroid"
echo "[6] Install MultiROM Manager"
echo "[7] Install ADB and Fastboot tools for Kali"
echo ""
echo "[Q] Return to main menu"
echo ""
read -p "Make a selection: " ktools
clear
case $ktools in
1)
echo "Downloading dSploit"
echo ""
curl -o $apkdir/dsploit.apk 'http://rootbitch.cc/dsploit/dSploit-nightly.apk' --progress-bar
clear
echo "Waiting for device"
$adb wait-for-device
clear
echo "Installing dSploit. There may be additional confirmation dialogs on your device."
echo ""
$adb install $apkdir/dsploit.apk;;
2)
echo "Downloading Zimperium ANTI"
echo ""
curl -o $apkdir/zanti.apk 'https://s3.amazonaws.com/zANTI/zANTI2.apk' --progress-bar
clear
echo "Waiting for device"
$adb wait-for-device
clear
echo "Installing Zimperium ANTI. There may be additional confirmation dialogs on your device."
echo ""
$adb install $apkdir/zanti.apk;;
3)
echo "Downloading Network Spoofer"
echo ""
curl -L -o $apkdir/netspoof.apk 'http://sourceforge.net/projects/netspoof/files/netspoof/android-netspoof-2.0.2.apk/download' --progress-bar
clear
echo "Waiting for device"
$adb wait-for-device
clear
echo "Installing Network Spoofer. There may be additional confirmation dialogs on your device."
echo ""
$adb install $apkdir/netspoof.apk;;
4)
echo "Downloading USB Keyboard"
echo ""
curl -o $apkdir/usbkeyboard.apk 'https://raw.githubusercontent.com/pelya/android-keyboard-gadget/master/USB-Keyboard.apk' --progress-bar
clear
echo "Waiting for device"
$adb wait-for-device
clear
echo "Installing USB Keyboard. There may be additional confirmation dialogs on your device."
echo ""
$adb install $apkdir/usbkeyboard.apk;;
5)
echo "Downloading DriveDroid"
echo ""
curl -o $apkdir/drivedroid.apk 'http://softwarebakery.com/apps/drivedroid/files/drivedroid-free-0.9.17.apk' --progress-bar
clear
echo "Waiting for device"
$adb wait-for-device
clear
echo "Installing DriveDroid. There may be additional confirmation dialogs on your device."
echo ""
$adb install $apkdir/drivedroid.apk;;
6)
echo "Downloading MultiROM Manager"
echo ""
curl -L -o $apkdir/multirommgr.apk 'http://sourceforge.net/projects/kaliflashutility/files/All/multirommgr.apk/download' --progress-bar
clear
echo "Waiting for device"
$adb wait-for-device
clear
echo "Installing MultiROM Manager. There may be additional confirmation dialogs on your device."
echo ""
$adb install $apkdir/multirommgr.apk;;
q)
clear; f_menu;;
esac
clear
echo "Done!"
sleep 2
f_kalitools
}
########################
###Download ADB Tools###
########################
f_dl_tools(){
clear
unamestr=`uname`
cd $maindir
case $unamestr in
Darwin)
echo "OS X operating system detected."
echo ""
echo "Downloading ADB and Fastboot (Developer Tools required)"
echo ""
cd $commondir
git clone git://git.kali.org/packages/google-nexus-tools
clear
echo "Setting Up Tools"
mv ./google-nexus-tools ./adb-tools
cd ./adb-tools
mv ./bin/* ./
rm -rf ./bin
rm -rf ./debian
rm -rf install.sh
rm -rf license.txt
rm -rf README.md
rm -rf udev.txt
rm -rf uninstall.sh
cd ~/
adb=$commondir/adb-tools/mac-adb
fastboot=$commondir/adb-tools/mac-fastboot;;
*)
echo "Linux-based OS detected."
echo ""
echo "Installing cURL (Password may be required)"
echo ""
sudo apt-get -qq update && sudo apt-get -qq -y install curl
clear
echo "Downloading ADB and Fastboot"
echo ""
cd $commondir
git clone git://git.kali.org/packages/google-nexus-tools
clear
echo "Setting Up Tools"
gunzip -c adbtools.tar.gz | tar xopf -
mv ./google-nexus-tools ./adb-tools
cd ./adb-tools
mv ./bin/* ./
rm -rf ./bin
rm -rf ./debian
rm -rf install.sh
rm -rf license.txt
rm -rf README.md
rm -rf udev.txt
rm -rf uninstall.sh
cd ~/
adb=$commondir/adb-tools/linux-i386-adb
fastboot=$commondir/adb-tools/linux-i386-fastboot;;
esac
cd ~/
chmod 755 $adb
chmod 755 $fastboot
clear
}
######################
###Run Build Script###
######################
f_build(){
unamestr=`uname`
case $unamestr in
Darwin)
clear
echo "Sorry, OS X is not supported!"
echo ""
read -p "Press [Enter] to return to the main menu" null
clear;;
*)
unamearch=`uname -m`
case $unamearch in
x86_64|amd64)
clear
echo "Deleting current Build directory"
rm -rf ~/arm-stuff
echo "Making Directories"
mkdir ~/arm-stuff
cd ~/arm-stuff
echo "Cloning Git repositories to home directory"
git clone https://github.com/offensive-security/gcc-arm-linux-gnueabihf-4.7
export PATH=${PATH}:/root/arm-stuff/gcc-arm-linux-gnueabihf-4.7/bin
git clone https://github.com/offensive-security/kali-nethunter
cd ~/arm-stuff/kali-nethunter
echo "Running Scripts"
./build-deps.sh
./androidmenu.sh
clear;;
*)
echo "Sorry, only 64 Bit installations of linux are supported!"
echo "If you believe this is an error, please report it to photonicgeek"
echo ""
read -p "Press [Enter] to return to the main menu" null
clear;;
esac
clear;;
esac
}
###############
###Questions###
###############
f_questions(){
case $nmr in
1) clear;;
*)
clear
echo "Is your existing ROM based off of"
echo "[1] AOSP"
echo "[2] CyanogenMod"
echo ""
read -p "Make a selection: " basekernel
clear
if [ -e $devicedir/multirom.zip ]; then
echo "MultiROM found:"
echo "[1] Delete and Redownload"
echo "[2] Reuse"
echo ""
read -p "Make a Selection: " keepmultirom
case $keepmultirom in
1) clear; echo "Deleting..."; rm -rf $devicedir/multirom.zip; keepmultirom=0;;
2) clear; echo "Keeping file"; keepmultirom=1;;
esac
fi
clear
if [ -e $devicedir/base-kernel.zip ]||[ -e; then
echo "Base Kernel found:"
echo "[1] Delete and Redownload"
echo "[2] Reuse"
echo ""
read -p "Make a Selection: " keepbasekernel
case $keepbasekernel in
1) clear; echo "Deleting..."; rm -rf $devicedir/base-kernel.zip; rm -rf $devicedir/base-kernel-cm.zip; keepbasekernel=0;;
2) clear; echo "Keeping file"; keepbasekernel=1;;
esac
fi
clear
if [ -e $devicedir/TWRP.img ]; then
echo "TWRP found:"
echo "[1] Delete and Redownload"
echo "[2] Reuse"
echo ""
read -p "Make a Selection: " keeptwrp
case $keeptwrp in
1) clear; echo "Deleting..."; rm -rf $devicedir/TWRP.img; keeptwrp=0;;
2) clear; echo "Keeping file"; keeptwrp=1;;
esac
fi;;
esac
clear
echo "What ROM would you like?"
echo "[1] OmniROM"
echo "[2] Paranoid Android"
echo ""
echo "[3] Custom (Must be AOSP based)"
if [ -e $devicedir/omnirom.zip ]||[ -e $devicedir/paranoid.zip ]; then
echo ""
echo "[4] Existing Download"
fi
echo ""
read -p "Make a selection: " romchoice
case $romchoice in
3)
clear
echo "Please drag your desired ROM into this window, then press [Enter], or [Q] to go back."
echo ""
read -p "" customrom
case $customrom in
q) f_allquestions;;
*) cp $customrom $devicedir/customrom.zip;;
esac;;
4)
clear
echo "Finding existing ROMs"
sleep 1
clear
echo "ROMs Found"
if [ -e $devicedir/omnirom.zip ]; then
echo "[O]mniROM"
fi
if [ -e $devicedir/paranoid.zip ]; then
echo "[P]aranoid Android"
fi
echo ""
echo "[Q] Go back"
echo ""
read -p "Make a Selection: " romselection
case $romselection in
o) reuserom=1; rom=omnirom;;
p) reuserom=1; rom=paranoid;;
q) f_allquestions;;
esac;;
esac
clear
echo "What GApps package would you like?"
echo "[1] Pico GApps Package"
echo "[2] Nano GApps Package"
echo "[3] Micro GApps Package"
echo "[4] Full GApps Package"
echo "[5] Stock GApps Package"
if [ -e $commondir/pico-gapps.zip ]||[ -e $commondir/nano-gapps.zip ]||[ -e $commondir/micro-gapps.zip ]||[ -e $commondir/full-gapps.zip ]||[ -e $commondir/stock-gapps.zip ]; then
echo ""
echo "[6] Exsisting Download"
fi
echo ""
read -p "Make a selection: " gappschoice
case $gappschoice in
6)
clear
echo "Finding existing GApps Packages"
sleep 1
clear
echo "GApps Packages Found:"
if [ -e $commondir/pico-gapps.zip ]; then
echo "[P]ico GApps"
fi
if [ -e $commondir/nano-gapps.zip ]; then
echo "[N]ano GApps"
fi
if [ -e $commondir/micro-gapps.zip ]; then
echo "[M]icro GApps"
fi
if [ -e $commondir/full-gapps.zip ]; then
echo "[F]ull GApps"
fi
if [ -e $commondir/stock-gapps.zip ]; then
echo "[S]tock GApps"
fi
echo ""
echo "[Q] Go back"
echo ""
read -p "Make a Selection: " gappsselection
case $gappsselection in
p) reusegapps=1; gapps=pico;;
n) reusegapps=1; gapps=nano;;
m) reusegapps=1; gapps=micro;;
f) reusegapps=1; gapps=full;;
s) reusegapps=1; gapps=stock;;
q) f_allquestions;;
esac;;
esac
clear
if [ -e $commondir/su.zip ]; then
echo "SuperSU found:"
echo "[1] Delete and Redownload"
echo "[2] Reuse"
echo ""
read -p "Make a Selection: " keepsu
case $keepsu in
1) clear; echo "Deleting..."; rm -rf $commondir/su.zip; keepsu=0;;
2) clear; echo "Keeping file"; keepsu=1;;
esac
fi
clear
if [ -e $devicedir/kali-utilities.zip ]; then
echo "Kali NetHunter Package found:"
echo "[1] Delete and Redownload"
echo "[2] Reuse"
echo ""
read -p "Make a Selection: " keepkali
case $keepkali in
1) clear; echo "Deleting..."; rm -rf $devicedir/kali-utilities.zip; keepkali=0;;
2) clear; echo "Keeping file"; keepkali=1;;
esac
fi
clear
}
#######################
###Download MultiROM###
#######################
f_dl_multirom(){
clear
case $basekernel in
1) kerneltype="";;
2) kerneltype=-cm;;
esac
case $keepmultirom in
1) echo "Using Existing MultiROM"; sleep 1;;
*)
echo "Downloading Multirom"
echo ""
url="http://sourceforge.net/projects/kaliflashutility/files/${currentdevice}/multirom.zip/download"
curl -L -o $devicedir/multirom.zip $url --progress-bar;;
esac
clear
case $keepbasekernel in
1) echo "Using Existing MultiROM Kernel"; sleep 1;;
*)
echo "Downloading MultiROM Kernel"
echo ""
url="http://sourceforge.net/projects/kaliflashutility/files/${currentdevice}/base-kernel${kerneltype}.zip/download"
curl -L -o $devicedir/base-kernel$kerneltype.zip $url --progress-bar;;
esac
clear
case $keeptwrp in
1) echo "Using Existing TWRP Recovery"; sleep 1;;
*)
echo "Downloading TWRP"
echo ""
url="http://sourceforge.net/projects/kaliflashutility/files/${currentdevice}/TWRP.img/download"
curl -L -o $devicedir/twrp.img $url --progress-bar;;
esac
clear
}
##########################
###Download Normal TWRP###
##########################
f_dl_twrp(){
clear
url="http://techerrata.com/file/twrp2/$currentdevice/openrecovery-twrp-2.8.0.1-$currentdevice.img"
echo "Downloading Standard TWRP"
echo ""
curl -L -o $devicedir/stock-twrp.img $url --progress-bar
clear
}
###################################
###Download MultiROM Uninstaller###
###################################
f_dl_rmmultirom(){
clear
url="http://sourceforge.net/projects/kaliflashutility/files/$currentdevice/rm-multirom.zip/download"
echo "Downloading Standard TWRP"
echo ""
curl -L -o $devicedir/rm-multirom.zip $url --progress-bar
clear
}
#######################
###Download Kali ROM###
#######################
f_dl_kalirom(){
clear
currentday=`date +%d`
ndays="1"
day=`expr $currentday - $ndays`
builddate=`date +%Y%m`"$day"
case $reuserom in
1)
echo "Using Existing ROM"
sleep 1;;
*)
case $romchoice in
1)
rom=omnirom
url="http://dl.omnirom.org/$currentdevice/omni-4.4.4-$builddate-$currentdevice-NIGHTLY.zip"
clear
echo "Downloading ROM"
echo ""
curl -L -o $devicedir/$rom.zip $url --progress-bar
clear;;
2)
rom=paranoid
url="http://download.paranoidandroid.co/roms/$currentdevice/pa_$currentdevice-4.6-BETA3-20141002.zip"
clear
echo "Downloading ROM"
echo ""
curl -L -o $devicedir/$rom.zip $url --progress-bar
clear;;
3)
rom=customrom
clear
echo "Using Custom ROM"
sleep 2
clear;;
*) f_dl_kalirom;;
esac;;
esac
}
####################
###Download GApps###
####################
f_dl_gapps(){
clear
case $gappschoice in
1) gapps=pico;;
2) gapps=nano;;
3) gapps=micro;;
4) gapps=full;;
5) gapps=stock;;
6) clear;;
*) f_dl_gapps;;
esac
case $reusegapps in
1) echo "Using Existing GApps"; sleep 1;;
*)
clear
url="http://sourceforge.net/projects/kaliflashutility/files/All/$gapps-gapps.zip/download"
echo "Downloading GApps"
echo ""
curl -L -o $commondir/$gapps-gapps.zip $url --progress-bar
clear
esac
clear
}
######################
###Download SuperSU###
######################
f_dl_su(){
clear
case $keepsu in
1) echo "Using Existing SuperSU"; sleep 1;;
*)
echo "Downloading SuperSU"
echo ""
mkdir -p $commondir
cd $commondir
python << END
import urllib2
import urllib
class LatestRomUtil:
def __init__(self, device):
self.changeDevice(device)
def __getPage(self, url, retRedirUrl = False):
try:
bOpener = urllib2.build_opener()
bOpener.addheaders = [("User-agent", "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.146 Safari/537.36")]
pResponse = bOpener.open(url)
if retRedirUrl == True:
return pResponse.geturl()
else:
pageData = pResponse.read()
return pageData
except Exception:
return ""
def changeDevice(self, device):
self.device = device.strip().lower()
def dlSuperSU(self):
getUrl = self.__getPage("http://download.chainfire.eu/supersu", True)
latestUrl = getUrl + "?retrieve_file=1"
return latestUrl
# below is example usage
romUtil = LatestRomUtil("tf300t")
print "Downloading to su.zip"
urllib.urlretrieve (romUtil.dlSuperSU(), "su.zip")
END
cd ~/
echo "Download complete"
sleep 1;;
esac
clear
}
#############################
###Download Kali Utilities###
#############################
f_dl_kali(){
clear
case $keepkali in
1) echo "Using Existing Kali Package"; sleep 1;;
*)
case $currentdevice in
flo) url="http://images.kali.org/kali_linux_nethunter_nexus7_2013.zip";;
deb) url="http://images.kali.org/kali_linux_nethunter_nexus7_2013.zip";;
grouper) url="http://images.kali.org/kali_linux_nethunter_nexus7_2012.zip";;
tilapia) url="http://images.kali.org/kali_linux_nethunter_nexus7_2012.zip";;
hammerhead) url="http://images.kali.org/kali_linux_nethunter_nexus5.zip";;
manta) url="http://images.kali.org/kali_linux_nethunter_nexus10.zip";;
mako) url="http://images.kali.org/kali_linux_nethunter_nexus4.zip";;
*) url="http://sourceforge.net/projects/kaliflashutility/files/All/kali-utilities.zip/download";;
esac
echo "Downloading Kali Utilities. (This could take a while!)"
echo ""
curl -L -o $devicedir/kali-utilities.zip $url --progress-bar;;
esac
clear
}
###################
###Unlock Device###
###################
f_unlock(){
clear
echo "WARNING: This step will erase your device if your bootloader is locked!"
echo "If your bootloader is already unlocked, this will not affect your device."
echo ""
echo "Boot into the bootloader by turning off the device and holding the volume down and power button."
read -p "Press [Enter] to continue." null
clear
echo "Unlocking"
echo ""
$fastboot oem unlock
sleep 2
clear
echo "On the screen there is a prompt to erase the device, select yes. THIS ERASES YOUR DEVICE!!!"
echo "Once the device finishes erasing, set up your device like normal before continuing"
echo "If your device is already unlocked the erase device screen won't show. Just continue."
echo ""
read -p "Press [Enter] to continue" null
clear
}
####################
###Flash MultiROM###
####################
f_multirom(){
clear
echo "Boot into the bootloader by turning off the device and holding the volume down and power button."
echo "DO NOT touch your device during this process unless told to do so."
echo ""
read -p "Press [Enter] to continue." null
clear
echo "Flashing TWRP"
$fastboot flash recovery $devicedir/twrp.img
clear
echo "Booting into recovery"
$fastboot boot $devicedir/twrp.img
sleep 30
clear
echo "Booting into recovery (again)"
$adb reboot recovery
sleep 30
clear
echo "Moving files to device to install"
$adb push $devicedir/base-kernel${kerneltype}.zip /sdcard/kalitmp/base-kernel.zip
$adb push $devicedir/multirom.zip /sdcard/kalitmp/multirom.zip
$adb shell "echo -e 'print #############################\nprint #####Installing MultiROM#####\nprint #############################\ninstall /sdcard/kalitmp/multirom.zip\nprint ###########################\nprint #####Installing Kernel#####\nprint ###########################\ninstall /sdcard/kalitmp/base-kernel.zip\ncmd rm -rf /sdcard/kalitmp\ncmd reboot\n' > /cache/recovery/openrecoveryscript"
$adb reboot recovery
clear
}
###############
###Flash All###
###############
f_kali(){
clear
echo "Boot into recovery by turning the device off and pressing and holding volume up and power."
echo "If you are already in recovery, make sure you are at the home screen."
echo ""
read -p "Press [Enter] to continue." null
clear
echo "Tap Advanced > MultiROM > Add ROM > Next > ADB Sideload"
echo ""
read -p "Press [Enter] to continue." null
clear
echo "Flashing ROM"
echo ""
$adb sideload $devicedir/$rom.zip
echo ""
read -p "Press [Enter] when flashing is complete, or [R] to retry." choice
case $choice in
r) f_kalirom;;
*) clear;;
esac
clear
echo "Press the home button in the bottom left, then press:"
echo "Advanced > MultiROM > List ROMs > sideload > Rename"
echo "Then rename the ROM to 'Kali'"
echo ""
read -p "Press [Enter] to continue" null
clear
echo "Pushing files to device"
echo ""
$adb shell mkdir /sdcard/kalitmp
$adb shell mkdir /sdcard/multirom/roms/Kali
$adb shell mkdir /sdcard/multirom/roms/Kali/cache
$adb shell mkdir /sdcard/multirom/roms/Kali/cache/recovery
$adb push $devicedir/$rom.zip /sdcard/kalitmp/Kali.zip
$adb push $commondir/$gapps-gapps.zip /sdcard/kalitmp/gapps.zip
$adb push $commondir/su.zip /sdcard/kalitmp/su.zip
$adb push $devicedir/kali-utilities.zip /sdcard/kalitmp/utilities.zip
clear
echo "Creating recovery script and pushing to device"
$adb shell "echo -e 'print ##########################\nprint #####Installing GApps#####\nprint ##########################\ninstall /sdcard/kalitmp/gapps.zip\nprint ############################\nprint #####Installing SuperSU#####\nprint ############################\ninstall /sdcard/kalitmp/su.zip\nprint #########################\nprint #####Installing Kali#####\nprint #########################\ninstall /sdcard/kalitmp/utilities.zip\ncmd rm -rf /sdcard/kalitmp\ncmd reboot\n' > data/media/0/multirom/roms/Kali/cache/recovery/openrecoveryscript"
clear
echo "Rebooting into recovery"
$adb reboot recovery
clear
echo "Flashing will take a while, anywhere between 30-45 minutes. Please be patient!"
echo ""
read -p "Press [Enter] when flashing is complete" null
clear
echo "Congratulations! You now Kave Kali NetHunter on your device!"
echo ""
read -p "Press [Enter] to return to main menu" null
clear
}
###############
###Flash All###
###############
#f_kali(){
#clear
#echo "Boot into the bootloader by turning off the device and holding the volume down and power button."
#echo "DO NOT touch your device during this process unless told to do so."
#echo ""
#read -p "Press [Enter] to continue." null
#
#clear
#echo "Flashing TWRP"
#$fastboot flash recovery $devicedir/twrp.img
#
#clear
#echo "Booting into recovery"
#$fastboot boot $devicedir/twrp.img
#sleep 30
#
#clear
#echo "Moving files to device to install"
#$adb push $devicedir/base-kernel${kerneltype}.zip /sdcard/kalitmp/base-kernel.zip
#$adb push $devicedir/multirom.zip /sdcard/kalitmp/multirom.zip
#$adb shell "echo -e 'print #############################\nprint #####Installing MultiROM#####\nprint #############################\ninstall /sdcard/kalitmp/multirom.zip\nprint ###########################\nprint #####Installing Kernel#####\nprint ###########################\ninstall /sdcard/kalitmp/base-kernel.zip\ncmd rm -rf /sdcard/kalitmp\ncmd reboot recovery\n' > /cache/recovery/openrecoveryscript"
#$adb reboot recovery
#sleep 60
#
#clear
#echo "Creating Directories"
#echo ""
#$adb shell mkdir /sdcard/kalitmp
#$adb shell mkdir /sdcard/multirom/roms/Kali
#$adb shell mkdir /sdcard/multirom/roms/Kali/boot
#$adb shell mkdir /sdcard/multirom/roms/Kali/cache
#$adb shell mkdir /sdcard/multirom/roms/Kali/data
#$adb shell mkdir /sdcard/multirom/roms/Kali/system
#$adb shell mkdir /sdcard/multirom/roms/Kali/cache/recovery
#
#clear
#echo "Pushing files to device. DO NOT TOUCH YOUR DEVICE."
#echo ""
#$adb push $devicedir/$rom.zip /sdcard/kalitmp/Kali.zip
#$adb push $commondir/$gapps-gapps.zip /sdcard/kalitmp/gapps.zip
#$adb push $commondir/su.zip /sdcard/kalitmp/su.zip
#$adb push $devicedir/kali-utilities.zip /sdcard/kalitmp/utilities.zip
#
#clear
#echo "Creating recovery script and pushing to device"
#$adb shell "echo -e 'print ########################\nprint #####Installing ROM#####\nprint ########################\ninstall /sdcard/kalitmp/Kali.zip\nprint ##########################\nprint #####Installing GApps#####\nprint ##########################\ninstall /sdcard/kalitmp/gapps.zip\nprint ############################\nprint #####Installing SuperSU#####\nprint ############################\ninstall /sdcard/kalitmp/su.zip\nprint #########################\nprint #####Installing Kali#####\nprint #########################\ninstall /sdcard/kalitmp/utilities.zip\ncmd rm -rf /sdcard/kalitmp\ncmd reboot\n' > /data/media/0/multirom/roms/Kali/cache/recovery/openrecoveryscript"
#
#clear
#echo "Rebooting into recovery"
#$adb reboot recovery
#
#clear
#echo "Flashing will take a while, anywhere between 30-45 minutes. Please be patient!"
#echo ""
#read -p "Press [Enter] when flashing is complete" null
#
#clear
#echo "Congratulations! You now Kave Kali NetHunter on your device!"
#echo ""
#read -p "Press [Enter] to return to main menu" null
#clear
#}
###########################
###Kali Without MultiROM###
###########################
f_kalionly(){
clear
echo "Your current ROM MUST BE based off of stock/AOSP. If it is not, you WILL have problems."
echo ""
read -p "Press [Enter] to continue" null
clear
echo "Boot into the bootloader by turning off the device and holding the volume down and power button."
echo "DO NOT touch your device during this process unless told to do so."
echo ""
read -p "Press [Enter] to continue." null
clear
echo "Flashing TWRP"
$fastboot flash recovery $devicedir/stock-twrp.img
clear
echo "Booting into recovery"
$fastboot boot $devicedir/stock-twrp.img
sleep 30
clear
echo "Booting into recovery (again)"
$adb reboot recovery
sleep 30
clear
echo "Pushing files to device"
$adb shell mkdir /sdcard/kalitmp
$adb push $commondirdir/su.zip /sdcard/kalitmp/su.zip
$adb push $devicedir/kali-utilities.zip /sdcard/kalitmp/kali-utilities.zip
$adb shell "echo -e 'print ############################\nprint #####Installing SuperSU#####\nprint ############################\ninstall /sdcard/kali/su.zip\nprint #########################\nprint #####Installing Kali#####\nprint #########################\ninstall /sdcard/kali/kali-utilities.zip\ncmd rm -rf /sdcard/kalitmp\ncmd reboot\n' > /cache/recovery/openrecoveryscript"
$adb reboot recovery
clear
echo "Flashing will take a while, anywhere between 30-45 minutes. Please be patient!"
echo ""
read -p "Press [Enter] when flashing is complete" null
clear
echo "Congratulations! You now Kave Kali NetHunter on your device!"
echo ""
read -p "Press [Enter] to return to main menu" null
clear
}
##################
###Kali No TWRP###
##################
f_kalinotwrp(){
clear