forked from screetsec/TheFatRat
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.sh
executable file
·1226 lines (1180 loc) · 39 KB
/
setup.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/bash
# In case mingw64 or 32bit are not found then proceed to their instalation according to user linux architecture
function mingwi() {
case "$arch" in
x86_64|aarch64)
#double check for mingw64
which i686-w64-mingw32-gcc > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
#mingw64 detected
echo -e $green "[ ✔ ] Mingw-w64 Compiler................[ found ]"
#write mingw64 location to log file
which i686-w64-mingw32-gcc >> "$log" 2>&1
#Write that ming64 was detected to install.log , so user know that mingw is ok
echo "Mingw64 -> OK" >> "$inst"
sleep 1
else
echo -e $red "[ X ] mingw-w64 compiler -> not found "
echo -e $yellow "[ ! ] Installing Mingw-64 "
#Mingw64 was not found , install it using kali repository
xterm -T "☣ INSTALL MINGW64 COMPILLER ☣" -geometry 100x30 -e "sudo apt-get install mingw-w64 --force-yes -y"
#After instalation , check again for mingw64
which i686-w64-mingw32-gcc >> "$log" 2>&1
if [ "$?" -eq "0" ]; then
#Instalation was succefully
echo -e $green "[ ✔ ] Mingw64 -> OK"
echo "Mingw64 -> OK" >> "$inst"
else
#Instalation of mingw64 failed
echo -e $red "[ x ] Mingw64"
#Write 0 to check file so setup can know in the end that something failed
echo "0" > "$stp"
#Write in install.log that Mingw64 instalation was not sucefully
echo "Mingw64 -> NOT OK" >> "$inst"
fi
fi
;;
#Same procedure as before but for mingw32
i386|i486|i586|i686|armv7l)
which i586-mingw32msvc-gcc > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Mingw32 Compiler..................[ found ]"
which i586-mingw32msvc-gcc >> "$log" 2>&1
echo "Mingw32 -> OK" >> "$inst"
sleep 1
else
echo -e $red "[ X ] mingw32 compiler -> not found "
echo -e $yellow "[ ! ] Installing Mingw32 "
xterm -T "☣ INSTALL MINGW32 COMPILLER ☣" -geometry 100x30 -e "sudo apt-get install mingw32 --force-yes -y"
which i586-mingw32msvc-gcc >> "$log" 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Mingw32 -> OK"
echo "Mingw32 -> OK" >> "$inst"
else
echo -e $red "[ x ] Mingw32"
echo "0" > "$stp"
echo "Mingw32 -> NOT OK" >> "$inst"
fi
fi
;;
*)
#none of the accepted architectures were detected , infor user to create an issue in fatrat git with his linux arch
echo -e $red "Architecture not in list , aborting installation"
echo -e $yellow "Please report into issues on Fatrat github this Arch : Arch=($arch)"
echo ""
echo -e $green "Press any key to continue"
read abo
# Instalation was aborted , return user sources.list to original
echo -e $blue "Reactivating you original repositories"
rm -f /etc/apt/sources.list
mv /etc/apt/sources.list.backup /etc/apt/sources.list
#now we can remove the emergency backup securely
rm -f /etc/apt/sources.list.fatrat
apt-get clean
xterm -T "☣ UPDATE YOUR REPO ☣" -geometry 100x30 -e "sudo apt-get update "
clear
exit 0
;;
esac
}
#Instalation of searchsploit (exploitdb)
function ssplt() {
# check if searchsploit exists
which searchsploit > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Searchsploit......................[ found ]"
echo "searchsploit" | tee -a "$config" "$log" > /dev/null 2>&1
echo "Searchsploit -> OK" >> "$inst"
sleep 1
else
echo -e $red "[ X ] searchsploit -> not found"
echo ""
echo -e $okegreen "Select one of the options bellow"
echo -e $orange "+-------------------------------------------------+"
echo -e $orange "|$white [$okegreen 1$white ]$yellow Setup Searchsploit Path Manually$orange |"
echo -e $orange "|$white [$okegreen 2$white ]$yellow Install Searchsploit from Kali Repository$orange |"
echo -e $orange "+-------------------------------------------------+"
echo ""
echo -ne $okegreen "Option : ";tput sgr0
read q1
case $q1 in
1)
echo ""
echo -e $green "Enter The Path of your Searchsploit instalation"
echo -e $cyan "ex : /opt/searchsploit/searchsploit"
echo ""
echo -ne $green "PATH : ";tput sgr0
read sspp
if [ ! -f $sspp ]
then
echo ""
echo -e $red "It was not possible to found searchsploit executable in : $sspp"
echo ""
echo -e $green "Make sure you write the right path of your instalation"
echo ""
echo -e $okegreen "Press [ENTER] key to try again ."
read cont
ssplt
else
echo "bash $sspp" | tee -a "$config" "$log" > /dev/null 2>&1
echo "Searchsploit -> OK" >> "$inst"
fi
;;
#ok
2)
echo -e $yellow "[ ! ] Installing Searchsploit "
xterm -T "☣ INSTALL SEARCHSPLOIT ☣" -geometry 100x30 -e "sudo apt-get install exploitdb --force-yes -y"
which searchsploit > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Searchsploit"
echo "searchsploit" | tee -a "$config" "$log" > /dev/null 2>&1
echo "Searchsploit -> OK" >> "$inst"
else
echo "0" > "$stp"
echo "Searchsploit -> Not OK" >> "$inst"
fi
;;
*)
ssplt
;;
esac
fi
echo ""
#Go check the check file exists and read its value
chk=$path/logs/check
if [ -f "$chk" ]
then
ct=`sed -n 1p $chk`
#if value of check is 0 theen some package was not installed sucefully
if [ "$ct" == "0" ]; then
clear
echo -e $red "Fatrat was not able to install some packages"
echo ""
echo -e $blue "Reactivating you original repositories"
rm -f /etc/apt/sources.list
mv /etc/apt/sources.list.backup /etc/apt/sources.list
#now we can remove the emergency backup securely
rm -f /etc/apt/sources.list.fatrat
apt-get clean
xterm -T "☣ UPDATE YOUR REPO ☣" -geometry 100x30 -e "sudo apt-get update "
clear
rm -rf "$config" >/dev/null 2>&1
# Currently building the diagnostic script
#echo -e $okegreen "Starting diagnostics"
#chmod +x diag.sh > /dev/null 2>&1
#./diag.sh
#Display to user the install.log file and inform him what to do
echo "Was not possible to install The Packages Labeled (Not Ok) in this list above" >> "$inst"
echo "Try : (apt-get remove --purge <packagename> && apt-get autoremove && apt-get install -f)" >> "$inst"
echo "before running fatrat setup script again" >> "$inst"
cat "$inst"
exit
elif [ "$ct" == "1" ]; then
echo ""
#value in check file is 1 , then everything is ok , delete install.log file and proceed to finish setup
rm -rf "$inst" >/dev/null 2>&1
fi
else
#in case value in check file is not 0 or 1 then something is wrong
echo -e $okegreen "Something went very wrong , execute ./setup.sh again"
rm -rf "$config" >/dev/null 2>&1
echo ""
echo "Was not possible to install The Packages Labeled (Not Ok) in this list above" >> "$inst"
echo "Try : (apt-get remove --purge <packagename> && apt-get autoremove && apt-get install -f)" >> "$inst"
echo "before running fatrat setup script again" >> "$inst"
cat "$inst"
exit
fi
}
function bkf() {
# Check if backdoor-factory exists
which backdoor-factory > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Backdoor-Factory..................[ found ]"
echo "backdoor-factory" | tee -a "$config" "$log" > /dev/null 2>&1
echo "Backdoor-Factory -> OK" >> "$inst"
sleep 1
ssplt
else
echo -e $red "[ X ] backdoor-factory -> not found "
echo ""
echo ""
echo -e $green "Select one of the options bellow"
echo -e $orange "+-----------------------------------------------------+"
echo -e $orange "|$white [$okegreen 1$white ]$yellow Setup Backdoor-Factory Path Manually$orange |"
echo -e $orange "|$white [$okegreen 2$white ]$yellow Install Backdoor-Factory from Kali Repository$orange |"
echo -e $orange "+-----------------------------------------------------+"
echo ""
echo -ne $green "Option : ";tput sgr0
read q2
case $q2 in
1)
echo ""
echo -e $green "Enter The Path of your backdoor-factory instalation"
echo -e $cyan "ex : /opt/backdoor-factory/backdoor.py"
echo ""
echo -ne $green "PATH : ";tput sgr0
read msp
bkdf=$msp
if [ ! -f $bkdf ]
then
echo ""
echo -e $red "It was not possible to found backdoor-factory executable in : $bkdf"
echo ""
echo -e $green "Make sure you write the right path of your instalation"
echo ""
echo -e $green "Press [ENTER] key to try again ."
read cont
bkf
fi
echo "python2 $bkdf" | tee -a "$config" "$log" > /dev/null 2>&1
echo "Backdoor-factory -> OK" >> "$inst"
ssplt
;;
2)
echo -e $yellow "[ ! ] Installing backdoor-factory "
xterm -T "☣ INSTALL BACKDOOR-FACTORY ☣" -geometry 100x30 -e "sudo apt-get install backdoor-factory --force-yes -y"
which backdoor-factory > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Backdoor-Factory -> OK"
echo "backdoor-factory" | tee -a "$config" "$log" > /dev/null 2>&1
echo "Backdoor-factory -> OK" >> "$inst"
else
echo -e $red "[ X ] backdoor-factory"
echo "0" > "$stp"
echo "Backdoor-factory -> Not OK" >> "$inst"
ssplt
fi
;;
*)
bkf
;;
esac
fi
}
function mtspl() {
# check if metasploit-framework its installed
which msfconsole > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Metasploit-Framework..............[ found ]"
echo "msfconsole" | tee -a "$config" "$log" >> /dev/null 2>&1
echo "msfvenom" | tee -a "$config" "$log" >> /dev/null 2>&1
echo "Metasploit -> OK" >> "$inst"
sleep 1
bkf
else
echo -e $red "[ X ] metasploit-framework -> not found "
# Providing manual input to user in case metasploit was installed from git and is not on system path
echo ""
echo -e $okegreen "Select one of the options bellow"
echo -e $orange "+---------------------------------------------------------+"
echo -e $orange "|$white [$okegreen 1$white ]$yellow Setup Metasploit Framework Path Manually$orange |"
echo -e $orange "|$white [$okegreen 2$white ]$yellow Install Metasploit Framework from Kali Repository$orange |"
echo -e $orange "+---------------------------------------------------------+"
echo ""
echo -ne $okegreen "Option : ";tput sgr0
read q3
case $q3 in
1)
echo ""
echo -e $green "Enter The Path of your metasploit instalation"
echo -e $cyan "ex : /opt/metasploit-framework"
echo ""
echo -ne $green "PATH : ";tput sgr0
read msp
msfc=$msp/msfconsole
msfv=$msp/msfvenom
if [ ! -f $msfc ]
then
echo ""
echo -e $red "It was not possible to found msfconsole in : $msfc"
echo ""
echo -e $green "Make sure you write the right path of your instalation"
echo ""
echo -e $green "Press [ENTER] key to try again ."
read cont
mtspl
fi
if [ ! -f $msfv ]
then
echo ""
echo -e $red "It was not possible to found msfvenom in : $msfv"
echo ""
echo -e $green "Make sure you write the right path of your instalation"
echo ""
echo -e $green "Press [ENTER] key to try again ."
read cont
mtspl
fi
#Creation of symlinks to metasploit manual path in /usr/local/sbin to avoid changes in fatrat scripts
unlink /usr/local/sbin/msfconsole > /dev/null 2>&1
unlink /usr/local/sbin/msfvenom > /dev/null 2>&1
ln -s $msfc /usr/local/sbin/msfconsole > /dev/null 2>&1
ln -s $msfv /usr/local/sbin/msfvenom > /dev/null 2>&1
echo "msfconsole" | tee -a "$config" "$log" > /dev/null 2>&1
echo "msfvenom" | tee -a "$config" "$log" > /dev/null 2>&1
echo "Metasploit -> OK" >> "$inst"
bkf
;;
2)
echo -e $yellow "[ ! ] Installing Metasploit-Framework "
xterm -T "☣ INSTALL METASPLOIT-FRAMEWORK ☣" -geometry 100x30 -e "sudo apt-get install metasploit-framework --force-yes -y"
which msfconsole > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Metasploit (msfconsole) -> OK"
echo "msfconsole" | tee -a "$config" "$log" > /dev/null 2>&1
echo "Metasploit (msfconsole) -> OK" >> "$inst"
else
echo -e $red "[ x ] Metasploit (msfconsole)"
echo "Metasploit (msfconsole) -> Not OK" >> "$inst"
echo "0" > "$stp"
fi
which msfvenom > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Metasploit (msfvenom) -> OK"
echo "msfvenom" | tee -a "$config" "$log" > /dev/null 2>&1
echo "Metasploit (msfvenom) -> OK" >> "$inst"
else
echo -e $red "[ x ] Metasploit (msfvenom)"
echo "0" > "$stp"
echo "Metasploit (msfvenom) -> Not OK" >> "$inst"
fi
bkf
;;
*)
mtspl
;;
esac
fi
}
function cont() {
stp="logs/check"
#remove any previous check file from previous attempts
rm -rf "$stp" >/dev/null 2>&1
#starting setup , input 1 value to check file
echo "1" > "$stp"
#remove any previous install.log file from previous attempts
rm -rf "$inst" >/dev/null 2>&1
#check if xterm is installed
which xterm > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Xterm.............................[ found ]"
which xterm >> "$log" 2>&1
echo "Xterm -> OK" > "$inst"
else
echo ""
echo -e $red "[ X ] xterm -> not found! "
echo -e $yellow "[ ! ] Installing Xterm "
echo -e $green ""
sudo apt-get install xterm -y
which xterm >> "$log" 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Xterm -> OK"
echo "Xterm -> OK" > "$inst"
else
echo -e $red "[ x ] Xterm"
echo "0" > "$stp"
echo "Xterm -> Not OK" > "$inst"
fi
fi
sleep 1
#check if dig its installed
which dig > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Dns-Utils ........................[ found ]"
which dig >> "$log" 2>&1
echo "Dns-Utils -> OK" >> "$inst"
else
echo -e $red "[ X ] dnsutils -> not found! "
echo -e $yellow "[ ! ] Installing dnsutils"
xterm -T "☣ INSTALL DNSUTILS ☣" -geometry 100x30 -e "sudo apt-get install dnsutils -y"
which dig >> "$log" 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Dns-Utils -> OK"
echo "Dns-Utils -> OK" >> "$inst"
else
echo -e $red "[ x ] Dns-Utils"
echo "0" > "$stp"
echo "Dns-Utils -> Not OK" >> "$inst"
fi
fi
sleep 1
# check if gcc exists
which gcc > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Gcc compiler......................[ found ]"
which gcc >> "$log" 2>&1
echo "GCC -> OK" >> "$inst"
else
echo -e $red "[ X ] gcc compiler -> not found "
echo -e $yellow "[ ! ] Installing gcc "
xterm -T "☣ INSTALL GCC COMPILLER ☣" -geometry 100x30 -e "sudo apt-get install gcc -y"
which gcc >> "$log" 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] GCC -> OK"
echo "GCC -> OK" >> "$inst"
else
echo -e $red "[ x ] GCC"
echo "0" > "$stp"
echo "GCC -> Not OK" >> "$inst"
fi
fi
sleep 1
# check if monodevelop exists
which monodevelop > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Monodevelop ......................[ found ]"
which monodevelop >> "$log" 2>&1
echo "Monodevelop -> OK" >> "$inst"
else
echo -e $red "[ X ] Monodevelop -> not found "
echo -e $yellow "[ ! ] Installing monodevelop "
xterm -T "☣ INSTALL MONODEVELOP ☣" -geometry 100x30 -e "sudo apt-get install monodevelop -y"
which monodevelop >> "$log" 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Monodevelop -> OK"
echo "Monodevelop -> OK" >> "$inst"
else
echo -e $red "[ x ] Monodevelop"
echo "0" > "$stp"
echo "Monodevelop -> Not OK" >> "$inst"
fi
fi
sleep 1
#check if apache2 exists
which apache2 > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Apache2 ..........................[ found ]"
which apache2 >> "$log" 2>&1
echo "Apache2 -> OK" >> "$inst"
else
echo -e $red "[ X ] Apache2 -> not found "
echo -e $yellow "[ ! ] Installing apache2 "
xterm -T "☣ INSTALL APACHE2 ☣" -geometry 100x30 -e "sudo apt-get install apache2 -y"
which apache2 >> "$log" 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Apache2 -> OK"
echo "Apache2 -> OK" >> "$inst"
else
echo -e $red "[ x ] Apache2"
echo "0" > "$stp"
echo "Apache2 -> Not OK" >> "$inst"
fi
fi
sleep 1
#check if gnome terminal exists
#added this new install option because user may be running a distro that may not have gnome terminal installed by default
#gnome terminal is used in main script to run searchsploit
which gnome-terminal > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Gnome Terminal....................[ found ]"
which gnome-terminal >> "$log" 2>&1
echo "Gnome Terminal -> OK" >> "$inst"
else
echo -e $red "[ X ] Gnome-terminal-> not found "
echo -e $yellow "[ ! ] Installing gnome-terminal "
xterm -T "☣ INSTALL GNOME-TERMINAL ☣" -geometry 100x30 -e "sudo apt-get install gnome-terminal -y"
which gnome-terminal >> "$log" 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Gnome Terminal -> OK"
echo "Gnome Terminal -> OK" >> "$inst"
else
echo -e $red "[ x ] Gnome Terminal"
echo "0" > "$stp"
echo "Gnome Terminal -> Not OK" >> "$inst"
fi
fi
#Checking if upx compressor exists
sleep 1
which upx > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] UPX Compressor....................[ found ]"
which upx >> "$log" 2>&1
echo "UPX -> OK" >> "$inst"
else
echo -e $red "[ X ] Upx compressor -> not found "
echo -e $yellow "[ ! ] Installing upx-compressor "
xterm -T "☣ INSTALL UPX COMPRESSOR ☣" -geometry 100x30 -e "sudo apt-get install upx-ucl -y"
which upx >> "$log" 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] UPX Compressor -> OK"
echo "UPX -> OK" >> "$inst"
else
echo -e $red "[ x ] UPX Compressor"
echo "0" > "$stp"
echo "UPX -> Not OK" >> "$inst"
fi
fi
sleep 1
#Checking if Ruby exists
which ruby > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Ruby..............................[ found ]"
which ruby >> "$log" 2>&1
echo "Ruby -> OK" >> "$inst"
else
echo -e $red "[ X ] Ruby -> not found "
echo -e $yellow "[ ! ] Installing Ruby "
xterm -T "☣ INSTALL Ruby ☣" -geometry 100x30 -e "sudo apt-get install ruby -y && gem install nokogiri"
which ruby >> "$log" 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Ruby -> OK"
echo "Ruby -> OK" >> "$inst"
else
echo -e $red "[ x ] Ruby"
echo "0" > "$stp"
echo "Ruby -> Not OK" >> "$inst"
fi
fi
sleep 1
#Checking if Openssl exists
which openssl > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Openssl...........................[ found ]"
which openssl >> "$log" 2>&1
echo "Openssl -> OK" >> "$inst"
else
echo -e $red "[ X ] Openssl -> not found "
echo -e $yellow "[ ! ] Installing Openssl "
xterm -T "☣ INSTALL OPENSSL ☣" -geometry 100x30 -e "sudo apt-get install openssl -y"
which openssl >> "$log" 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Openssl -> OK"
echo "Openssl -> OK" >> "$inst"
else
echo -e $red "[ x ] Openssl"
echo "0" > "$stp"
echo "Openssl -> Not OK" >> "$inst"
fi
fi
sleep 1
#installing dependencies for ruby script
echo -e $green "[ ! ] Installing tools dependencies"
xterm -T "☣ INSTALL DEPENDENCIES ☣" -geometry 100x30 -e "sudo apt-get install zlib1g-dev libmagickwand-dev imagemagick lib32z1 lib32ncurses5 lib32stdc++6 python-pip python-dev build-essential -y && pip install names"
sleep 1
#################################
#inputrepo
#################################
cp /etc/apt/sources.list /etc/apt/sources.list.backup # backup
# Second backup created in case user stops the script after this point , then on next startup this script will
# copy the already changed sources file before as backup , and user lost his original sources lists
file="/etc/apt/sources.list.fatrat"
if [ -f "$file" ]
then
echo ""
else
cp /etc/apt/sources.list /etc/apt/sources.list.fatrat
fi
rm -f /etc/apt/sources.list
touch /etc/apt/sources.list
echo 'deb http://old.kali.org/kali sana main non-free contrib' >> /etc/apt/sources.list
echo 'deb-src http://old.kali.org/kali sana main non-free contrib' >> /etc/apt/sources.list
echo 'deb http://http.kali.org/kali kali-rolling main contrib non-free' >> /etc/apt/sources.list
echo 'deb-src http://http.kali.org/kali kali-rolling main contrib non-free' >> /etc/apt/sources.list
xterm -T "☣ UPDATING KALI REPO ☣" -geometry 100x30 -e "sudo apt-get update"
sleep 1
#Checking if Jarsigner exists
which jarsigner > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Jarsigner (java)..................[ found ]"
which jarsigner >> "$log" 2>&1
echo "Jarsigner -> OK" >> "$inst"
rm -f "$config"
#Creating new config file
touch "$config"
echo "********************************************************************************************************" >> "$config"
echo "** Configuration Paths for TheFatRat , do not delete anything from this file or program will not work **" >> "$config"
echo "** if you need to reconfig your tools path , then run ./setup.sh in (TheFatRat directory) . **" >> "$config"
echo "********************************************************************************************************" >> "$config"
echo "jarsigner" | tee -a "$config" >> /dev/null 2>&1
else
echo -e $red "[ X ] Jarsigner (java) -> not found "
echo -e $yellow "[ ! ] Installing Java "
xterm -T "☣ INSTALL OPENJDK-8 ☣" -geometry 100x30 -e "sudo apt-get install openjdk-8-jdk openjdk-8-jre --force-yes -y "
which jarsigner > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Jarsigner -> OK"
which jarsigner >> "$log" 2>&1
echo "Jarsigner -> OK" >> "$inst"
rm -f "$config"
#Creating new config file
touch "$config"
echo "********************************************************************************************************" >> "$config"
echo "** Configuration Paths for TheFatRat , do not delete anything from this file or program will not work **" >> "$config"
echo "** if you need to reconfig your tools path , then run ./setup.sh in (TheFatRat directory) . **" >> "$config"
echo "********************************************************************************************************" >> "$config"
echo "jarsigner" | tee -a "$config" >> /dev/null 2>&1
else
echo -e $red "[ x ] Jarsigner"
echo "0" > "$stp"
echo "Jarsigner -> Not OK" >> "$inst"
fi
fi
sleep 1
#Checking if Unzip exists
which unzip > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Unzip.............................[ found ]"
which unzip >> "$log" 2>&1
echo "unzip" | tee -a "$config" >> /dev/null 2>&1
echo "Unzip -> OK" >> "$inst"
else
echo -e $red "[ X ] Unzip -> not found "
echo -e $yellow "[ ! ] Installing Unzip "
xterm -T "☣ INSTALL UNZIP ☣" -geometry 100x30 -e "sudo apt-get install unzip --force-yes -y "
which unzip >> "$log" 2>&1
if [ "$?" -eq "0" ]; then
echo "unzip" | tee -a "$config" >> /dev/null 2>&1
echo -e $green "[ ✔ ] Unzip -> OK"
echo "Unzip -> OK" >> "$inst"
else
echo -e $red "[ x ] Unzip"
echo "0" > "$stp"
echo "Unzip -> Not OK" >> "$inst"
fi
fi
sleep 1
#Checking if keytool exists
which keytool > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Keytool (java)....................[ found ]"
which keytool >> "$log" 2>&1
echo "keytool" | tee -a "$config" >> /dev/null 2>&1
echo "Keytool -> OK" >> "$inst"
else
echo -e $red "[ X ] Keytool (java) -> not found "
echo -e $yellow "[ ! ] Installing Java "
xterm -T "☣ INSTALL JAVA ☣" -geometry 100x30 -e "sudo apt-get install openjdk-8-jdk --force-yes -y "
which keytool >> "$log" 2>&1
if [ "$?" -eq "0" ]; then
echo "keytool" | tee -a "$config" >> /dev/null 2>&1
echo -e $green "[ ✔ ] Keytool -> OK"
echo "Keytool -> OK" >> "$inst"
else
echo -e $red "[ x ] Keytool"
echo "0" > "$stp"
echo "Keytool -> Not OK" >> "$inst"
fi
fi
sleep 1
#Adding zipalign path to config
echo -e $green "[ ✔ ] Zipalign "
echo "$path/tools/android-sdk/zipalign" >> "$log" 2>&1
echo "$path/tools/android-sdk/zipalign" | tee -a "$config" >> /dev/null 2>&1
sleep 1
#Adding Proguard path to config
echo -e $green "[ ✔ ] Proguard "
echo "$path/tools/proguard5.3.2/lib/proguard" >> "$log" 2>&1
echo "$path/tools/proguard5.3.2/lib/proguard" | tee -a "$config" >> /dev/null 2>&1
sleep 1
# check if mingw32 or mingw-64 exists
# Case not exists then reedirect to mingw instalation depending on arch
which i686-w64-mingw32-gcc > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Mingw-w64 Compiler................[ found ]"
which i686-w64-mingw32-gcc >> "$log" 2>&1
echo "Mingw64 -> OK" >> "$inst"
else
which i586-mingw32msvc-gcc > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Mingw32 Compiler..................[ found ]"
which i586-mingw32msvc-gcc >> "$log" 2>&1
echo "Mingw32 -> OK" >> "$inst"
else
mingwi
fi
fi
#Checking for DX and in case exists then check if it is version 1.8 used in fatrat (latest android sdk)
which dx > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
dxg=`dx --version 2>&1 | tee temp/dx`
dxv=`cat temp/dx | awk '{print $3}'`
case $dxv in
1.8)
#DX exists and it is version 1.8
rm -rf temp/dx >/dev/null 2>&1
which dx >> "$log" 2>&1
echo "dx" | tee -a "$config" >> /dev/null 2>&1
echo -e $green "[ ✔ ] DX 1.8"
echo "DX -> OK" >> "$inst"
;;
*)
#DX does not exists or is not 1.8 version
xterm -T "☣ Removing Your Current DX ☣" -geometry 100x30 -e "sudo apt-get remove --purge dx -y"
unlink "/usr/local/sbin/dx" > /dev/null 2>&1
ln -s "$path/tools/android-sdk/dx" "/usr/local/sbin/dx" > /dev/null 2>&1
which dx > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
which dx >> "$log" 2>&1
echo "dx" | tee -a "$config" >> /dev/null 2>&1
echo -e $green "[ ✔ ] DX 1.8"
echo "DX -> OK" >> "$inst"
else
echo -e $red "[ x ] DX 1.8"
echo "0" > "$stp"
echo "DX -> Not OK" >> "$inst"
fi
;;
esac
else
unlink "/usr/local/sbin/dx" > /dev/null 2>&1
ln -s "$path/tools/android-sdk/dx" "/usr/local/sbin/dx" > /dev/null 2>&1
which dx > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
which dx >> "$log" 2>&1
echo "dx" | tee -a "$config" >> /dev/null 2>&1
echo -e $green "[ ✔ ] DX 1.8"
echo "DX -> OK" >> "$inst"
else
echo -e $red "[ x ] DX 1.8"
echo "0" > "$stp"
echo "DX -> Not OK" >> "$inst"
fi
fi
# check if aapt exists and if it is version v0.2-3821160 used in fatrat (android sdk)
which aapt > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
aptv=`aapt v | awk '{print $5}'`
case $aptv in
v0.2-3821160)
#exists and it is v0.2-3821160
which aapt >> "$log" 2>&1
echo "aapt" | tee -a "$config" >> /dev/null 2>&1
echo -e $green "[ ✔ ] Aapt v0.2-3821160"
echo "Aapt -> OK" >> "$inst"
;;
*)
#Aapt does not exists or is not the latest version used in fatrat (android sdk)
xterm -T "☣ Removing Your Current Aapt ☣" -geometry 100x30 -e "sudo apt-get remove --purge aapt -y"
unlink "/usr/local/sbin/aapt" > /dev/null 2>&1
ln -s "$path/tools/android-sdk/aapt" "/usr/local/sbin/aapt" > /dev/null 2>&1
which aapt > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
which aapt >> "$log" 2>&1
echo "aapt" | tee -a "$config" >> /dev/null 2>&1
echo -e $green "[ ✔ ] Aapt v0.2-3821160"
echo "Aapt -> OK" >> "$inst"
else
echo -e $red "[ x ] Aapt v0.2-3821160"
echo "0" > "$stp"
echo "Aapt -> Not OK" >> "$inst"
fi
;;
esac
else
unlink "/usr/local/sbin/aapt" > /dev/null 2>&1
ln -s "$path/tools/android-sdk/aapt" "/usr/local/sbin/aapt" > /dev/null 2>&1
which aapt > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
which aapt >> "$log" 2>&1
echo "aapt" | tee -a "$config" >> /dev/null 2>&1
echo -e $green "[ ✔ ] Aapt v0.2-3821160"
echo "Aapt -> OK" >> "$inst"
else
echo -e $red "[ x ] Aapt v0.2-3821160"
echo "0" > "$stp"
echo "Aapt -> Not OK" >> "$inst"
fi
fi
#Same procedure used for dx and aapt , but for apktool 2.2.2.
which apktool > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
apk=`apktool | sed -n 1p | awk '{print $2}'` > /dev/null 2>&1
case $apk in
v.2.2.2)
which apktool >> "$log" 2>&1
echo "apktool" | tee -a "$config" >> /dev/null 2>&1
echo -e $green "[ ✔ ] Apktool v.2.2.2"
echo "Apktool -> OK" >> "$inst"
;;
*)
xterm -T "☣ REMOVE OLD APKTOOL ☣" -geometry 100x30 -e "sudo apt-get remove --purge apktool -y"
unlink "/usr/local/sbin/apktool" > /dev/null 2>&1
ln -s "$path/tools/apktool2.2.2/apktool" "/usr/local/sbin/apktool" > /dev/null 2>&1
which apktool > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Apktool v.2.2.2"
which apktool >> "$log" 2>&1
echo "apktool" | tee -a "$config" >> /dev/null 2>&1
echo "Apktool -> OK" >> "$inst"
else
echo -e $red "[ x ] Apktool v.2.2.2"
echo "0" > "$stp"
echo "Apktool -> Not OK" >> "$inst"
fi
;;
esac
else
unlink "/usr/local/sbin/apktool" > /dev/null 2>&1
ln -s "$path/tools/apktool2.2.2/apktool" "/usr/local/sbin/apktool" > /dev/null 2>&1
which apktool > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
which apktool >> "$log" 2>&1
echo "apktool" | tee -a "$config" >> /dev/null 2>&1
echo -e $green "[ ✔ ] Apktool v.2.2.2"
echo "Apktool -> OK" >> "$inst"
else
echo -e $red "[ x ] Apktool v.2.2.2"
echo "0" > "$stp"
echo "Apktool -> Not OK" >> "$inst"
fi
fi
#Same as others before , but dex2jar in this case will be installed directly to user OS , instead be working in fatrat tools
which d2j-dex2jar > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
dex=`d2j-dex2jar 2>&1 | tee temp/dex`
d2j=`cat temp/dex | sed -n 19p | awk '{print $2}' | cut -f1 -d','`
case $d2j in
reader-2.0)
rm -rf temp/dex >/dev/null 2>&1
which d2j-dex2jar >> "$log" 2>&1
echo "d2j-dex2jar" | tee -a "$config" >> /dev/null 2>&1
echo -e $green "[ ✔ ] Dex2Jar 2.0"
echo "Dex2Jar -> OK" >> "$inst"
;;
*)
rm -rf temp/dex >/dev/null 2>&1
#Dex2jar does not exists or it is not the 2.0 version , so uninstall it & copy dex2jar from
#fatrat tools folder to /usr/local/sbin
xterm -T "☣ Removing Your Current Dex2Jar ☣" -geometry 100x30 -e "sudo apt-get remove --purge dex2jar --force-yes -y"
cp $path/tools/dex2jar/* /usr/local/sbin/ > /dev/null 2>&1
chmod +x /usr/local/sbin/d2j-baksmali > /dev/null 2>&1
chmod +x /usr/local/sbin/d2j-dex-recompute-checksum > /dev/null 2>&1
chmod +x /usr/local/sbin/d2j-dex2jar > /dev/null 2>&1
chmod +x /usr/local/sbin/d2j-dex2smali > /dev/null 2>&1
chmod +x /usr/local/sbin/d2j-jar2dex > /dev/null 2>&1
chmod +x /usr/local/sbin/d2j-jar2jasmin > /dev/null 2>&1
chmod +x /usr/local/sbin/d2j-jasmin2jar > /dev/null 2>&1
chmod +x /usr/local/sbin/d2j-smali > /dev/null 2>&1
chmod +x /usr/local/sbin/d2j-std-apk > /dev/null 2>&1
# remove any previous version files from dex2jar lib from /usr/local/share
# and copy the new ones to there from fatrat tools dir
rm -rf /usr/local/share/dex2jar > /dev/null 2>&1
mkdir /usr/local/share/dex2jar > /dev/null 2>&1
cp -r $path/tools/dex2jar/lib /usr/local/share/dex2jar/lib > /dev/null 2>&1
which d2j-dex2jar > /dev/null 2>&1
#After new instalation , check if dex2jar is working
if [ "$?" -eq "0" ]; then
#Dex2jar was suceffully installed
echo -e $green "[ ✔ ] Dex2Jar 2.0"
which d2j-dex2jar >> "$log" 2>&1
echo "d2j-dex2jar" | tee -a "$config" >> /dev/null 2>&1
echo "Dex2Jar -> OK" >> "$inst"
else
#After the instalation something did not worked , place the warnings in logs
echo -e $red "[ x ] Dex2Jar 2.0"
echo "0" > "$stp"
echo "Dex2Jar -> Not OK" >> "$inst"
fi
;;
esac
else
#dex2jar does not exist in user linux OS , proceed with a clean manual installation
cp $path/tools/dex2jar/* /usr/local/sbin/ > /dev/null 2>&1
chmod +x /usr/local/sbin/d2j-baksmali > /dev/null 2>&1
chmod +x /usr/local/sbin/d2j-dex-recompute-checksum > /dev/null 2>&1
chmod +x /usr/local/sbin/d2j-dex2jar > /dev/null 2>&1
chmod +x /usr/local/sbin/d2j-dex2smali > /dev/null 2>&1
chmod +x /usr/local/sbin/d2j-jar2dex > /dev/null 2>&1
chmod +x /usr/local/sbin/d2j-jar2jasmin > /dev/null 2>&1
chmod +x /usr/local/sbin/d2j-jasmin2jar > /dev/null 2>&1
chmod +x /usr/local/sbin/d2j-smali > /dev/null 2>&1
chmod +x /usr/local/sbin/d2j-std-apk > /dev/null 2>&1
rm -rf /usr/local/share/dex2jar > /dev/null 2>&1
mkdir /usr/local/share/dex2jar > /dev/null 2>&1
cp -r $path/tools/dex2jar/lib /usr/local/share/dex2jar/lib > /dev/null 2>&1
which d2j-dex2jar > /dev/null 2>&1
if [ "$?" -eq "0" ]; then
echo -e $green "[ ✔ ] Dex2Jar 2.0"
which d2j-dex2jar >> "$log" 2>&1
echo "d2j-dex2jar" | tee -a "$config" >> /dev/null 2>&1
echo "Dex2Jar -> OK" >> "$inst"
else
echo -e $red "[ x ] Dex2Jar 2.0"
echo "0" > "$stp"
echo "Dex2Jar -> Not OK" >> "$inst"
fi
fi
mtspl
################################
# rebackyo repo
################################
echo -e $blue "Reactivating you original repositories"
rm -f /etc/apt/sources.list
mv /etc/apt/sources.list.backup /etc/apt/sources.list
#now we can remove the emergency backup securely
rm -f /etc/apt/sources.list.fatrat
apt-get clean
xterm -T "☣ UPDATE YOUR REPO ☣" -geometry 100x30 -e "sudo apt-get update "
clear
echo -e $okegreen "Do you want to create a shortcut for fatrat in your system"
echo -e $okegreen "so you can run fatrat from anywhere in your terminal and desktop ?"
echo ""
echo -ne $cyan "Choose y/n : "
read cho
case $cho in
y|Y|Yes|yes|YES)
lnk=$?
if [ $lnk == "0" ];then
dir=`pwd`
scrp="cd $dir && ./fatrat"
rm -f /usr/local/sbin/fatrat
touch /usr/local/sbin/fatrat
echo "#!/bin/bash" > /usr/local/sbin/fatrat
echo $scrp >> /usr/local/sbin/fatrat
cp $path/config/TheFatRat.desktop /usr/share/applications/TheFatRat.desktop
cp $path/icons/fatrat.ico /usr/share/icons/fatrat.ico
chmod +x /usr/local/sbin/fatrat
chmod +x fatrat
chmod +x update
chmod +x backdoor_apk
chmod +x $path/tools/power.py
chmod +x $path/tools/android-sdk/zipalign
chmod +x $path/tools/proguard5.3.2/lib/proguard
chmod +x $path/tools/android-sdk/dx
chmod +x $path/tools/android-sdk/aapt
chmod +x $path/tools/apktool2.2.2/apktool
which fatrat >> "$log" 2>&1
clear
echo ""
echo -e $green "Instalation completed , To execute fatrat write anywhere in your terminal (fatrat)"
fi
;;
n|no|No|NO)
chmod +x fatrat
chmod +x update
chmod +x backdoor_apk
chmod +x $path/tools/power.py
chmod +x $path/tools/android-sdk/zipalign
chmod +x $path/tools/proguard5.3.2/lib/proguard
chmod +x $path/tools/android-sdk/dx
chmod +x $path/tools/android-sdk/aapt
chmod +x $path/tools/apktool2.2.2/apktool
clear
echo ""
echo -e $green "Instalation completed , To execute fatrat write in fatrat directory (./fatrat)"
;;
*)
chmod +x fatrat
chmod +x update
chmod +x backdoor_apk
chmod +x $path/tools/power.py
chmod +x $path/tools/android-sdk/zipalign