Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
screetsec
GitHub Repository: screetsec/TheFatRat
Path: blob/master/setup.sh
495 views
1
#!/bin/bash
2
#Instalation of searchsploit (exploitdb)
3
function optmingw () {
4
case $sel in
5
y|Y|yes|YES|Yes)
6
echo -n "Removing mingw as requested..."
7
xterm -T "☣ REMOVING MINGW ☣" -geometry 100x30 -e "apt remove --purge *mingw* -y && apt autoremove -y"
8
which x86_64-w64-mingw32-gcc >> /dev/null 2>&1
9
if [ "$?" != "0" ]; then
10
echo "Done"
11
else
12
echo "Error"
13
echo ""
14
echo "Setup was unable to remove mingw Installation"
15
fi
16
;;
17
n|N|No|NO)
18
echo "Setup will not remove current mingw installation"
19
echo "However you will encounter issues running Fudwin"
20
echo -n "in fatrat menu , press ENTER to resume setup"
21
read -rsp var
22
;;
23
esac
24
}
25
rchk () {
26
apt-get update &> /tmp/aptkey.log
27
awk '{print $1}' RS='NO_PUBKEY' /tmp/aptkey.log | sed '1d' > /tmp/expkeys.log
28
awk '{print $1}' RS='EXPKEYSIG' /tmp/aptkey.log | sed '1d' >> /tmp/expkeys.log
29
sort /tmp/expkeys.log | uniq > /tmp/expkeystmp.log
30
rm /tmp/expkeys.log && mv /tmp/expkeystmp.log /tmp/expkeys.log
31
cntk=$(wc -l /tmp/expkeys.log | awk '{print$1}' | sed 's/ //g')
32
if [[ "$cntk" == "0" ]]
33
then
34
echo "[ Done ]"
35
else
36
echo "[ Error ]"
37
echo "Unable to process key for $dist"
38
echo ""
39
fi
40
}
41
42
function repokey () {
43
echo -ne "$green" "[ ? ] Update Jessie/Kali Repo Public Key"
44
apt-get update &> /tmp/aptkey.log
45
awk '{print $1}' RS='NO_PUBKEY' /tmp/aptkey.log | sed '1d' > /tmp/expkeys.log
46
awk '{print $1}' RS='EXPKEYSIG' /tmp/aptkey.log | sed '1d' >> /tmp/expkeys.log
47
cat /tmp/expkeys.log | sort | uniq > /tmp/expkeystmp.log
48
rm /tmp/expkeys.log && mv /tmp/expkeystmp.log /tmp/expkeys.log
49
cntk=$(wc -l /tmp/expkeys.log | awk '{print$1}' | sed 's/ //g')
50
if [[ "$cntk" == "0" ]]
51
then
52
echo "[ Done ]"
53
fi
54
for i in $(seq $cntk)
55
do
56
gtkey=$(sed -n ${i}p /tmp/expkeys.log)
57
xterm -T "☣ CHECK PUBKEY ☣" -geometry 100x30 -e "apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $gtkey &> /tmp/gtkey.log"
58
kout=$(grep -w "Total number processed:" /tmp/gtkey.log | awk -F'Total number processed:' '{print $2}' | sed 's/ //g')
59
dist=$(grep -o '".*"' /tmp/gtkey.log | sed 's/"//g')
60
if [[ "$kout" == "1" ]]
61
then
62
echo "[ Done ]"
63
echo "Succefull Key processed for $dist"
64
else
65
rchk
66
fi
67
done
68
69
}
70
function mingwchk () {
71
echo -ne "$green" "[ ? ] Checking Mingw Version............"
72
which x86_64-w64-mingw32-gcc >> /dev/null 2>&1
73
if [ "$?" -eq "0" ]; then
74
chkvs=$(x86_64-w64-mingw32-gcc --version | sed -n 1p | awk '{print$3}')
75
case $chkvs in
76
4.9.1)
77
echo "[✔]"
78
;;
79
6.3.0)
80
echo "[✔]"
81
;;
82
*)
83
echo "Error"
84
echo ""
85
echo "TheFatRat detected an incorrent version of mingw installed"
86
echo "Do you wish to remove it and install the approriate one ?"
87
echo -n "Choose (yes/no) : "
88
read -r sel
89
optmingw
90
;;
91
esac
92
else
93
echo "Not Installed"
94
fi
95
}
96
97
function ssplt() {
98
99
# check if searchsploit exists
100
which searchsploit > /dev/null 2>&1
101
if [ "$?" -eq "0" ]; then
102
echo -e "$green" "[ ✔ ] Searchsploit......................[ found ]"
103
echo "searchsploit" | tee -a "$config" "$log" > /dev/null 2>&1
104
echo "Searchsploit -> OK" >> "$inst"
105
sleep 1
106
else
107
echo -e "$red" "[ X ] searchsploit -> not found"
108
echo ""
109
echo -e "$green" "Select one of the options bellow"
110
echo -e "$orange" "+-------------------------------------------------+"
111
echo -e "$orange" "|$white [$green 1$white ]$yellow Setup Searchsploit Path Manually$orange |"
112
echo -e "$orange" "|$white [$green 2$white ]$yellow Install Searchsploit from Kali Repository$orange |"
113
echo -e "$orange" "+-------------------------------------------------+"
114
echo ""
115
echo -ne "$green" "Option : ";tput sgr0
116
read -r q1
117
case $q1 in
118
119
1)
120
echo ""
121
echo -e "$green" "Enter The Path of your Searchsploit instalation"
122
echo -e "$cyan" "ex : /opt/searchsploit/searchsploit"
123
echo ""
124
echo -ne "$green" "PATH : ";tput sgr0
125
read sspp
126
if [ ! -f "$sspp" ]
127
then
128
echo ""
129
echo -e "$red" "It was not possible to found searchsploit executable in : $sspp"
130
echo ""
131
echo -e "$green" "Make sure you write the right path of your instalation"
132
echo ""
133
echo -e "$green" "Press [ENTER] key to try again ."
134
read -r cont
135
ssplt
136
else
137
echo bash "$sspp" | tee -a "$config" "$log" > /dev/null 2>&1
138
echo "Searchsploit -> OK" >> "$inst"
139
fi
140
;;
141
142
#ok
143
2)
144
echo -e "$yellow" "[ ! ] Installing Searchsploit "
145
xterm -T "☣ INSTALL SEARCHSPLOIT ☣" -geometry 100x30 -e "sudo apt-get install exploitdb -y"
146
which searchsploit > /dev/null 2>&1
147
if [ "$?" -eq "0" ]; then
148
echo -e "$green" "[ ✔ ] Searchsploit"
149
echo "searchsploit" | tee -a "$config" "$log" > /dev/null 2>&1
150
echo "Searchsploit -> OK" >> "$inst"
151
else
152
echo "0" > "$stp"
153
echo "Searchsploit -> Not OK" >> "$inst"
154
fi
155
;;
156
*)
157
ssplt
158
;;
159
esac
160
fi
161
echo ""
162
#Go check the check file exists and read its value
163
chk="$path/logs/check"
164
if [ -f "$chk" ]
165
then
166
ct=`sed -n 1p "$chk"`
167
#if value of check is 0 theen some package was not installed sucefully
168
if [ "$ct" == "0" ]; then
169
clear
170
echo -e "$red" "Fatrat was not able to install some packages"
171
echo ""
172
echo -e "$blue" "Reactivating your original repositories"
173
rm -f /etc/apt/sources.list
174
mv /etc/apt/sources.list.backup /etc/apt/sources.list
175
#now we can remove the emergency backup securely
176
rm -f /etc/apt/sources.list.fatrat
177
apt-get clean
178
xterm -T "☣ UPDATE YOUR REPO ☣" -geometry 100x30 -e "sudo apt-get update "
179
clear
180
rm -rf "$config" >/dev/null 2>&1
181
182
#Display to user the install.log file and inform him what to do
183
echo "Was not possible to install The Packages Labeled (Not Ok) in this list above" >> "$inst"
184
echo "Try : (apt-get remove --purge <packagename> && apt-get autoremove && apt-get install -f)" >> "$inst"
185
echo "before running fatrat setup script again" >> "$inst"
186
cat "$inst"
187
exit
188
elif [ "$ct" == "1" ]; then
189
echo ""
190
#value in check file is 1 , then everything is ok , delete install.log file and proceed to finish setup
191
rm -rf "$inst" >/dev/null 2>&1
192
fi
193
else
194
#in case value in check file is not 0 or 1 then something is wrong
195
echo -e "$green" "Something went very wrong , execute ./setup.sh again"
196
rm -rf "$config" >/dev/null 2>&1
197
echo ""
198
echo "Was not possible to install The Packages Labeled (Not Ok) in this list above" >> "$inst"
199
echo "Try : (apt-get remove --purge <packagename> && apt-get autoremove && apt-get install -f)" >> "$inst"
200
echo "before running fatrat setup script again" >> "$inst"
201
echo "" >> "$inst"
202
echo "***********Your current sources.list***************"
203
sclst=`cat /etc/apt/sources.list`
204
echo "$sclst" >> "$inst"
205
echo "***************Finish sources.list*****************" >> "$inst"
206
dist=`uname -a`
207
echo "" >> "$inst"
208
echo "Your linux distribution :" >> "$inst"
209
echo "$dist" >> "$inst"
210
cat "$inst"
211
echo -e "$lightgreen" "This log file can be found in : $inst "
212
exit
213
fi
214
}
215
216
function bkf() {
217
# Check if backdoor-factory exists
218
219
which backdoor-factory > /dev/null 2>&1
220
if [ "$?" -eq "0" ]; then
221
echo -e "$green" "[ ✔ ] Backdoor-Factory..................[ found ]"
222
echo "backdoor-factory" | tee -a "$config" "$log" > /dev/null 2>&1
223
echo "Backdoor-Factory -> OK" >> "$inst"
224
sleep 1
225
ssplt
226
else
227
echo -e "$red" "[ X ] backdoor-factory -> not found "
228
echo ""
229
230
echo ""
231
echo -e "$green" "Select one of the options bellow"
232
echo -e "$orange" "+-----------------------------------------------------+"
233
echo -e "$orange" "|$white [$okegreen 1$white ]$yellow Setup Backdoor-Factory Path Manually$orange |"
234
echo -e "$orange" "|$white [$okegreen 2$white ]$yellow Install Backdoor-Factory from Kali Repository$orange |"
235
echo -e "$orange" "+-----------------------------------------------------+"
236
echo ""
237
echo -ne "$green" "Option : ";tput sgr0
238
read -r q2
239
case "$q2" in
240
241
1)
242
echo ""
243
echo -e "$green" "Enter The Path of your backdoor-factory instalation"
244
echo -e "$cyan" "ex : /opt/backdoor-factory/backdoor.py"
245
echo ""
246
echo -ne "$green" "PATH : ";tput sgr0
247
read -r msp
248
bkdf="$msp"
249
if [ ! -f "$bkdf" ]
250
then
251
echo ""
252
echo -e "$red" "It was not possible to found backdoor-factory executable in : $bkdf"
253
echo ""
254
echo -e "$green" "Make sure you write the right path of your instalation"
255
echo ""
256
echo -e "$green" "Press [ENTER] key to try again ."
257
read -r cont
258
bkf
259
fi
260
echo "python3 $bkdf" | tee -a "$config" "$log" > /dev/null 2>&1
261
echo "Backdoor-factory -> OK" >> "$inst"
262
ssplt
263
;;
264
265
2)
266
echo -e "$yellow" "[ ! ] Installing backdoor-factory "
267
xterm -T "☣ INSTALL BACKDOOR-FACTORY ☣" -geometry 100x30 -e "sudo apt-get install backdoor-factory -y"
268
which backdoor-factory > /dev/null 2>&1
269
if [ "$?" -eq "0" ]; then
270
echo -e "$green" "[ ✔ ] Backdoor-Factory -> OK"
271
echo "backdoor-factory" | tee -a "$config" "$log" > /dev/null 2>&1
272
echo "Backdoor-factory -> OK" >> "$inst"
273
ssplt
274
else
275
echo -e "$red" "[ X ] backdoor-factory"
276
echo "0" > "$stp"
277
echo "Backdoor-factory -> Not OK" >> "$inst"
278
ssplt
279
fi
280
;;
281
282
*)
283
bkf
284
;;
285
esac
286
fi
287
}
288
289
function crtdir() {
290
echo ""
291
echo -e "$green""Write output directory for fatrat generated files or press enter to default."
292
echo -e "$orange""Default :$yellow $HOME/Fatrat_Generated"
293
echo ""
294
echo -ne "$orange""Write: $green"
295
read -r pth
296
if [[ -z "$pth" ]]
297
then
298
echo "$HOME/Fatrat_Generated" | tee -a "$config" "$log" > /dev/null 2>&1
299
mkdir $HOME/Fatrat_Generated > /dev/null 2>&1
300
else
301
mkdir -p "$pth" > /dev/null 2>&1
302
if [[ ! -d "$pth" ]]
303
then
304
echo ""
305
echo -e "$red""There was an error creating $pth , default directory will be assigned"
306
echo -ne "$green""Press ENTER to continue"
307
echo "$HOME/Fatrat_Generated" | tee -a "$config" "$log" > /dev/null 2>&1
308
mkdir $HOME/Fatrat_Generated > /dev/null 2>&1
309
else
310
echo "$pth" | tee -a "$config" "$log" > /dev/null 2>&1
311
echo ""
312
echo -e "$orange""All fatrat generated files will be stored in :"
313
echo -e "$green""$pth"
314
echo ""
315
echo -ne "$green""Press ENTER to continue"
316
read rsp
317
clear
318
fi
319
fi
320
}
321
322
323
function mtspl() {
324
# check if metasploit-framework its installed
325
which msfconsole > /dev/null 2>&1
326
if [ "$?" -eq "0" ]; then
327
echo -e "$green" "[ ✔ ] Metasploit-Framework..............[ found ]"
328
echo "msfconsole" | tee -a "$config" "$log" >> /dev/null 2>&1
329
echo "msfvenom" | tee -a "$config" "$log" >> /dev/null 2>&1
330
echo "Metasploit -> OK" >> "$inst"
331
sleep 1
332
bkf
333
else
334
echo -e "$red" "[ X ] metasploit-framework -> not found "
335
336
# Providing manual input to user in case metasploit was installed from git and is not on system path
337
338
echo ""
339
echo -e "$green" "Select one of the options bellow"
340
echo -e "$orange" "+---------------------------------------------------------+"
341
echo -e "$orange" "|$white [$okegreen 1$white ]$yellow Setup Metasploit Framework Path Manually$orange |"
342
echo -e "$orange" "|$white [$okegreen 2$white ]$yellow Install Metasploit Framework from Kali Repository$orange |"
343
echo -e "$orange" "+---------------------------------------------------------+"
344
echo ""
345
echo -ne "$green" "Option : ";tput sgr0
346
read -r q3
347
case "$q3" in
348
1)
349
echo ""
350
echo -e "$green" "Enter The Path of your metasploit instalation"
351
echo -e "$cyan" "ex : /opt/metasploit-framework"
352
echo ""
353
echo -ne "$green" "PATH : ";tput sgr0
354
read -r msp
355
msfc="$msp/msfconsole"
356
msfv="$msp/msfvenom"
357
if [ ! -f "$msfc" ]
358
then
359
echo ""
360
echo -e "$red" "It was not possible to found msfconsole in : $msfc"
361
echo ""
362
echo -e "$green" "Make sure you write the right path of your instalation"
363
echo ""
364
echo -e "$green" "Press [ENTER] key to try again ."
365
read -r cont
366
mtspl
367
fi
368
if [ ! -f "$msfv" ]
369
then
370
echo ""
371
echo -e "$red" "It was not possible to found msfvenom in : $msfv"
372
echo ""
373
echo -e "$green" "Make sure you write the right path of your instalation"
374
echo ""
375
echo -e "$green" "Press [ENTER] key to try again ."
376
read -r cont
377
mtspl
378
fi
379
#Creation of symlinks to metasploit manual path in /usr/local/sbin to avoid changes in fatrat scripts
380
381
unlink /usr/local/sbin/msfconsole > /dev/null 2>&1
382
unlink /usr/local/sbin/msfvenom > /dev/null 2>&1
383
ln -s "$msfc" /usr/local/sbin/msfconsole > /dev/null 2>&1
384
ln -s "$msfv" /usr/local/sbin/msfvenom > /dev/null 2>&1
385
echo "msfconsole" | tee -a "$config" "$log" > /dev/null 2>&1
386
echo "msfvenom" | tee -a "$config" "$log" > /dev/null 2>&1
387
echo "Metasploit -> OK" >> "$inst"
388
bkf
389
;;
390
391
2)
392
echo -e "$yellow" "[ ! ] Installing Metasploit-Framework "
393
xterm -T "☣ INSTALL METASPLOIT-FRAMEWORK ☣" -geometry 100x30 -e "sudo apt-get install metasploit-framework -y"
394
which msfconsole > /dev/null 2>&1
395
if [ "$?" -eq "0" ]; then
396
echo -e "$green" "[ ✔ ] Metasploit - msfconsole -> OK"
397
echo "msfconsole" | tee -a "$config" "$log" > /dev/null 2>&1
398
echo "Metasploit - msfconsole -> OK" >> "$inst"
399
else
400
echo -e "$red" "[ x ] Metasploit - msfconsole"
401
echo "Metasploit - msfconsole -> Not OK" >> "$inst"
402
echo "0" > "$stp"
403
fi
404
which msfvenom > /dev/null 2>&1
405
if [ "$?" -eq "0" ]; then
406
echo -e "$green" "[ ✔ ] Metasploit \(msfvenom\) -> OK"
407
echo "msfvenom" | tee -a "$config" "$log" > /dev/null 2>&1
408
echo "Metasploit - msfvenom -> OK" >> "$inst"
409
else
410
echo -e "$red" "[ x ] Metasploit - msfvenom"
411
echo "0" > "$stp"
412
echo "Metasploit - msfvenom -> Not OK" >> "$inst"
413
fi
414
bkf
415
;;
416
*)
417
mtspl
418
;;
419
esac
420
fi
421
}
422
423
424
function cont() {
425
426
stp="logs/check"
427
#remove any previous check file from previous attempts
428
rm -rf "$stp" >/dev/null 2>&1
429
#starting setup , input 1 value to check file
430
echo "1" > "$stp"
431
#remove any previous install.log file from previous attempts
432
rm -rf "$inst" >/dev/null 2>&1
433
434
#check if xterm is installed
435
which xterm > /dev/null 2>&1
436
if [ "$?" -eq "0" ]; then
437
echo -e "$green" "[ ✔ ] Xterm.............................[ found ]"
438
which xterm >> "$log" 2>&1
439
echo "xterm -> OK" > "$inst"
440
else
441
echo ""
442
echo -e "$red" "[ X ] Xterm -> not found! "
443
echo -e "$yellow" "[ ! ] Installing Xterm "
444
echo -e "$green" ""
445
sudo apt-get install xterm -y
446
which xterm >> "$log" 2>&1
447
if [ "$?" -eq "0" ]; then
448
echo -e "$green" "[ ✔ ] Xterm -> OK"
449
echo "Xterm -> OK" > "$inst"
450
else
451
echo -e "$red" "[ x ] Xterm"
452
echo "0" > "$stp"
453
echo "xterm -> Not OK" > "$inst"
454
fi
455
fi
456
mingwchk
457
sleep 1
458
#check if dig its installed
459
which dig > /dev/null 2>&1
460
if [ "$?" -eq "0" ]; then
461
echo -e "$green" "[ ✔ ] Dns-Utils ........................[ found ]"
462
which dig >> "$log" 2>&1
463
echo "Dns-Utils -> OK" >> "$inst"
464
else
465
echo -e "$red" "[ X ] dnsutils -> not found! "
466
echo -e "$yellow" "[ ! ] Installing dnsutils"
467
xterm -T "☣ INSTALL DNSUTILS ☣" -geometry 100x30 -e "sudo apt-get install dnsutils -y"
468
which dig >> "$log" 2>&1
469
if [ "$?" -eq "0" ]; then
470
echo -e "$green" "[ ✔ ] Dns-Utils -> OK"
471
echo "Dns-Utils -> OK" >> "$inst"
472
else
473
echo -e "$red" "[ x ] Dns-Utils"
474
echo "0" > "$stp"
475
echo "dns-utils -> Not OK" >> "$inst"
476
fi
477
fi
478
sleep 1
479
480
#check if mono mcs its installed
481
# Mono mcs and devel required to compile program.cs in pwnwinds
482
which mcs > /dev/null 2>&1
483
if [ "$?" -eq "0" ]; then
484
echo -e "$green" "[ ✔ ] Mono-Denvelop Utils ..............[ found ]"
485
which mcs >> "$log" 2>&1
486
echo "Mono-Denvelop Utils -> OK" >> "$inst"
487
else
488
echo -e "$red" "[ X ] Mono-Denvelop Utils -> not found! "
489
echo -e "$yellow" "[ ! ] Installing Mono-Denvelop Utils"
490
xterm -T "☣ INSTALL MONODENVELOP-UTILS ☣" -geometry 100x30 -e "sudo apt-get install mono-mcs mono-devel -y"
491
which mcs >> "$log" 2>&1
492
if [ "$?" -eq "0" ]; then
493
echo -e "$green" "[ ✔ ] Mono-Denvelop Utils -> OK"
494
echo "Mono-Denvelop Utils -> OK" >> "$inst"
495
else
496
echo -e "$red" "[ x ] Mono-Denvelop Utils"
497
echo "0" > "$stp"
498
echo "Mono-Denvelop Utils -> Not OK" >> "$inst"
499
fi
500
fi
501
sleep 1
502
503
# check if gcc exists
504
which gcc > /dev/null 2>&1
505
if [ "$?" -eq "0" ]; then
506
echo -e "$green" "[ ✔ ] Gcc compiler......................[ found ]"
507
which gcc >> "$log" 2>&1
508
echo "GCC -> OK" >> "$inst"
509
else
510
echo -e "$red" "[ X ] gcc compiler -> not found "
511
echo -e "$yellow" "[ ! ] Installing gcc "
512
xterm -T "☣ INSTALL GCC COMPILLER ☣" -geometry 100x30 -e "sudo apt-get install gcc -y"
513
which gcc >> "$log" 2>&1
514
if [ "$?" -eq "0" ]; then
515
echo -e "$green" "[ ✔ ] GCC -> OK"
516
echo "GCC -> OK" >> "$inst"
517
else
518
echo -e "$red" "[ x ] GCC"
519
echo "0" > "$stp"
520
echo "gcc -> Not OK" >> "$inst"
521
fi
522
fi
523
sleep 1
524
#check if apache2 exists
525
which apache2 > /dev/null 2>&1
526
if [ "$?" -eq "0" ]; then
527
echo -e "$green" "[ ✔ ] Apache2 ..........................[ found ]"
528
which apache2 >> "$log" 2>&1
529
echo "Apache2 -> OK" >> "$inst"
530
else
531
echo -e "$red" "[ X ] Apache2 -> not found "
532
echo -e "$yellow" "[ ! ] Installing apache2 "
533
xterm -T "☣ INSTALL APACHE2 ☣" -geometry 100x30 -e "sudo apt-get install apache2 -y"
534
which apache2 >> "$log" 2>&1
535
if [ "$?" -eq "0" ]; then
536
echo -e "$green" "[ ✔ ] Apache2 -> OK"
537
echo "Apache2 -> OK" >> "$inst"
538
else
539
echo -e "$red" "[ x ] Apache2"
540
echo "0" > "$stp"
541
echo "apache2 -> Not OK" >> "$inst"
542
fi
543
fi
544
sleep 1
545
#check if gnome terminal exists
546
#added this new install option because user may be running a distro that may not have gnome terminal installed by default
547
#gnome terminal is used in main script to run searchsploit
548
which gnome-terminal > /dev/null 2>&1
549
if [ "$?" -eq "0" ]; then
550
echo -e "$green" "[ ✔ ] Gnome Terminal....................[ found ]"
551
which gnome-terminal >> "$log" 2>&1
552
echo "Gnome Terminal -> OK" >> "$inst"
553
else
554
echo -e "$red" "[ X ] Gnome-terminal-> not found "
555
echo -e "$yellow" "[ ! ] Installing gnome-terminal "
556
xterm -T "☣ INSTALL GNOME-TERMINAL ☣" -geometry 100x30 -e "sudo apt-get install gnome-terminal -y"
557
which gnome-terminal >> "$log" 2>&1
558
if [ "$?" -eq "0" ]; then
559
echo -e "$green" "[ ✔ ] Gnome Terminal -> OK"
560
echo "Gnome Terminal -> OK" >> "$inst"
561
else
562
echo -e "$red" "[ x ] Gnome Terminal"
563
echo "0" > "$stp"
564
echo "gnome-terminal -> Not OK" >> "$inst"
565
fi
566
fi
567
568
#Checking if upx compressor exists
569
sleep 1
570
which upx > /dev/null 2>&1
571
if [ "$?" -eq "0" ]; then
572
echo -e "$green" "[ ✔ ] UPX Compressor....................[ found ]"
573
which upx >> "$log" 2>&1
574
echo "UPX -> OK" >> "$inst"
575
else
576
echo -e "$red" "[ X ] Upx compressor -> not found "
577
echo -e "$yellow" "[ ! ] Installing upx-compressor "
578
xterm -T "☣ INSTALL UPX COMPRESSOR ☣" -geometry 100x30 -e "sudo apt-get install upx-ucl -y"
579
which upx >> "$log" 2>&1
580
if [ "$?" -eq "0" ]; then
581
echo -e "$green" "[ ✔ ] UPX Compressor -> OK"
582
echo "UPX -> OK" >> "$inst"
583
else
584
echo -e "$red" "[ x ] UPX Compressor"
585
echo "0" > "$stp"
586
echo "upx-ucl -> Not OK" >> "$inst"
587
fi
588
fi
589
sleep 1
590
#Checking if Ruby exists
591
which ruby > /dev/null 2>&1
592
if [ "$?" -eq "0" ]; then
593
echo -e "$green" "[ ✔ ] Ruby..............................[ found ]"
594
which ruby >> "$log" 2>&1
595
echo "Ruby -> OK" >> "$inst"
596
else
597
echo -e "$red" "[ X ] Ruby -> not found "
598
echo -e "$yellow" "[ ! ] Installing Ruby "
599
xterm -T "☣ INSTALL Ruby ☣" -geometry 100x30 -e "sudo apt-get install ruby -y && gem install nokogiri"
600
which ruby >> "$log" 2>&1
601
if [ "$?" -eq "0" ]; then
602
echo -e "$green" "[ ✔ ] Ruby -> OK"
603
echo "Ruby -> OK" >> "$inst"
604
else
605
echo -e "$red" "[ x ] Ruby"
606
echo "0" > "$stp"
607
echo "ruby -> Not OK" >> "$inst"
608
fi
609
fi
610
sleep 1
611
#Checking if python2 exists
612
which python2 > /dev/null 2>&1
613
if [ "$?" -eq "0" ]; then
614
echo -e "$green" "[ ✔ ] Python2...........................[ found ]"
615
which python2 >> "$log" 2>&1
616
echo "Python2 -> OK" >> "$inst"
617
else
618
echo -e "$red" "[ X ] Python2 -> not found "
619
echo -e "$yellow" "[ ! ] Installing Python2 "
620
xterm -T "☣ INSTALL Python2 ☣" -geometry 100x30 -e "sudo apt install python2-minimal -y"
621
which python2 >> "$log" 2>&1
622
if [ "$?" -eq "0" ]; then
623
echo -e "$green" "[ ✔ ] Python2 -> OK"
624
echo "Python2 -> OK" >> "$inst"
625
else
626
echo -e "$red" "[ x ] Python2"
627
echo "0" > "$stp"
628
echo "Python2 -> Not OK" >> "$inst"
629
fi
630
fi
631
632
sleep 1
633
#Checking if python3 exists
634
which python3 > /dev/null 2>&1
635
if [ "$?" -eq "0" ]; then
636
echo -e "$green" "[ ✔ ] Python3...........................[ found ]"
637
which python3 >> "$log" 2>&1
638
echo "Python3 -> OK" >> "$inst"
639
else
640
echo -e "$red" "[ X ] Python3 -> not found "
641
echo -e "$yellow" "[ ! ] Installing Python3 "
642
xterm -T "☣ INSTALL Python3 ☣" -geometry 100x30 -e "sudo apt-get install python3 -y"
643
which python3 >> "$log" 2>&1
644
if [ "$?" -eq "0" ]; then
645
echo -e "$green" "[ ✔ ] Python3 -> OK"
646
echo "Python3 -> OK" >> "$inst"
647
else
648
echo -e "$red" "[ x ] Python3"
649
echo "0" > "$stp"
650
echo "Python3 -> Not OK" >> "$inst"
651
fi
652
fi
653
sleep 1
654
#Checking if python3-pip exists
655
which pip3 > /dev/null 2>&1
656
if [ "$?" -eq "0" ]; then
657
echo -e "$green" "[ ✔ ] Python3-Pip.......................[ found ]"
658
xterm -T "☣ INSTALL Python3 module names ☣" -geometry 100x30 -e "sudo pip3 install names -y"
659
which pip3 >> "$log" 2>&1
660
echo "Python3-pip -> OK" >> "$inst"
661
else
662
echo -e "$red" "[ X ] Python3-pip -> not found "
663
echo -e "$yellow" "[ ! ] Installing Python3-pip "
664
xterm -T "☣ INSTALL Python3-pip ☣" -geometry 100x30 -e "sudo apt-get install python3-pip -y && pip3 install names"
665
which pip3 >> "$log" 2>&1
666
if [ "$?" -eq "0" ]; then
667
echo -e "$green" "[ ✔ ] Python3-Pip -> OK"
668
echo "Python3-Pip -> OK" >> "$inst"
669
else
670
echo -e "$red" "[ x ] Python3-Pip"
671
echo "0" > "$stp"
672
echo "Python3-Pip -> Not OK" >> "$inst"
673
fi
674
fi
675
sleep 1
676
#Checking if Openssl exists
677
which openssl > /dev/null 2>&1
678
if [ "$?" -eq "0" ]; then
679
echo -e "$green" "[ ✔ ] Openssl...........................[ found ]"
680
which openssl >> "$log" 2>&1
681
echo "Openssl -> OK" >> "$inst"
682
else
683
echo -e "$red" "[ X ] Openssl -> not found "
684
echo -e "$yellow" "[ ! ] Installing Openssl "
685
xterm -T "☣ INSTALL OPENSSL ☣" -geometry 100x30 -e "sudo apt-get install openssl -y"
686
which openssl >> "$log" 2>&1
687
if [ "$?" -eq "0" ]; then
688
echo -e "$green" "[ ✔ ] Openssl -> OK"
689
echo "Openssl -> OK" >> "$inst"
690
else
691
echo -e "$red" "[ x ] Openssl"
692
echo "0" > "$stp"
693
echo "openssl -> Not OK" >> "$inst"
694
fi
695
fi
696
sleep 1
697
#installing dependencies for ruby script
698
echo -e "$green" "[ ! ] Installing tools dependencies"
699
xterm -T "☣ INSTALL DEPENDENCIES ☣" -geometry 100x30 -e "sudo apt-get install lib32z1 lib32ncurses5 lib32stdc++6 build-essential -y"
700
sleep 1
701
702
#Checking if Jarsigner exists
703
which jarsigner > /dev/null 2>&1
704
if [ "$?" -eq "0" ]; then
705
echo -e "$green" "[ ✔ ] Jarsigner from java...............[ found ]"
706
which jarsigner >> "$log" 2>&1
707
echo "Jarsigner -> OK" >> "$inst"
708
rm -f "$config"
709
#Creating new config file
710
touch "$config"
711
echo "********************************************************************************************************" >> "$config"
712
echo "** Configuration Paths for TheFatRat , do not delete anything from this file or program will not work **" >> "$config"
713
echo "** if you need to reconfig your tools path , then run ./setup.sh in (TheFatRat directory) . **" >> "$config"
714
echo "********************************************************************************************************" >> "$config"
715
echo "jarsigner" | tee -a "$config" >> /dev/null 2>&1
716
else
717
echo -e "$red" "[ X ] Jarsigner from java -> not found "
718
echo -e "$yellow" "[ ! ] Installing Java "
719
xterm -T "☣ INSTALL default-jdk ☣" -geometry 100x30 -e "sudo apt-get install default-jdk default-jre -y | tee -a $mingw"
720
which jarsigner > /dev/null 2>&1
721
if [ "$?" -eq "0" ]; then
722
echo -e "$green" "[ ✔ ] Jarsigner -> OK"
723
which jarsigner >> "$log" 2>&1
724
echo "Jarsigner -> OK" >> "$inst"
725
rm -f "$config"
726
#Creating new config file
727
touch "$config"
728
echo "********************************************************************************************************" >> "$config"
729
echo "** Configuration Paths for TheFatRat , do not delete anything from this file or program will not work **" >> "$config"
730
echo "** if you need to reconfig your tools path , then run ./setup.sh in (TheFatRat directory) . **" >> "$config"
731
echo "********************************************************************************************************" >> "$config"
732
echo "jarsigner" | tee -a "$config" >> /dev/null 2>&1
733
else
734
echo -e "$red" "[ x ] Jarsigner"
735
echo "0" > "$stp"
736
echo "jarsigner from default-jdk-> Not OK" >> "$inst"
737
fi
738
fi
739
sleep 1
740
741
#Checking if Unzip exists
742
which unzip > /dev/null 2>&1
743
if [ "$?" -eq "0" ]; then
744
echo -e "$green" "[ ✔ ] Unzip.............................[ found ]"
745
which unzip >> "$log" 2>&1
746
echo "unzip" | tee -a "$config" >> /dev/null 2>&1
747
echo "Unzip -> OK" >> "$inst"
748
else
749
echo -e "$red" "[ X ] Unzip -> not found "
750
echo -e "$yellow" "[ ! ] Installing Unzip "
751
xterm -T "☣ INSTALL UNZIP ☣" -geometry 100x30 -e "sudo apt-get install unzip -y "
752
which unzip >> "$log" 2>&1
753
if [ "$?" -eq "0" ]; then
754
echo "unzip" | tee -a "$config" >> /dev/null 2>&1
755
echo -e "$green" "[ ✔ ] Unzip -> OK"
756
echo "Unzip -> OK" >> "$inst"
757
else
758
echo -e "$red" "[ x ] Unzip"
759
echo "0" > "$stp"
760
echo "unzip -> Not OK" >> "$inst"
761
fi
762
fi
763
764
sleep 1
765
#Checking if keytool exists
766
which keytool > /dev/null 2>&1
767
if [ "$?" -eq "0" ]; then
768
echo -e "$green" "[ ✔ ] Keytool from java.................[ found ]"
769
which keytool >> "$log" 2>&1
770
echo "keytool" | tee -a "$config" >> /dev/null 2>&1
771
echo "Keytool -> OK" >> "$inst"
772
else
773
echo -e "$red" "[ X ] Keytool from java -> not found "
774
echo -e "$yellow" "[ ! ] Installing Java "
775
xterm -T "☣ INSTALL JAVA ☣" -geometry 100x30 -e "sudo apt-get install default-jdk default-jre -y | tee -a $mingw"
776
which keytool >> "$log" 2>&1
777
if [ "$?" -eq "0" ]; then
778
echo "keytool" | tee -a "$config" >> /dev/null 2>&1
779
echo -e "$green" "[ ✔ ] Keytool -> OK"
780
echo "Keytool -> OK" >> "$inst"
781
else
782
echo -e "$red" "[ x ] Keytool"
783
echo "0" > "$stp"
784
echo "keytool -> Not OK" >> "$inst"
785
fi
786
fi
787
788
sleep 1
789
790
#Adding zipalign path to config
791
which zipalign > /dev/null 2>&1
792
if [ "$?" -eq "0" ]; then
793
echo -e "$green" "[ ✔ ] Zipalign..........................[ found ]"
794
which zipalign >> "$log" 2>&1
795
echo "Zipalign -> OK" >> "$inst"
796
echo "$path/tools/android-sdk/zipalign" | tee -a "$config" >> /dev/null 2>&1
797
else
798
ln -s "$path/tools/android-sdk/zipalign" "/usr/local/sbin/zipalign" > /dev/null 2>&1
799
which zipalign > /dev/null 2>&1
800
if [ "$?" -eq "0" ]; then
801
echo -e "$green" "[ ✔ ] Zipalign..........................[ found ]"
802
which zipalign >> "$log" 2>&1
803
echo "$path/tools/android-sdk/zipalign" | tee -a "$config" >> /dev/null 2>&1
804
else
805
echo "0" > "$stp"
806
echo "Zipalign -> Not OK" >> "$inst"
807
fi
808
fi
809
sleep 1
810
811
#################################
812
#inputrepo
813
#################################
814
815
cp /etc/apt/sources.list /etc/apt/sources.list.backup # backup
816
# Second backup created in case user stops the script after this point , then on next startup this script will
817
# copy the already changed sources file before as backup , and user lost his original sources lists
818
file="/etc/apt/sources.list.fatrat"
819
if [ ! -f "$file" ]
820
then
821
cp /etc/apt/sources.list /etc/apt/sources.list.fatrat
822
fi
823
rm -f /etc/apt/sources.list
824
touch /etc/apt/sources.list
825
echo "deb http://deb.debian.org/debian/ jessie main contrib non-free" > /etc/apt/sources.list
826
repokey
827
xterm -T "☣ UPDATING REPOSITORIES DEDIAN JESSIE☣" -geometry 100x30 -e "sudo apt-get clean && sudo apt-get clean cache && sudo apt-get update -y | tee -a $mingw"
828
sleep 1
829
830
# check if mingw32 or mingw-64 exists
831
# Case not exists then reedirect to mingw instalation depending on arch
832
833
which x86_64-w64-mingw32-gcc >> /dev/null 2>&1
834
if [ "$?" -eq "0" ]; then
835
echo -e "$green" "[ ✔ ] Mingw-w64 Compiler................[ found ]"
836
which x86_64-w64-mingw32-gcc >> "$log" 2>&1
837
echo "Mingw64 -> OK" >> "$inst"
838
else
839
echo -e "$red" "[ X ] Mingw-w64 -> not found "
840
#Powerstager requires mingw64 to work , mingw32 is required because powerfull.sh requires it for 32bit fud exe compiling
841
# In case mingw64 not found then remove any previously mingw32 & 64 bit faulty instalations and install mingw64
842
843
xterm -T "☣ INSTALL MINGW64 COMPILLER ☣" -geometry 100x30 -e "sudo apt-get install mingw32 mingw-w64 -y | tee -a $mingw"
844
which x86_64-w64-mingw32-gcc > /dev/null 2>&1
845
if [ "$?" -eq "0" ]; then
846
echo -e "$green" "[ ✔ ] Mingw-64 Compiler.................[ found ]"
847
which x86_64-w64-mingw32-gcc >> "$log" 2>&1
848
echo "Mingw64 -> OK" >> "$inst"
849
else
850
echo "0" > "$stp"
851
echo "mingw-w64 -> Not OK" >> "$inst"
852
fi
853
fi
854
855
# check if ming32
856
# Case not exists then reedirect to mingw instalation depending on arch
857
858
which i686-w64-mingw32-gcc >> /dev/null 2>&1
859
if [ "$?" -eq "0" ]; then
860
echo -e "$green" "[ ✔ ] Mingw-32 Compiler.................[ found ]"
861
which i686-w64-mingw32-gcc >> "$log" 2>&1
862
echo "Mingw32 -> OK" >> "$inst"
863
else
864
echo -e "$red" "[ X ] Mingw-32 -> not found "
865
#Powerstager requires mingw64 to work , mingw32 is required because powerfull.sh requires it for 32bit fud exe compiling
866
# In case mingw64 not found then remove any previously mingw32 & 64 bit faulty instalations and install mingw64
867
868
xterm -T "☣ INSTALL MINGW32 COMPILLER ☣" -geometry 100x30 -e "sudo apt-get install mingw32 mingw-w64 -y | tee -a $mingw"
869
which i686-w64-mingw32-gcc > /dev/null 2>&1
870
if [ "$?" -eq "0" ]; then
871
echo -e "$green" "[ ✔ ] Mingw-32 Compiler..................[ found ]"
872
which i686-w64-mingw32-gcc >> "$log" 2>&1
873
echo "Mingw32 -> OK" >> "$inst"
874
else
875
echo "0" > "$stp"
876
echo "mingw-32 -> Not OK" >> "$inst"
877
fi
878
fi
879
sleep 0.5
880
881
#Checking for DX and in case exists then check if it is version 1.12 used in fatrat (latest android sdk)
882
which dx > /dev/null 2>&1
883
if [ "$?" -eq "0" ]; then
884
dxg=$(dx --version 2>&1 | tee temp/dx)
885
dxv=$(grep "version" < temp/dx | awk '{print $3}')
886
case "$dxv" in
887
1.16)
888
#DX exists and it is version 1.16
889
rm -rf temp/dx >/dev/null 2>&1
890
which dx >> "$log" 2>&1
891
echo "dx" | tee -a "$config" >> /dev/null 2>&1
892
echo -e "$green" "[ ✔ ] DX 1.16...........................[ found ]"
893
echo "DX -> OK" >> "$inst"
894
;;
895
*)
896
#DX does not exists or is not 1.16 version
897
xterm -T "☣ Removing Your Current DX ☣" -geometry 100x30 -e "sudo apt-get remove --purge dx -y"
898
unlink "/usr/local/sbin/dx" > /dev/null 2>&1
899
ln -s "$path/tools/android-sdk/dx" "/usr/local/sbin/dx" > /dev/null 2>&1
900
which dx > /dev/null 2>&1
901
if [ "$?" -eq "0" ]; then
902
which dx >> "$log" 2>&1
903
echo "dx" | tee -a "$config" >> /dev/null 2>&1
904
echo -e "$green" "[ ✔ ] DX 1.16...........................[Installed]"
905
echo "DX -> OK" >> "$inst"
906
else
907
echo -e "$red" "[ x ] DX 1.16"
908
echo "0" > "$stp"
909
echo "dx -> Not OK" >> "$inst"
910
fi
911
;;
912
esac
913
else
914
unlink "/usr/local/sbin/dx" > /dev/null 2>&1
915
ln -s "$path/tools/android-sdk/dx" "/usr/local/sbin/dx" > /dev/null 2>&1
916
which dx > /dev/null 2>&1
917
if [ "$?" -eq "0" ]; then
918
which dx >> "$log" 2>&1
919
echo "dx" | tee -a "$config" >> /dev/null 2>&1
920
echo -e "$green" "[ ✔ ] DX 1.16...........................[Installed]"
921
echo "DX -> OK" >> "$inst"
922
else
923
echo -e "$red" "[ x ] DX 1.16"
924
echo "0" > "$stp"
925
echo "dx -> Not OK" >> "$inst"
926
fi
927
fi
928
sleep 1
929
# check if aapt exists and if it is version v0.2-3544217 used in fatrat (android sdk)
930
931
which aapt > /dev/null 2>&1
932
if [ "$?" -eq "0" ]; then
933
aptv=`aapt v | awk '{print $5}'`
934
case "$aptv" in
935
v0.2-6625208)
936
#exists and it is v0.2-6625208
937
which aapt >> "$log" 2>&1
938
echo "aapt" | tee -a "$config" >> /dev/null 2>&1
939
echo -e "$green" "[ ✔ ] Aapt v0.2-6625208.................[ found ]"
940
echo "Aapt -> OK" >> "$inst"
941
rm /usr/local/sbin/aapt2 >/dev/null 2>&1
942
ln -s "$path/tools/android-sdk/aapt2" "/usr/local/sbin/aapt2" > /dev/null 2>&1
943
;;
944
*)
945
#Aapt does not exists or is not the latest version used in fatrat (android sdk)
946
xterm -T "☣ Removing Your Current Aapt ☣" -geometry 100x30 -e "sudo apt-get remove --purge aapt -y"
947
unlink "/usr/local/sbin/aapt" > /dev/null 2>&1
948
unlink "/usr/local/sbin/aapt2" > /dev/null 2>&1
949
rm /usr/local/sbin/aapt >/dev/null 2>&1
950
rm /usr/local/sbin/aapt2 >/dev/null 2>&1
951
ln -s "$path/tools/android-sdk/aapt" "/usr/local/sbin/aapt" > /dev/null 2>&1
952
ln -s "$path/tools/android-sdk/aapt2" "/usr/local/sbin/aapt2" > /dev/null 2>&1
953
which aapt > /dev/null 2>&1
954
if [ "$?" -eq "0" ]; then
955
which aapt >> "$log" 2>&1
956
echo "aapt" | tee -a "$config" >> /dev/null 2>&1
957
echo -e "$green" "[ ✔ ] Aapt v0.2-6625208..................[Installed]"
958
echo "Aapt -> OK" >> "$inst"
959
else
960
echo -e "$red" "[ x ] Aapt v0.2-6625208"
961
echo "0" > "$stp"
962
echo "aapt -> Not OK" >> "$inst"
963
fi
964
;;
965
esac
966
else
967
unlink "/usr/local/sbin/aapt" > /dev/null 2>&1
968
unlink "/usr/local/sbin/aapt2" > /dev/null 2>&1
969
ln -s "$path/tools/android-sdk/aapt" "/usr/local/sbin/aapt" > /dev/null 2>&1
970
ln -s "$path/tools/android-sdk/aapt2" "/usr/local/sbin/aapt2" > /dev/null 2>&1
971
which aapt > /dev/null 2>&1
972
if [ "$?" -eq "0" ]; then
973
which aapt >> "$log" 2>&1
974
echo "aapt" | tee -a "$config" >> /dev/null 2>&1
975
echo -e "$green" "[ ✔ ] Aapt v0.2-6625208.................[Installed]"
976
echo "Aapt -> OK" >> "$inst"
977
else
978
echo -e "$red" "[ x ] Aapt v0.2-6625208"
979
echo "0" > "$stp"
980
echo "aapt -> Not OK" >> "$inst"
981
fi
982
fi
983
sleep 1
984
#Same procedure used for dx and aapt , but for apktool 2.6.0.
985
which apktool > /dev/null 2>&1
986
if [ "$?" -eq "0" ]; then
987
apk=`apktool | sed -n 1p | awk '{print $2}'` > /dev/null 2>&1
988
case "$apk" in
989
v.2.6.0)
990
which apktool >> "$log" 2>&1
991
echo "apktool" | tee -a "$config" >> /dev/null 2>&1
992
echo -e "$green" "[ ✔ ] Apktool v.2.6.0..................[ found ]"
993
echo "Apktool -> OK" >> "$inst"
994
;;
995
*)
996
xterm -T "☣ REMOVE OLD APKTOOL ☣" -geometry 100x30 -e "sudo apt-get remove --purge apktool -y"
997
unlink "/usr/local/sbin/apktool" > /dev/null 2>&1
998
ln -s "$path/tools/apktool/apktool" "/usr/local/sbin/apktool" > /dev/null 2>&1
999
which apktool > /dev/null 2>&1
1000
if [ "$?" -eq "0" ]; then
1001
echo -e "$green" "[ ✔ ] Apktool v.2.6.0...................[Installed]"
1002
which apktool >> "$log" 2>&1
1003
echo "apktool" | tee -a "$config" >> /dev/null 2>&1
1004
echo "Apktool -> OK" >> "$inst"
1005
else
1006
echo -e "$red" "[ x ] Apktool v.2.6.0"
1007
echo "0" > "$stp"
1008
echo "apktool -> Not OK" >> "$inst"
1009
fi
1010
;;
1011
esac
1012
else
1013
unlink "/usr/local/sbin/apktool" > /dev/null 2>&1
1014
ln -s "$path/tools/apktool/apktool" "/usr/local/sbin/apktool" > /dev/null 2>&1
1015
which apktool > /dev/null 2>&1
1016
if [ "$?" -eq "0" ]; then
1017
which apktool >> "$log" 2>&1
1018
echo "apktool" | tee -a "$config" >> /dev/null 2>&1
1019
echo -e "$green" "[ ✔ ] Apktool v.2.6.0...................[Installed]"
1020
echo "Apktool -> OK" >> "$inst"
1021
else
1022
echo -e "$red" "[ x ] Apktool v.2.6.0"
1023
echo "0" > "$stp"
1024
echo "apktool -> Not OK" >> "$inst"
1025
fi
1026
fi
1027
1028
sleep 1
1029
# Installing baksmali 2.3.3
1030
which baksmali > /dev/null 2>&1
1031
if [ "$?" -eq "0" ]; then
1032
bsvs=$(baksmali --version | grep "baksmali" | awk '{print$2}')
1033
case "$bsvs" in
1034
2.3.3)
1035
which baksmali >> "$log" 2>&1
1036
echo "baksmali" | tee -a "$config" >> /dev/null 2>&1
1037
echo -e "$green" "[ ✔ ] Baksmali v.2.3.3..................[ found ]"
1038
echo "Baksmali -> OK" >> "$inst"
1039
;;
1040
*)
1041
xterm -T "☣ REMOVE OLD BAKSMALI ☣" -geometry 100x30 -e "sudo apt-get remove --purge baksmali -y"
1042
unlink "/usr/local/sbin/baksmali" > /dev/null 2>&1
1043
ln -s "$path/tools/baksmali233/baksmali" "/usr/local/sbin/baksmali" > /dev/null 2>&1
1044
which baksmali > /dev/null 2>&1
1045
if [ "$?" -eq "0" ]; then
1046
echo -e "$green" "[ ✔ ] Baksmali v.2.3.3..................[Installed]"
1047
which baksmali >> "$log" 2>&1
1048
echo "baksmali" | tee -a "$config" >> /dev/null 2>&1
1049
echo "Baksmali -> OK" >> "$inst"
1050
else
1051
echo -e "$red" "[ x ] Baksmali v.2.3.3"
1052
echo "0" > "$stp"
1053
echo "baksmali -> Not OK" >> "$inst"
1054
fi
1055
;;
1056
esac
1057
else
1058
unlink "/usr/local/sbin/baksmali" > /dev/null 2>&1
1059
ln -s "$path/tools/baksmali233/baksmali" "/usr/local/sbin/baksmali" > /dev/null 2>&1
1060
which baksmali > /dev/null 2>&1
1061
if [ "$?" -eq "0" ]; then
1062
which baksmali >> "$log" 2>&1
1063
echo "baksmali" | tee -a "$config" >> /dev/null 2>&1
1064
echo -e "$green" "[ ✔ ] Baksmali v.2.3.3..................[Installed]"
1065
echo "Baksmali -> OK" >> "$inst"
1066
else
1067
echo -e "$red" "[ x ] Baksmali v.2.3.3"
1068
echo "0" > "$stp"
1069
echo "baksmali -> Not OK" >> "$inst"
1070
fi
1071
fi
1072
rm -f /etc/apt/sources.list
1073
touch /etc/apt/sources.list
1074
echo "deb https://http.kali.org/kali kali-rolling main non-free contrib" > /etc/apt/sources.list
1075
repokey
1076
xterm -T "☣ UPDATING KALI REPOSITORIES ☣" -geometry 100x30 -e "sudo apt-get clean && sudo apt-get clean cache && sudo apt-get update"
1077
sleep 1
1078
mtspl
1079
################################
1080
# rebackyo repo
1081
################################
1082
echo -e "$blue" "Reactivating your original repositories"
1083
rm -f /etc/apt/sources.list
1084
mv /etc/apt/sources.list.backup /etc/apt/sources.list
1085
#now we can remove the emergency backup securely
1086
rm -f /etc/apt/sources.list.fatrat
1087
apt-get clean
1088
xterm -T "☣ UPDATE YOUR REPO ☣" -geometry 100x30 -e "sudo apt-get update "
1089
clear
1090
crtdir
1091
echo -e "$green" "Do you want to create a shortcut for fatrat in your system"
1092
echo -e "$green" "so you can run fatrat from anywhere in your terminal and desktop ?"
1093
echo ""
1094
echo -ne "$cyan" "Choose y/n : "
1095
read -r cho
1096
case "$cho" in
1097
1098
y|Y|Yes|yes|YES)
1099
lnk=$?
1100
if [ "$lnk" == "0" ];then
1101
dir=`pwd`
1102
scrp="cd $dir && ./fatrat"
1103
rm -f /usr/local/sbin/fatrat
1104
touch /usr/local/sbin/fatrat
1105
echo "#!/bin/bash" > /usr/local/sbin/fatrat
1106
echo "$scrp" >> /usr/local/sbin/fatrat
1107
cp "$path/config/TheFatRat.desktop" /usr/share/applications/TheFatRat.desktop
1108
cp "$path/icons/TheFatRat.ico" /usr/share/icons/TheFatRat.ico
1109
chmod +x /usr/local/sbin/fatrat
1110
chmod +x fatrat
1111
which fatrat >> "$log" 2>&1
1112
clear
1113
echo ""
1114
echo -e "$green" "Instalation completed , To execute fatrat write anywhere in your terminal fatrat"
1115
fi
1116
;;
1117
1118
n|no|No|NO)
1119
chmod +x fatrat
1120
clear
1121
echo ""
1122
echo -e "$green" "Instalation completed , To execute fatrat write in fatrat directory ./fatrat"
1123
;;
1124
1125
*)
1126
chmod +x fatrat
1127
clear
1128
echo ""
1129
echo -e "$green" "Instalation completed , To execute fatrat write in fatrat directory ./fatrat"
1130
;;
1131
esac
1132
exit
1133
1134
}
1135
#Case ping goggle hostname fails , the this function will load to check what is happening
1136
function chknet() {
1137
echo -e "$red" "[X] Your Internet is not working correctly!"
1138
sleep 1
1139
echo -e "$cyan" "[*] Checking ...."
1140
#ping hostname failed , so now will test ping google ip dns server
1141
ping -c 1 8.8.4.4 > /dev/null 2>&1
1142
png="$?"
1143
if [ "$png" == "0" ]
1144
then
1145
#Ping dns server worked , inform user what happened and proceed with setup
1146
echo -e "$red" "[X] Your linux OS is not able to resolve"
1147
echo -e "$red" "hostnames over terminal using ping !!"
1148
echo ""
1149
echo -e "$yellow" "Search on the web : unable to resolve hostnames ping to find a solution"
1150
echo ""
1151
echo -e "$green" "Setup will continue , but is not garantee that apt package management
1152
may work properly , or even if it can resolve hostnames ."
1153
echo ""
1154
echo -e "$cyan" "Setup will continue because :"
1155
echo -e "$green" "Ping google.com =$red Failed"
1156
echo -e "$green" "Ping google DNS = Success"
1157
echo ""
1158
echo -e "$green" "Press [ENTER] key to continue"
1159
read continue
1160
cont
1161
sleep 1
1162
elif [ "$png" == "1" ]
1163
then
1164
#user is only connected to lan and not to the web , abort setup
1165
echo -e "$yellow" "You are connected to your local network but not to the web ."
1166
echo -e "$yellow" "Check if your router/modem gateway is connected to the web ."
1167
echo ""
1168
echo -e "$green" "Setup will not continue , you are only connected to your local lan."
1169
echo ""
1170
echo -e "$cyan" "Setup will stop because :"
1171
echo -e "$green" "Ping google.com =$red Failed"
1172
echo -e "$green" "Ping google DNS =$red Failed"
1173
echo ""
1174
echo -e "$green" "Press [ENTER] key to continue"
1175
read -r continue
1176
exit 1
1177
sleep 1
1178
elif [ "$png" == "2" ]
1179
then
1180
# user is not connected to anywhere , web or lan , abort setup
1181
echo -e "$red" "You are not connected to any network ."
1182
echo ""
1183
echo -e "$cyan" "Setup will stop because :"
1184
echo -e "$green" "Ping google.com =$red Failed"
1185
echo -e "$green" "Ping google DNS =$red Failed"
1186
echo ""
1187
echo -e "$green" "Press [ENTER] key to continue"
1188
read -r continue
1189
exit 1
1190
sleep 1
1191
fi
1192
}
1193
chkpkg () {
1194
pkgi="$path/tools/pkgs"
1195
if [[ ! -f "$pkgi" ]]
1196
then
1197
wget https://raw.githubusercontent.com/Screetsec/TheFatRat/master/tools/pkgs -O "$pkgi" >/dev/null 2>&1
1198
if [[ ! -f "$pkgi" ]]
1199
then
1200
echo ""
1201
echo -e "$red""Somehow your fatrat is not in the latest release , and we were "
1202
echo -e "$red""unable to download a critical package from github ."
1203
echo ""
1204
echo -e "$red""Make sure you are connected to internet before running setup."
1205
echo ""
1206
exit 1
1207
fi
1208
fi
1209
for i in {1..28}
1210
do
1211
rdpkg=$(sed -n ${i}p < "$pkgi")
1212
cpkg=$(apt-cache search "$rdpkg" | grep "$rdpkg " | awk '{print$1}')
1213
if [[ -z "$cpkg" ]]
1214
then
1215
if [[ ! -f "$aptlog" ]]
1216
then
1217
echo "Fatrat package location diagnostic" > "$aptlog"
1218
echo "-----------------------------------" >> "$aptlog"
1219
echo "$rdpkg - Does not exist in user repository" >> "$aptlog"
1220
else
1221
echo "$rdpkg - Does not exist in user repository" >> "$aptlog"
1222
fi
1223
else
1224
if [[ ! -f "$aptlog" ]]
1225
then
1226
echo "Fatrat package location diagnostic" > "$aptlog"
1227
echo "-----------------------------------" >> "$aptlog"
1228
echo "$rdpkg - Exist in user repository" >> "$aptlog"
1229
else
1230
echo "$rdpkg - Exist in user repository" >> "$aptlog"
1231
fi
1232
fi
1233
done
1234
echo "" >> "$aptlog"
1235
echo "-----------------------------------" >> "$aptlog"
1236
echo "User path environment" >> "$aptlog"
1237
echo "-----------------------------------" >> "$aptlog"
1238
echo "$PATH" >> "$aptlog"
1239
echo "-----------------------------------" >> "$aptlog"
1240
echo "User current repositories" >> "$aptlog"
1241
echo "-----------------------------------" >> "$aptlog"
1242
if [[ -f "/etc/apt/sources.list" ]]
1243
then
1244
cat "/etc/apt/sources.list" >> "$aptlog"
1245
else
1246
echo "sources.list file was not found in user OS" >> "$aptlog"
1247
fi
1248
echo "-----------------------------------" >> "$aptlog"
1249
echo "User Linux Distribution"
1250
echo "-----------------------------------" >> "$aptlog"
1251
uname -a >> "$aptlog"
1252
echo "-----------------------------------" >> "$aptlog"
1253
echo " Access User Level " >> "$aptlog"
1254
echo "-----------------------------------" >> "$aptlog"
1255
if [ "$(whoami)" == "root" ] ; then
1256
echo "User is root level"
1257
else
1258
which sudo > /dev/null 2>&1
1259
if [ "$?" -eq "0" ]; then
1260
sudo -l >> "$aptlog"
1261
else
1262
echo "Sudo not installed , unable to determine user rights" >> "$aptlog"
1263
fi
1264
fi
1265
echo "-----------------------------------" >> "$aptlog"
1266
echo "Done"
1267
echo ""
1268
echo -e "$yellow""A report was created in :"
1269
echo -e "$green""$aptlog"
1270
echo ""
1271
echo "If you find any issues installing fatrat then"
1272
echo "Upload this report to your issue in github"
1273
echo -e "$yellow"""
1274
read -rsp $'Press [ENTER] key to continue setup \n' -n 1 key
1275
1276
}
1277
# setup.sh Original Author : Edo maland ( Screetsec )
1278
# Script rebuilded by peterpt
1279
# Install all dependencies nedded
1280
# configuration all file for fixing all problems
1281
# --------------------------------------------------------
1282
1283
1284
#Fail safe for original user sources.list in case setup was interrupted in middle last time
1285
file="/etc/apt/sources.list.fatrat"
1286
if [ -f "$file" ]
1287
then
1288
echo "Setup Detected that your previous run was interrupted in middle , fixing your original repositories list ."
1289
sleep 4s
1290
rm -f /etc/apt/sources.list
1291
mv /etc/apt/sources.list.fatrat /etc/apt/sources.list
1292
echo "Your Original repository list was recovered. ;) ..... beginning setup"
1293
echo ""
1294
echo "Cleaning previous repositories cache & updating your repository ."
1295
echo -e "$yellow" ""
1296
sudo apt-get clean && apt-get update -y
1297
sleep 2
1298
else
1299
echo -e "$green" ""
1300
fi
1301
#variables for logs and others
1302
path=`pwd`
1303
arch=$(uname -m)
1304
inst="$path/logs/install.log"
1305
log="$path/logs/setup.log"
1306
aptlog="$path/logs/apt.log"
1307
config="$path/config/config.path"
1308
mingw="$path/logs/aptdebug.log"
1309
#Removing any previous setup log created
1310
rm -rf "$log" > /dev/null 2>&1
1311
rm -rf logs/check > /dev/null 2>&1
1312
rm -rf "$aptlog" > /dev/null 2>&1
1313
rm -rf "$mingw" > /dev/null 2>&1
1314
#terminal text colours code
1315
cyan='\033[0;36m'
1316
green='\033[0;32m'
1317
lightgreen='\e[0;32m'
1318
white='\e[0;37m'
1319
red='\e[0;31m'
1320
yellow='\033[0;33m'
1321
blue='\033[0;34m'
1322
orange='\e[38;5;166m'
1323
1324
#Check root dulu
1325
if [ $(id -u) != "0" ]; then
1326
echo -e "$red" [x]::[not root]: You need to be [root] to run this script.;
1327
echo ""
1328
sleep 1
1329
exit 0
1330
fi
1331
#Many fresh installed linux distros do not come with sudo installed
1332
which sudo > /dev/null 2>&1
1333
if [ "$?" -eq "0" ]; then
1334
echo ""
1335
else
1336
apt-get install sudo -y
1337
fi
1338
echo ""
1339
# Fixing any possible problems with packages missed/corrupted dependencies on user OS before proceed
1340
echo -ne "$green""[ * ] Fixing any possible broken packages in apt management..."
1341
sleep 1
1342
sudo apt-get install -f -y && sudo apt-get autoremove -y > /dev/null 2>&1
1343
echo "Done"
1344
sleep 1
1345
echo ""
1346
echo -ne "$green""Checking necessary packages with your current repositories ...."
1347
chkpkg
1348
echo ""
1349
sleep 2
1350
echo -ne "$green""* - Checking file permissions ..."
1351
chmod +x powerfull.sh
1352
chmod +x update
1353
chmod +x backdoor_apk
1354
chmod +x chk_tools
1355
chmod +x tools/power.py
1356
chmod +x tools/android-sdk/zipalign
1357
chmod +x tools/baksmali233/baksmali
1358
chmod +x tools/android-sdk/dx
1359
chmod +x tools/android-sdk/aapt
1360
chmod +x tools/apktool/apktool
1361
chmod +x tools/android-string-obfuscator/lib/aso
1362
chmod +x tools/pump.py
1363
chmod +x tools/pw_exec.py
1364
chmod +x tools/trusted_2_6.py
1365
echo "Done"
1366
sleep 0.5
1367
clear
1368
#Banner dong biar keren
1369
echo -e "$green" ""
1370
echo "___________ __ __________ __ "
1371
echo "\_ _____/_____ _/ |_\______ \_____ _/ |_ "
1372
echo " | __) \__ \ \ __\| _/\__ \ \ __\ "
1373
echo " | \ / __ \_| | | | \ / __ \_| | "
1374
echo " \___ / (____ /|__| |____|_ /(____ /|__| "
1375
echo " \/ \/ \/ \/ "
1376
echo " ____ ________ "
1377
echo " /_ | / __ \ "
1378
echo " | | \____ / "
1379
echo " | | / / "
1380
echo " |___| /\ /____/ "
1381
echo " \/ "
1382
echo ""
1383
echo -e "$blue" " Setup Script for FATRAT 1.9.7 "
1384
echo "------------------------------------------------------" > "$log"
1385
echo "| Tools paths configured in setup.sh for TheFatRat |" >> "$log"
1386
echo "------------------------------------------------------" >> "$log"
1387
echo " " >> "$log"
1388
echo ""
1389
#Detect if user OS is 32Bit or 64bit
1390
case "$arch" in
1391
x86_64|aarch64)
1392
echo -e "$yellow" " 64Bit OS detected"
1393
echo ""
1394
;;
1395
i386|i486|i586|i686)
1396
echo -e "$yellow" " 32Bit OS detected"
1397
echo ""
1398
;;
1399
*)
1400
echo -e "$red" "Setup will not proceed because none of these archs were detected"
1401
echo ""
1402
echo -e "$blue" "x86_64|i386|i486|i586|i686|aarch64"
1403
echo ""
1404
echo -e "$green" "Your linux arch: $blue $arch $green is not supported"
1405
echo ""
1406
echo -e "Press any key to continue"
1407
read -r abor
1408
exit 0
1409
;;
1410
esac
1411
echo -e "$green" "Checking type of shell ...."
1412
sleep 1
1413
1414
#Check if user is using a remote shell or a local terminal
1415
if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
1416
echo "[remote]"
1417
echo ""
1418
echo -e "$red" "Fatrat & Setup does not work over a remote secure shell ."
1419
echo ""
1420
echo -e "$green" "If you want to Install Fatrat on a remote computer then "
1421
echo -e "$green" "use a remote desktop connection like rdesktop or vnc) "
1422
echo ""
1423
echo -e "$green" "Press [ENTER] key to exit"
1424
read -r abor
1425
exit 1
1426
else
1427
echo "[local]"
1428
case $(ps -o comm= -p $PPID) in
1429
sshd|*/sshd) SESSION_TYPE=remote/ssh;;
1430
esac
1431
fi
1432
sleep 1
1433
which nc > /dev/null 2>&1
1434
if [ "$?" -eq "0" ]; then
1435
echo ""
1436
else
1437
sudo apt-get install netcat -y > /dev/null 2>&1
1438
fi
1439
sleep 1
1440
#First check of setup for internet connection by connecting to google over http
1441
echo -e "$green" "[ * ] Checking for internet connection"
1442
sleep 1
1443
echo -e "GET http://google.com HTTP/1.0\n\n" | nc google.com 80 > /dev/null 2>&1
1444
if [ $? -ne 0 ]; then
1445
echo -e "$red" [ X ]::[Internet Connection]: OFFLINE!;
1446
chknet
1447
sleep 1
1448
else
1449
echo -e "$green" [ ]::[Internet Connection]: CONNECTED!;
1450
sleep 1
1451
cont
1452
fi
1453
1454
#ping -c 1 google.com > /dev/null 2>&1
1455
#png="$?"
1456
# if [ $png == "0" ]
1457
#then
1458
#ping google hostname was succefully , then proceed with setup
1459
# echo -e $green [ ✔ ]::[Internet Connection]: CONNECTED!;
1460
# sleep 1
1461
# cont
1462
#elif [ $png == "1" ]
1463
#then
1464
#ping hostname failed , load chknet function
1465
# echo -e $yellow [ X ]::[Internet Connection]: LOCAL ONLY!;
1466
# chknet
1467
# sleep 1
1468
#elif [ $png == "2" ]
1469
#then
1470
#ping hostname failed , load chknet function
1471
#echo -e $red [ X ]::[Internet Connection]: OFFLINE!;
1472
#chknet
1473
# sleep 1
1474
#fi
1475
1476