-
Notifications
You must be signed in to change notification settings - Fork 228
/
kali2.sh
executable file
·3815 lines (3262 loc) · 224 KB
/
kali2.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
#-Metadata----------------------------------------------------#
# Filename: kali.sh (Update: 2015-12-02) #
#-Info--------------------------------------------------------#
# Personal post-install script for Kali Linux 2.0. #
#-Author(s)---------------------------------------------------#
# g0tmilk ~ https://blog.g0tmi1k.com/ #
#-Operating System--------------------------------------------#
# Designed for: Kali Linux 2.x [x64] (VM - VMware) #
# Tested on: Kali Linux 2.0.0 x64/x84/full/light/mini/vm #
# Kali v1.x: https://g0tmi1k/os-scripts/master/kali1.sh #
#-Licence-----------------------------------------------------#
# MIT License ~ http://opensource.org/licenses/MIT #
#-Notes-------------------------------------------------------#
# Run as root, just after a fresh/clean install of Kali 2.x. #
# --- #
# You will need 25GB+ of HDD space. #
# --- #
# Command line arguments: #
# -burp = Automates configuring Burp Suite #
# -dns = Use Google's DNS and locks permissions #
# -hold = Disable updating certain packages (e.g. msf) #
# -openvas = Installs & configures OpenVAS vuln scanner #
# -osx = Configures Apple keyboard layout #
# -rolling = Use kali-rolling repository #
# #
# -keyboard <value> = Change the keyboard layout language #
# -timezone <value> = Change the timezone location #
# #
# e.g. # bash kali.sh -osx -burp -openvas -keyboard gb #
# --- #
# ** This script is meant for _ME_. ** #
# ** EDIT this to meet _YOUR_ requirements! ** #
#-------------------------------------------------------------#
if [ 1 -eq 0 ]; then # This is never true, thus it acts as block comments ;)
### One liner - Grab the latest version and execute! ###########################
wget -qO kali.sh https://raw.github.com/g0tmi1k/os-scripts/master/kali.sh && bash kali.sh -dns -burp -openvas -rolling -keyboard gb -timezone "Europe/London"
################################################################################
## Shorten URL: >->-> wget -qO- http://bit.do/postkali | bash <-<-<
## Alt Method: curl -s -L -k https://raw.github.com/g0tmi1k/kali-postinstall/master/kali_postinstall.sh > kali.sh | nohup bash
################################################################################
fi
#-Defaults-------------------------------------------------------------#
##### Location information
keyboardApple=false # Using a Apple/Macintosh keyboard (non VM)? [ --osx ]
keyboardLayout="" # Set keyboard layout [ --keyboard gb]
timezone="" # Set timezone location [ --timezone Europe/London ]
##### Optional steps
burpFree=false # Disable configuring Burp Suite (for Burp Pro users...) [ --burp ]
hardenDNS=false # Set static & lock DNS name server [ --dns ]
freezeDEB=false # Disable updating certain packages (e.g. Metasploit) [ --hold ]
openVAS=false # Install & configure OpenVAS (not everyone wants it...) [ --openvas ]
rolling=false # Enable kali-rolling repos? [ --rolling ]
##### (Optional) Enable debug mode?
#set -x
##### (Cosmetic) Colour output
RED="\033[01;31m" # Issues/Errors
GREEN="\033[01;32m" # Success
YELLOW="\033[01;33m" # Warnings/Information
BLUE="\033[01;34m" # Heading
BOLD="\033[01;01m" # Highlight
RESET="\033[00m" # Normal
#-Arguments------------------------------------------------------------#
##### Read command line arguments
while [[ "${#}" -gt 0 && ."${1}" == .-* ]]; do
opt="${1}";
shift;
case "$(echo ${opt} | tr '[:upper:]' '[:lower:]')" in
-|-- ) break 2;;
-osx|--osx )
keyboardApple=true;;
-apple|--apple )
keyboardApple=true;;
-dns|--dns )
hardenDNS=true;;
-hold|--hold )
freezeDEB=true;;
-openvas|--openvas )
openVAS=true;;
-burp|--burp )
burpFree=true;;
-rolling|--rolling )
rolling=true;;
-keyboard|--keyboard )
keyboardLayout="${1}"; shift;;
-keyboard=*|--keyboard=* )
keyboardLayout="${opt#*=}";;
-timezone|--timezone )
timezone="${1}"; shift;;
-timezone=*|--timezone=* )
timezone="${opt#*=}";;
*) echo -e ' '${RED}'[!]'${RESET}" Unknown option: ${RED}${x}${RESET}" 1>&2 && exit 1;;
esac
done
##### Check user inputs
if [[ -n "${timezone}" && ! -f "/usr/share/zoneinfo/${timezone}" ]]; then
echo -e ' '${RED}'[!]'${RESET}" Looks like the ${RED}timezone '${timezone}'${RESET} is incorrect/not supported (Example: Europe/London). Quitting..." 1>&2
exit 1
elif [[ -n "${keyboardLayout}" && -e /usr/share/X11/xkb/rules/xorg.lst ]]; then
if ! $(grep -q " ${keyboardLayout} " /usr/share/X11/xkb/rules/xorg.lst); then
echo -e ' '${RED}'[!]'${RESET}" Looks like the ${RED}keyboard layout '${keyboardLayout}'${RESET} is incorrect/not supported (Example: gb). Quitting..." 1>&2
exit 1
fi
fi
#-Start----------------------------------------------------------------#
##### Check if we are running as root - else this script will fail (hard!)
if [[ ${EUID} -ne 0 ]]; then
echo -e ' '${RED}'[!]'${RESET}" This script must be ${RED}run as root${RESET}. Quitting..." 1>&2
exit 1
else
echo -e " ${BLUE}[*]${RESET} ${BOLD}Kali Linux 2.x post-install script${RESET}"
fi
##### Fix display output for GUI programs when connecting via SSH
export DISPLAY=:0.0 #[[ -z $SSH_CONNECTION ]] || export DISPLAY=:0.0
export TERM=xterm
##### Give VM users a little heads up to get ready
(dmidecode | grep -iq virtual) && echo -e " ${YELLOW}[i]${RESET} VM Detected. Please be sure to have the ${YELLOW}correct tools ISO mounted${RESET}" && sleep 5s
if [[ $(which gnome-shell) ]]; then
##### Disable notification package updater
echo -e "\n ${GREEN}[+]${RESET} Disabling ${GREEN}notification package updater${RESET} service ~ in case it runs during this script"
export DISPLAY=:0.0 #[[ -z $SSH_CONNECTION ]] || export DISPLAY=:0.0
dconf write /org/gnome/settings-daemon/plugins/updates/active false
dconf write /org/gnome/desktop/notifications/application/gpk-update-viewer/active false
timeout 5 killall -w /usr/lib/apt/methods/http >/dev/null 2>&1 #|| echo -e ' '${RED}'[!]'${RESET}" Failed to kill ${RED}/usr/lib/apt/methods/http${RESET}"
#if [[ -e /var/lib/apt/lists/lock ]]; then
# echo -e ' '${RED}'[!]'${RESET}" There might be ${RED}another (background) service${RESET} using ${BOLD}Advanced Packaging Tool${RESET} currently"
# echo -e ' '${RED}'[!]'${RESET}" If you are 100% sure this is a mistake: $ rm -f /var/lib/{dpkg,apt/lists}/lock; dpkg --configure -a"
# exit 1
#fi
##### Disable screensaver
echo -e "\n ${GREEN}[+]${RESET} Disabling ${GREEN}screensaver${RESET}"
xset s 0 0
xset s off
gsettings set org.gnome.desktop.session idle-delay 0 # Disable swipe on lockscreen
fi
##### Check Internet access
echo -e "\n ${GREEN}[+]${RESET} Checking ${GREEN}Internet access${RESET}"
for i in {1..10}; do ping -c 1 -W ${i} www.google.com &>/dev/null && break; done
if [[ "$?" -ne 0 ]]; then
echo -e ' '${RED}'[!]'${RESET}" ${RED}Possible DNS issues${RESET}(?). Trying DHCP 'fix'" 1>&2
chattr -i /etc/resolv.conf 2>/dev/null
dhclient -r
route delete default gw 192.168.155.1 2>/dev/null
dhclient
sleep 15s
_TMP=true
_CMD="$(ping -c 1 8.8.8.8 &>/dev/null)"
if [[ "$?" -ne 0 && "$_TMP" == true ]]; then
_TMP=false
echo -e ' '${RED}'[!]'${RESET}" ${RED}No Internet access${RESET}. Manually fix the issue & re-run the script" 1>&2
fi
_CMD="$(ping -c 1 www.google.com &>/dev/null)"
if [[ "$?" -ne 0 && "$_TMP" == true ]]; then
_TMP=false
echo -e ' '${RED}'[!]'${RESET}" ${RED}Possible DNS issues${RESET}(?). Manually fix the issue & re-run the script" 1>&2
fi
if [[ "$_TMP" == false ]]; then
(dmidecode | grep -iq virtual) && echo -e " ${YELLOW}[i]${RESET} VM Detected. ${YELLOW}Try switching network adapter mode${RESET} (NAT/Bridged)"
echo -e ' '${RED}'[!]'${RESET}" Quitting..." 1>&2
exit 1
fi
fi
#--- GitHub under DDoS?
timeout 300 curl --progress -k -L -f "https://status.github.com/api/status.json" | grep -q "good" || (echo -e ' '${RED}'[!]'${RESET}" ${RED}GitHub is currently having issues${RESET}. ${BOLD}Lots may fail${RESET}. See: https://status.github.com/" 1>&2 && sleep 10s)
##### Enable default network repositories ~ http://docs.kali.org/general-use/kali-linux-sources-list-repositories
echo -e "\n ${GREEN}[+]${RESET} Enabling default kali ${GREEN}network repositories${RESET} ~ ...if they were not selected during installation"
#--- Add network repositories
file=/etc/apt/sources.list; [ -e "${file}" ] && cp -n $file{,.bkup}
([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
#--- Main
grep -q 'deb .* sana main non-free contrib' "${file}" 2>/dev/null || echo "deb http://http.kali.org/kali sana main non-free contrib" >> "${file}"
grep -q 'deb-src .* sana main non-free contrib' "${file}" 2>/dev/null || echo "deb-src http://http.kali.org/kali sana main non-free contrib" >> "${file}"
#--- Security
grep -q 'deb .* sana/updates main contrib non-free' "${file}" 2>/dev/null || echo "deb http://security.kali.org/kali-security sana/updates main contrib non-free" >> "${file}"
grep -q 'deb-src .* sana/updates main contrib non-free' "${file}" 2>/dev/null || echo "deb-src http://security.kali.org/kali-security sana/updates main contrib non-free" >> "${file}"
#--- Disable CD repositories
sed -i '/kali/ s/^\( \|\t\|\)deb cdrom/#deb cdrom/g' "${file}"
#--- Update
apt-get -qq update
if [[ "$?" -ne 0 ]]; then
echo -e ' '${RED}'[!]'${RESET}" There was an ${RED}issue accessing network repositories${RESET}" 1>&2
echo -e " ${YELLOW}[i]${RESET} Are the remote network repositories ${YELLOW}currently being sync'd${RESET}?"
echo -e " ${YELLOW}[i]${RESET} YOUR local ${YELLOW}network repository information${RESET} (Geo-IP based):"
curl -sI http://http.kali.org/README
exit 1
fi
##### Install kernel headers
echo -e "\n ${GREEN}[+]${RESET} Installing ${GREEN}kernel headers${RESET}"
apt-get -y -qq install make gcc "linux-headers-$(uname -r)" || echo -e ' '${RED}'[!] Issue with apt-get'${RESET} 1>&2
if [[ $? -ne 0 ]]; then
echo -e ' '${RED}'[!]'${RESET}" There was an ${RED}issue installing kernel headers${RESET}" 1>&2
echo -e " ${YELLOW}[i]${RESET} Are you ${YELLOW}USING${RESET} the ${YELLOW}latest kernel${RESET}?"
echo -e " ${YELLOW}[i]${RESET} ${YELLOW}Reboot your machine${RESET}"
exit 1
fi
##### (Optional) Check to see if Kali is in a VM. If so, install "Virtual Machine Addons/Tools" for a "better" virtual experiment
if [ -e "/etc/vmware-tools" ]; then
echo -e "\n "${RED}'[!]'${RESET}" VMware Tools is ${RED}already installed${RESET}. Skipping..." 1>&2
elif (dmidecode | grep -iq vmware); then
##### Install virtual machines tools ~ http://docs.kali.org/general-use/install-vmware-tools-kali-guest
echo -e "\n ${GREEN}[+]${RESET} Installing ${GREEN}virtual machine tools${RESET}"
#--- VM -> Install VMware Tools.
mkdir -p /mnt/cdrom/
umount -f /mnt/cdrom 2>/dev/null
sleep 2s
mount -o ro /dev/cdrom /mnt/cdrom 2>/dev/null; _mount="$?" # This will only check the first CD drive (if there are multiple bays)
sleep 2s
file=$(find /mnt/cdrom/ -maxdepth 1 -type f -name 'VMwareTools-*.tar.gz' -print -quit)
([[ "${_mount}" == 0 && -z "${file}" ]]) && echo -e ' '${RED}'[!]'${RESET}' Incorrect CD/ISO mounted' 1>&2
if [[ "${_mount}" == 0 && -n "${file}" ]]; then # If there is a CD in (and its right!), try to install native Guest Additions
echo -e ' '${YELLOW}'[i]'${RESET}' Patching & using "native VMware tools"'
apt-get -y -qq install make gcc "linux-headers-$(uname -r)" git sudo || echo -e ' '${RED}'[!] Issue with apt-get'${RESET} 1>&2
git clone -q https://github.com/rasa/vmware-tools-patches.git /tmp/vmware-tools-patches || echo -e ' '${RED}'[!] Issue with apt-get'${RESET} 1>&2
cp -f "${file}" /tmp/vmware-tools-patches/downloads/
pushd /tmp/vmware-tools-patches/ >/dev/null
bash untar-and-patch-and-compile.sh
popd >/dev/null
umount -f /mnt/cdrom 2>/dev/null
/usr/bin/vmware-user
else # The fallback is 'open vm tools' ~ http://open-vm-tools.sourceforge.net/about.php
echo -e " ${YELLOW}[i]${RESET} VMware Tools CD/ISO isn't mounted"
echo -e " ${YELLOW}[i]${RESET} Skipping 'Native VMware Tools', switching to 'Open VM Tools'"
apt-get -y -qq install open-vm-tools open-vm-tools-desktop open-vm-tools-dkms || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
apt-get -y -qq install make || echo -e ' '${RED}'[!] Issue with apt-get'${RESET} # nags afterwards
fi
elif [ -e "/etc/init.d/vboxadd" ]; then
echo -e "\n "${RED}'[!]'${RESET}" VirtualBox Guest Additions is ${RED}already installed${RESET}. Skipping..." 1>&2
elif (dmidecode | grep -iq virtualbox); then
##### (Optional) Installing Virtualbox Guest Additions. Note: Need VirtualBox 4.2.xx+ (http://docs.kali.org/general-use/kali-linux-virtual-box-guest)
echo -e "\n ${GREEN}[+]${RESET} (Optional) Installing ${GREEN}VirtualBox Guest Additions${RESET}"
#--- Devices -> Install Guest Additions CD image...
mkdir -p /mnt/cdrom/
umount -f /mnt/cdrom 2>/dev/null
sleep 2s
mount -o ro /dev/cdrom /mnt/cdrom 2>/dev/null; _mount=$? # Only checks first CD drive (if multiple)
sleep 2s
file=/mnt/cdrom/VBoxLinuxAdditions.run
if [[ "${_mount}" == 0 && -e "${file}" ]]; then
apt-get -y -qq install make gcc "linux-headers-$(uname -r)" || echo -e ' '${RED}'[!] Issue with apt-get'${RESET} 1>&2
cp -f "${file}" /tmp/
chmod -f 0755 /tmp/VBoxLinuxAdditions.run
/tmp/VBoxLinuxAdditions.run --nox11
umount -f /mnt/cdrom 2>/dev/null
#elif [[ "${_mount}" == 0 ]]; then
else
echo -e ' '${RED}'[!]'${RESET}' Incorrect CD/ISO mounted. Skipping...' 1>&2
#apt-get -y -qq install virtualbox-guest-x11
fi
fi
##### Check to see if there is a second Ethernet card (if so, set an static IP address)
ip addr show eth1 &>/dev/null
if [[ "$?" == 0 ]]; then
##### Set a static IP address (192.168.155.175/24) on eth1
echo -e "\n ${GREEN}[+]${RESET} Setting a ${GREEN}static IP address${RESET} (${BOLD}192.168.155.175/24${RESET}) on ${BOLD}eth1${RESET}"
ip addr add 192.168.155.175/24 dev eth1 2>/dev/null
route delete default gw 192.168.155.1 2>/dev/null
file=/etc/network/interfaces.d/eth1.cfg; [ -e "${file}" ] && cp -n $file{,.bkup}
grep -q '^iface eth1 inet static' "${file}" 2>/dev/null || cat <<EOF > "${file}"
auto eth1
iface eth1 inet static
address 192.168.155.175
netmask 255.255.255.0
gateway 192.168.155.1
post-up route delete default gw 192.168.155.1
EOF
fi
##### Set static & protecting DNS name servers. Note: May cause issues with forced values (e.g. captive portals etc)
if [ "${hardenDNS}" != "false" ]; then
echo -e "\n ${GREEN}[+]${RESET} Setting static & protecting ${GREEN}DNS name servers${RESET}"
file=/etc/resolv.conf; [ -e "${file}" ] && cp -n $file{,.bkup}
chattr -i "${file}" 2>/dev/null
#--- Remove duplicate results
#uniq "${file}" > "$file.new"; mv $file{.new,}
#--- Use OpenDNS DNS
#echo -e 'nameserver 208.67.222.222\nnameserver 208.67.220.220' > "${file}"
#--- Use Google DNS
echo -e 'nameserver 8.8.8.8\nnameserver 8.8.4.4' > "${file}"
#--- Add domain
#echo -e "domain ${domainName}\n#search ${domainName}" >> "${file}"
#--- Protect it
chattr +i "${file}" 2>/dev/null
else
echo -e "\n ${YELLOW}[i]${RESET} ${YELLOW}Skipping DNS${RESET} (missing: '$0 ${BOLD}--dns${RESET}')..." 1>&2
fi
##### Update location information - set either value to "" to skip.
echo -e "\n ${GREEN}[+]${RESET} Updating ${GREEN}location information${RESET}"
[ "${keyboardApple}" != "false" ] && echo -e "\n ${GREEN}[+]${RESET} Applying ${GREEN}Apple hardware${RESET} profile"
#keyboardLayout="gb" # Great Britain
#timezone="Europe/London" # London, Europe
#[ -z "${timezone}" ] && timezone=Etc/UTC #Etc/GMT vs Etc/UTC vs UTC vs Europe/London
#--- Configure keyboard layout
if [[ -n "${keyboardLayout}" ]]; then
echo -e "\n ${GREEN}[+]${RESET} Updating ${GREEN}location information${RESET} ~ keyboard layout (${BOLD}${keyboardLayout}${RESET})"
geoip_keyboard=$(curl -s http://ifconfig.io/country_code | tr '[:upper:]' '[:lower:]')
[ "${geoip_keyboard}" != "${keyboardLayout}" ] && echo -e " ${YELLOW}[i]${RESET} Keyboard layout (${BOLD}${keyboardLayout}${RESET}}) doesn't match what's been detected via GeoIP (${BOLD}${geoip_keyboard}${RESET}})"
file=/etc/default/keyboard; #[ -e "${file}" ] && cp -n $file{,.bkup}
sed -i 's/XKBLAYOUT=".*"/XKBLAYOUT="'${keyboardLayout}'"/' "${file}"
[ "${keyboardApple}" != "false" ] && sed -i 's/XKBVARIANT=".*"/XKBVARIANT="mac"/' "${file}" # Enable if you are using Apple based products.
#dpkg-reconfigure -f noninteractive keyboard-configuration #dpkg-reconfigure console-setup #dpkg-reconfigure keyboard-configuration -u # Need to restart xserver for effect
else
echo -e " ${YELLOW}[i]${RESET} ${YELLOW}Skipping keyboard layout${RESET} (missing: '$0 ${BOLD}--keyboard <value>${RESET}')..." 1>&2
fi
#--- Changing time zone
if [[ -n "${timezone}" ]]; then
echo -e "\n ${GREEN}[+]${RESET} Updating ${GREEN}location information${RESET} ~ time zone (${BOLD}${timezone}${RESET})"
echo "${timezone}" > /etc/timezone
ln -sf "/usr/share/zoneinfo/$(cat /etc/timezone)" /etc/localtime
dpkg-reconfigure -f noninteractive tzdata
else
echo -e " ${YELLOW}[i]${RESET} ${YELLOW}Skipping time zone${RESET} (missing: '$0 ${BOLD}--timezone <value>${RESET}')..." 1>&2
fi
#--- Setting locale # Can't do due to user input
#sed -i 's/^# en_/en_/' /etc/locale.gen #en_GB en_US
#locale-gen
##echo -e 'LC_ALL=en_US.UTF-8\nLANG=en_US.UTF-8\nLANGUAGE=en_US:en' > /etc/default/locale
#dpkg-reconfigure -f noninteractive tzdata
##locale -a # Check
#--- Installing ntp
apt-get -y -qq install ntp ntpdate || echo -e ' '${RED}'[!] Issue with apt-get'${RESET} 1>&2
#--- Configuring ntp
#file=/etc/default/ntp; [ -e "${file}" ] && cp -n $file{,.bkup}
#grep -q "interface=127.0.0.1" "${file}" || sed -i "s/NTPD_OPTS='/NTPD_OPTS='--interface=127.0.0.1 /" "${file}"
#--- Update time
ntpdate -b -s -u pool.ntp.org
#--- Start service
systemctl restart ntp
#--- Remove from start up
systemctl disable ntp 2>/dev/null
#--- Check
#date
#--- Only used for stats at the end
start_time=$(date +%s)
if [ "${freezeDEB}" != "false" ]; then
##### Don't ever update these packages
echo -e "\n ${GREEN}[+]${RESET} ${GREEN}Don't update${RESET} these packages:"
for x in metasploit-framework; do
echo -e " ${YELLOW}[i]${RESET} + ${x}"
echo "${x} hold" | dpkg --set-selections # To update: echo "{$} install" | dpkg --set-selections
done
fi
if [ "${rolling}" != "false" ]; then
##### Enable default network repositories ~ http://docs.kali.org/general-use/kali-linux-sources-list-repositories
echo -e "\n ${GREEN}[+]${RESET} Enabling ${GREEN}rolling repositories${RESET} ~ ${BOLD}Should only be used by advanced users${RESET}! Using this means tools will be updated more frequently"
#--- Add network repositories
file=/etc/apt/sources.list; [ -e "${file}" ] && cp -n $file{,.bkup}
([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
#--- Enable Rolling
([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
grep -q 'deb .* kali-rolling main contrib non-free' "${file}" 2>/dev/null || echo -e "\n\n# Kali Rolling\ndeb http://http.kali.org/kali kali-rolling main contrib non-free" >> "${file}"
grep -q 'deb-src .* kali-rolling main contrib non-free' "${file}" 2>/dev/null || echo -e "deb-src http://http.kali.org/kali kali-rolling main contrib non-free" >> "${file}"
#grep -q 'sana-proposed-updates main contrib non-free' "${file}" 2>/dev/null || echo -e "deb http://repo.kali.org/kali sana-proposed-updates main contrib non-free\ndeb-src http://repo.kali.org/kali sana-proposed-updates main contrib non-free" >> "${file}"
#--- Disable main repo
sed -i 's_deb http://http.kali.org/kali sana main_#deb http://http.kali.org/kali sana main_' ${file}
sed -i 's_deb-src http://http.kali.org/kali sana main_#deb-src http://http.kali.org/kali sana main_' ${file}
#--- Update
apt-get -qq update
if [[ "$?" -ne 0 ]]; then
echo -e ' '${RED}'[!]'${RESET}" There was an ${RED}issue accessing network repositories${RESET}" 1>&2
echo -e " ${YELLOW}[i]${RESET} Are the remote network repositories ${YELLOW}currently being sync'd${RESET}?"
echo -e " ${YELLOW}[i]${RESET} YOUR ${YELLOW}network repositories information${RESET}:"
curl -sI http://http.kali.org/README
exit 1
fi
fi
##### Update OS from network repositories
echo -e "\n ${GREEN}[+]${RESET} ${GREEN}Updating OS${RESET} from network repositories ~ this ${BOLD}may take a while${RESET} depending on your Internet connection & Kali version/age"
for FILE in clean autoremove; do apt-get -y -qq "${FILE}"; done # Clean up clean remove autoremove autoclean
export DEBIAN_FRONTEND=noninteractive
apt-get -qq update && APT_LISTCHANGES_FRONTEND=none apt-get -o Dpkg::Options::="--force-confnew" -y dist-upgrade --fix-missing || echo -e ' '${RED}'[!] Issue with apt-get'${RESET} 1>&2
#--- Cleaning up temp stuff
for FILE in clean autoremove; do apt-get -y -qq "${FILE}"; done # Clean up - clean remove autoremove autoclean
#--- Enable bleeding edge ~ http://www.kali.org/kali-monday/bleeding-edge-kali-repositories/
#file=/etc/apt/sources.list; [ -e "${file}" ] && cp -n $file{,.bkup}
#grep -q 'kali-bleeding-edge' "${file}" 2>/dev/null || echo -e "\n\n## Bleeding edge\ndeb http://repo.kali.org/kali sana-bleeding-edge main" >> "${file}"
#apt-get -qq update && apt-get -y -qq upgrade
#--- Check kernel stuff
_TMP=$(dpkg -l | grep linux-image- | grep -vc meta)
if [[ "${_TMP}" -gt 1 ]]; then
echo -e "\n ${YELLOW}[i]${RESET} Detected multiple kernels installed"
TMP=$(dpkg -l | grep linux-image | grep -v meta | sort -t '.' -k 2 -g | tail -n 1 | grep "$(uname -r)")
[[ -z "${_TMP}" ]] && echo -e ' '${RED}'[!]'${RESET}' You are '${RED}'not using the latest kernel'${RESET} 1>&2 && echo -e " ${YELLOW}[i]${RESET} You have it downloaded & installed, ${YELLOW}just not using it${RESET}. You ${YELLOW}need to reboot${RESET}" && exit 1
echo -e " ${YELLOW}[i]${RESET} Clean up: apt-get remove --purge $(dpkg -l 'linux-image-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d')" # DO NOT RUN IF NOT USING THE LASTEST KERNEL!
fi
##### Install "kali full" meta packages (default tool selection)
echo -e "\n ${GREEN}[+]${RESET} Installing ${GREEN}kali-linux-full${RESET} meta-package ~ this ${BOLD}may take a while${RESET} depending on your Kali version (e.g. ARM, light, mini or docker...)"
#--- Kali's default tools ~ https://www.kali.org/news/kali-linux-metapackages/
apt-get -y -qq install kali-linux-full || echo -e ' '${RED}'[!] Issue with apt-get'${RESET} 1>&2
##### Fix audio issues
echo -e "\n ${GREEN}[+]${RESET} Fixing ${GREEN}audio${RESET} issues"
#--- Unmute on startup
apt-get -y -qq install alsa-utils || echo -e ' '${RED}'[!] Issue with apt-get'${RESET} 1>&2
#--- Set volume now
amixer set Master unmute >/dev/null
amixer set Master 50% >/dev/null
##### Configure GRUB
echo -e "\n ${GREEN}[+]${RESET} Configuring ${GREEN}GRUB${RESET} ~ boot manager"
grubTimeout=5
(dmidecode | grep -iq virtual) && grubTimeout=1 # Much less if we are in a VM
file=/etc/default/grub; [ -e "${file}" ] && cp -n $file{,.bkup}
sed -i 's/^GRUB_TIMEOUT=.*/GRUB_TIMEOUT='${grubTimeout}'/' "${file}" # Time out (lower if in a virtual machine, else possible dual booting)
sed -i 's/^GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT=""/' "${file}" # TTY resolution #GRUB_CMDLINE_LINUX_DEFAULT="vga=0x0318 quiet" (crashes VM/vmwgfx) (See Cosmetics)
update-grub
###### Disable login manager (console login - non GUI) ***
#echo -e "\n ${GREEN}[+]${RESET} ${GREEN}Disabling GUI${RESET} login screen"
#--- Disable GUI login screen
#systemctl set-default multi-user.target # ...or: file=/etc/X11/default-display-manager; [ -e "${file}" ] && cp -n $file{,.bkup} ; echo /bin/true > "${file}" # ...or: mv -f /etc/rc2.d/S19gdm3 /etc/rc2.d/K17gdm # ...or: apt-get -y -qq install chkconfig; chkconfig gdm3 off
#--- Enable auto (gui) login
#file=/etc/gdm3/daemon.conf; [ -e "${file}" ] && cp -n $file{,.bkup}
#sed -i 's/^.*AutomaticLoginEnable = .*/AutomaticLoginEnable = true/' "${file}"
#sed -i 's/^.*AutomaticLogin = .*/AutomaticLogin = root/' "${file}"
#--- Shortcut for when you want to start GUI
[ -e /usr/sbin/gdm3 ] && ln -sf /usr/sbin/gdm3 /usr/bin/startx
###### Configure startup ***
#echo -e "\n ${GREEN}[+]${RESET} Configuring ${GREEN}startup${RESET} ~ randomize the hostname, eth0 & wlan0s MAC address"
#--- Start up
#file=/etc/rc.local; [ -e "${file}" ] && cp -n $file{,.bkup}
#grep -q "macchanger" "${file}" 2>/dev/null || sed -i "s#^exit 0#for INT in eth0 wlan0; do\n $(which ip) link set \${INT} down\n $(which macchanger) -r \${INT} \&\& $(which sleep) 3s\n $(which ip) link set \${INT} up\ndone\n\n\nexit 0#" "${file}"
#grep -q "hostname" "${file}" 2>/dev/null || sed -i "s#^exit 0#echo \$($(which cat) /dev/urandom | $(which tr) -dc 'A-Za-z' | $(which head) -c8) > /etc/hostname\nexit 0#" "${file}"
#--- On demand
file=/usr/local/bin/mac-rand; [ -e "${file}" ] && cp -n $file{,.bkup}
cat <<EOF > "${file}" || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
#!/bin/bash
for INT in eth0 wlan0; do
echo "[i] Randomizing: \${INT}"
ifconfig \${INT} down
macchanger -r \${INT} && sleep 3s
ifconfig \${INT} up
echo "--------------------"
done
exit 0
EOF
chmod -f 0500 "${file}"
#--- Auto on interface change state (untested)
#file=/etc/network/if-pre-up.d/macchanger; [ -e "${file}" ] && cp -n $file{,.bkup}
#cat <<EOF > "${file}" || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
##!/bin/bash
#[ "\${IFACE}" == "lo" ] && exit 0
#ifconfig \${IFACE} down
#macchanger -r \${IFACE}
#ifconfig \${IFACE} up
#exit 0
#EOF
#chmod -f 0500 "${file}"
#--- Disable random MAC address on start up
rm -f /etc/network/if-pre-up.d/macchanger
if [[ $(which gnome-shell) ]]; then
##### Configure GNOME 3
echo -e "\n ${GREEN}[+]${RESET} Configuring ${GREEN}GNOME 3${RESET} ~ desktop environment"
export DISPLAY=:0.0 #[[ -z $SSH_CONNECTION ]] || export DISPLAY=:0.0
#-- Gnome Extension - Frippery (https://extensions.gnome.org/extension/13/applications-menu/) *** TaskBar has more features
mkdir -p ~/.local/share/gnome-shell/extensions/
timeout 300 curl --progress -k -L -f "http://frippery.org/extensions/gnome-shell-frippery-0.9.3.tgz" > /tmp/frippery.tgz || echo -e ' '${RED}'[!]'${RESET}" Issue downloading frippery.tgz" 1>&2
tar -zxf /tmp/frippery.tgz -C ~/
#-- Gnome Extension - TopIcons (https://extensions.gnome.org/extension/495/topicons/) # Doesn't work with v3.10
#mkdir -p ~/.local/share/gnome-shell/extensions/topIcons@adel.gadllah@gmail.com/
#curl --progress -k -L -f "https://extensions.gnome.org/review/download/2236.shell-extension.zip" > /tmp/topIcons.zip || echo -e ' '${RED}'[!]'${RESET}" Issue downloading topIcons.zip" 1>&2
#unzip -q -o /tmp/topIcons.zip -d ~/.local/share/gnome-shell/extensions/topIcons@adel.gadllah@gmail.com/
#sed -i 's/"shell-version": \[$/"shell-version": \[ "3.10",/' ~/.local/share/gnome-shell/extensions/topIcons@adel.gadllah@gmail.com/metadata.json
#-- Gnome Extension - icon-hider (https://github.com/ikalnitsky/gnome-shell-extension-icon-hider)
mkdir -p "/usr/share/gnome-shell/extensions/"
git clone -q https://github.com/ikalnitsky/gnome-shell-extension-icon-hider.git /usr/share/gnome-shell/extensions/icon-hider@kalnitsky.org/ || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
#-- Gnome Extension - Disable Screen Shield (https://extensions.gnome.org/extension/672/disable-screen-shield/) # Doesn't work with v3.10
#mkdir -p "/usr/share/gnome-shell/extensions/"
#git clone -q https://github.com/lgpasquale/gnome-shell-extension-disable-screenshield.git /usr/share/gnome-shell/extensions/disable-screenshield@lgpasquale.com/ || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
#-- Gnome Extension - TaskBar (https://extensions.gnome.org/extension/584/taskbar/)
mkdir -p "/usr/share/gnome-shell/extensions/"
git clone -q https://github.com/zpydr/gnome-shell-extension-taskbar.git /usr/share/gnome-shell/extensions/TaskBar@zpydr/ || echo -e ' '${RED}'[!] Issue when git cloning'${RESET} 1>&2
#--- Gnome Extensions (Enable)
for EXTENSION in "alternate-tab@gnome-shell-extensions.gcampax.github.com" "drive-menu@gnome-shell-extensions.gcampax.github.com" "TaskBar@zpydr" "Bottom_Panel@rmy.pobox.com" "Panel_Favorites@rmy.pobox.com" "Move_Clock@rmy.pobox.com" "icon-hider@kalnitsky.org"; do
GNOME_EXTENSIONS=$(gsettings get org.gnome.shell enabled-extensions | sed 's_^.\(.*\).$_\1_')
echo "${GNOME_EXTENSIONS}" | grep -q "${EXTENSION}" || gsettings set org.gnome.shell enabled-extensions "[${GNOME_EXTENSIONS}, '${EXTENSION}']"
done
#--- Gnome Extensions (Disable)
for EXTENSION in "dash-to-dock@micxgx.gmail.com" "workspace-indicator@gnome-shell-extensions.gcampax.github.com"; do
GNOME_EXTENSIONS=$(gsettings get org.gnome.shell enabled-extensions | sed "s_^.\(.*\).\$_\1_; s_, '${EXTENSION}'__")
gsettings set org.gnome.shell enabled-extensions "[${GNOME_EXTENSIONS}]"
done
#--- Dash Dock (even though it should be disabled)
dconf write /org/gnome/shell/extensions/dash-to-dock/dock-fixed true
#--- TaskBar (Global)
dconf write /org/gnome/shell/extensions/TaskBar/first-start false
#--- TaskBar (without Frippery) ~ gsettings set org.gnome.shell enabled-extensions "[$( gsettings get org.gnome.shell enabled-extensions | sed "s_^.\(.*\).\$_\1_; s#, 'Bottom_Panel@rmy.pobox.com'##; s#, 'Panel_Favorites@rmy.pobox.com'##; s#, 'Move_Clock@rmy.pobox.com'##" )]"
#dconf write /org/gnome/shell/extensions/TaskBar/bottom-panel true
#dconf write /org/gnome/shell/extensions/TaskBar/display-favorites true
#dconf write /org/gnome/shell/extensions/TaskBar/hide-default-application-menu true
#dconf write /org/gnome/shell/extensions/TaskBar/display-showapps-button false
#dconf write /org/gnome/shell/extensions/TaskBar/appearance-selection "'showappsbutton'"
#dconf write /org/gnome/shell/extensions/TaskBar/overview true
#dconf write /org/gnome/shell/extensions/TaskBar/position-appview-button 2
#dconf write /org/gnome/shell/extensions/TaskBar/position-desktop-button 0
#dconf write /org/gnome/shell/extensions/TaskBar/position-favorites 3
#dconf write /org/gnome/shell/extensions/TaskBar/position-max-right 4
#dconf write /org/gnome/shell/extensions/TaskBar/position-tasks 4
#dconf write /org/gnome/shell/extensions/TaskBar/position-workspace-button 1
#dconf write /org/gnome/shell/extensions/TaskBar/separator-two true
#dconf write /org/gnome/shell/extensions/TaskBar/separator-three true
#dconf write /org/gnome/shell/extensions/TaskBar/separator-four true
#dconf write /org/gnome/shell/extensions/TaskBar/separator-five true
#dconf write /org/gnome/shell/extensions/TaskBar/separator-six true
#dconf write /org/gnome/shell/extensions/TaskBar/separator-three-bottom true
#dconf write /org/gnome/shell/extensions/TaskBar/separator-five-bottom true
#dconf write /org/gnome/shell/extensions/TaskBar/appview-button-icon "'/usr/share/gnome-shell/extensions/TaskBar@zpydr/images/appview-button-default.svg'"
#dconf write /org/gnome/shell/extensions/TaskBar/desktop-button-icon "'/usr/share/gnome-shell/extensions/TaskBar@zpydr/images/desktop-button-default.png'"
#dconf write /org/gnome/shell/extensions/TaskBar/tray-button-icon "'/usr/share/gnome-shell/extensions/TaskBar@zpydr/images/bottom-panel-tray-button.svg'"
#--- TaskBar (with Frippery)
dconf write /org/gnome/shell/extensions/TaskBar/hide-default-application-menu true
dconf write /org/gnome/shell/extensions/TaskBar/bottom-panel false
dconf write /org/gnome/shell/extensions/TaskBar/display-favorites false
dconf write /org/gnome/shell/extensions/TaskBar/display-desktop-button false
dconf write /org/gnome/shell/extensions/TaskBar/display-showapps-button false
dconf write /org/gnome/shell/extensions/TaskBar/display-tasks false
dconf write /org/gnome/shell/extensions/TaskBar/display-workspace-button false
dconf write /org/gnome/shell/extensions/TaskBar/overview false
dconf write /org/gnome/shell/extensions/TaskBar/separator-two false
dconf write /org/gnome/shell/extensions/TaskBar/separator-three false
dconf write /org/gnome/shell/extensions/TaskBar/separator-four false
dconf write /org/gnome/shell/extensions/TaskBar/separator-five false
dconf write /org/gnome/shell/extensions/TaskBar/separator-six false
#--- Workspaces
gsettings set org.gnome.shell.overrides dynamic-workspaces false
gsettings set org.gnome.desktop.wm.preferences num-workspaces 3
#--- Top bar
gsettings set org.gnome.desktop.interface clock-show-date true # Show date next to time
#--- Dock settings
gsettings set org.gnome.shell.extensions.dash-to-dock extend-height true # Set dock to use the full height
gsettings set org.gnome.shell.extensions.dash-to-dock dock-position 'RIGHT' # Set dock to the right
gsettings set org.gnome.shell.extensions.dash-to-dock dock-fixed true # Set dock to be always visible
gsettings set org.gnome.shell favorite-apps "['gnome-terminal.desktop', 'org.gnome.Nautilus.desktop', 'iceweasel.desktop', 'kali-burpsuite.desktop', 'kali-msfconsole.desktop', 'geany.desktop']"
#--- Keyboard shortcuts
(dmidecode | grep -iq virtual) && gsettings set org.gnome.mutter overlay-key "Super_R" # Change 'super' key to right side (rather than left key)
#--- Disable tracker service (But enables it in XFCE)
gsettings set org.freedesktop.Tracker.Miner.Files crawling-interval -2
gsettings set org.freedesktop.Tracker.Miner.Files enable-monitors false
tracker-control -r
#mkdir -p ~/.config/autostart/
#cp -f /etc/xdg/autostart/tracker* ~/.config/autostart
#sed -i 's/X-GNOME-Autostart-enabled=.*/X-GNOME-Autostart-enabled=false/' ~/.config/autostart/tracker*
#--- Smaller title bar
gsettings set org.gnome.desktop.wm.preferences titlebar-font "'Droid Bold 10'"
gsettings set org.gnome.desktop.wm.preferences titlebar-uses-system-font false
#--- Hide desktop icon
dconf write /org/gnome/nautilus/desktop/computer-icon-visible false
#--- Cosmetics - Change wallpaper & login (happens later)
#cp -f /path/to/file.png /usr/share/images/desktop-base/kali-grub.png # Change grub boot
#dconf write /org/gnome/desktop/screensaver/picture-uri "'file:///path/to/file.png'" # Change lock wallpaper (before swipe)
#cp -f /path/to/file.png /usr/share/gnome-shell/theme/KaliLogin.png # Change login wallpaper (after swipe)
#dconf write /org/gnome/desktop/background/picture-uri "'file:///path/to/file.png'" # Change desktop wallpaper
gsettings set org.gnome.desktop.session idle-delay 0 # Disable swipe on lockscreen
#--- Restart GNOME panel to apply/take effect (need to restart xserver for effect)
#timeout 30 killall -q -w gnome-panel >/dev/null && gnome-shell --replace& # Still need to logoff!
#reboot
fi
##### Install XFCE4
echo -e "\n ${GREEN}[+]${RESET} Installing ${GREEN}XFCE4${RESET}${RESET} ~ desktop environment"
export DISPLAY=:0.0 #[[ -z $SSH_CONNECTION ]] || export DISPLAY=:0.0
apt-get -y -qq install curl || echo -e ' '${RED}'[!] Issue with apt-get'${RESET} 1>&2
apt-get -y -qq install xfce4 xfce4-places-plugin || echo -e ' '${RED}'[!] Issue with apt-get'${RESET} #xfce4-goodies xfce4-battery-plugin xfce4-mount-plugin
#apt-get -y -qq install shiki-colors-xfwm-theme # theme from repos
#--- Configuring XFCE
mv -f /usr/bin/startx{,-gnome}
ln -sf /usr/bin/startx{fce4,}
mkdir -p ~/.config/xfce4/{desktop,menu,panel,xfconf,xfwm4}/
mkdir -p ~/.config/xfce4/panel/launcher-{2,4,5,6,8,9}/
mkdir -p ~/.config/xfce4/xfconf/xfce-perchannel-xml/
cat <<EOF > ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
<?xml version="1.0" encoding="UTF-8"?>
<channel name="xfce4-keyboard-shortcuts" version="1.0">
<property name="commands" type="empty">
<property name="custom" type="empty">
<property name="XF86Display" type="string" value="xfce4-display-settings --minimal"/>
<property name="<Alt>F2" type="string" value="xfrun4"/>
<property name="<Primary><Alt>t" type="string" value="/usr/bin/exo-open --launch TerminalEmulator"/>
<property name="<Primary><Alt>Delete" type="string" value="xflock4"/>
<property name="<Primary>Escape" type="string" value="xfdesktop --menu"/>
<property name="<Super>p" type="string" value="xfce4-display-settings --minimal"/>
<property name="override" type="bool" value="true"/>
<property name="<Primary>space" type="string" value="xfce4-appfinder"/>
</property>
</property>
<property name="xfwm4" type="empty">
<property name="custom" type="empty">
<property name="<Alt><Control>End" type="string" value="move_window_next_workspace_key"/>
<property name="<Alt><Control>Home" type="string" value="move_window_prev_workspace_key"/>
<property name="<Alt><Control>KP_1" type="string" value="move_window_workspace_1_key"/>
<property name="<Alt><Control>KP_2" type="string" value="move_window_workspace_2_key"/>
<property name="<Alt><Control>KP_3" type="string" value="move_window_workspace_3_key"/>
<property name="<Alt><Control>KP_4" type="string" value="move_window_workspace_4_key"/>
<property name="<Alt><Control>KP_5" type="string" value="move_window_workspace_5_key"/>
<property name="<Alt><Control>KP_6" type="string" value="move_window_workspace_6_key"/>
<property name="<Alt><Control>KP_7" type="string" value="move_window_workspace_7_key"/>
<property name="<Alt><Control>KP_8" type="string" value="move_window_workspace_8_key"/>
<property name="<Alt><Control>KP_9" type="string" value="move_window_workspace_9_key"/>
<property name="<Alt><Shift>Tab" type="string" value="cycle_reverse_windows_key"/>
<property name="<Alt>Delete" type="string" value="del_workspace_key"/>
<property name="<Alt>F10" type="string" value="maximize_window_key"/>
<property name="<Alt>F11" type="string" value="fullscreen_key"/>
<property name="<Alt>F12" type="string" value="above_key"/>
<property name="<Alt>F4" type="string" value="close_window_key"/>
<property name="<Alt>F6" type="string" value="stick_window_key"/>
<property name="<Alt>F7" type="string" value="move_window_key"/>
<property name="<Alt>F8" type="string" value="resize_window_key"/>
<property name="<Alt>F9" type="string" value="hide_window_key"/>
<property name="<Alt>Insert" type="string" value="add_workspace_key"/>
<property name="<Alt>space" type="string" value="popup_menu_key"/>
<property name="<Alt>Tab" type="string" value="cycle_windows_key"/>
<property name="<Control><Alt>d" type="string" value="show_desktop_key"/>
<property name="<Control><Alt>Down" type="string" value="down_workspace_key"/>
<property name="<Control><Alt>Left" type="string" value="left_workspace_key"/>
<property name="<Control><Alt>Right" type="string" value="right_workspace_key"/>
<property name="<Control><Alt>Up" type="string" value="up_workspace_key"/>
<property name="<Control><Shift><Alt>Left" type="string" value="move_window_left_key"/>
<property name="<Control><Shift><Alt>Right" type="string" value="move_window_right_key"/>
<property name="<Control><Shift><Alt>Up" type="string" value="move_window_up_key"/>
<property name="<Control>F1" type="string" value="workspace_1_key"/>
<property name="<Control>F10" type="string" value="workspace_10_key"/>
<property name="<Control>F11" type="string" value="workspace_11_key"/>
<property name="<Control>F12" type="string" value="workspace_12_key"/>
<property name="<Control>F2" type="string" value="workspace_2_key"/>
<property name="<Control>F3" type="string" value="workspace_3_key"/>
<property name="<Control>F4" type="string" value="workspace_4_key"/>
<property name="<Control>F5" type="string" value="workspace_5_key"/>
<property name="<Control>F6" type="string" value="workspace_6_key"/>
<property name="<Control>F7" type="string" value="workspace_7_key"/>
<property name="<Control>F8" type="string" value="workspace_8_key"/>
<property name="<Control>F9" type="string" value="workspace_9_key"/>
<property name="<Shift><Alt>Page_Down" type="string" value="lower_window_key"/>
<property name="<Shift><Alt>Page_Up" type="string" value="raise_window_key"/>
<property name="<Super>Tab" type="string" value="switch_window_key"/>
<property name="Down" type="string" value="down_key"/>
<property name="Escape" type="string" value="cancel_key"/>
<property name="Left" type="string" value="left_key"/>
<property name="Right" type="string" value="right_key"/>
<property name="Up" type="string" value="up_key"/>
<property name="override" type="bool" value="true"/>
<property name="<Super>Left" type="string" value="tile_left_key"/>
<property name="<Super>Right" type="string" value="tile_right_key"/>
<property name="<Super>Up" type="string" value="maximize_window_key"/>
</property>
</property>
<property name="providers" type="array">
<value type="string" value="xfwm4"/>
<value type="string" value="commands"/>
</property>
</channel>
EOF
cat <<EOF > ~/.config/xfce4/panel/launcher-2/13684522758.desktop || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
[Desktop Entry]
Name=Terminal Emulator
Encoding=UTF-8
Exec=exo-open --launch TerminalEmulator
Icon=utilities-terminal
StartupNotify=false
Terminal=false
Comment=Use the command line
Type=Application
Categories=Utility;X-XFCE;X-Xfce-Toplevel;
X-XFCE-Source=file:///usr/share/applications/exo-terminal-emulator.desktop
EOF
cat <<EOF > ~/.config/xfce4/panel/launcher-4/14470234761.desktop || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
[Desktop Entry]
Name=wireshark
Encoding=UTF-8
Exec=sh -c "wireshark"
Icon=wireshark
StartupNotify=false
Terminal=false
Type=Application
Categories=09-sniffing-spoofing;
X-Kali-Package=wireshark
X-XFCE-Source=file:///usr/share/applications/kali-wireshark.desktop
EOF
cat <<EOF > ~/.config/xfce4/panel/launcher-5/14470234962.desktop || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
[Desktop Entry]
Name=burpsuite
Encoding=UTF-8
Exec=sh -c "java -jar /usr/bin/burpsuite"
Icon=burpsuite
StartupNotify=false
Terminal=false
Type=Application
Categories=03-webapp-analysis;03-06-web-application-proxies;
X-Kali-Package=burpsuite
X-XFCE-Source=file:///usr/share/applications/kali-burpsuite.desktop
EOF
cat <<EOF > ~/.config/xfce4/panel/launcher-6/13684522587.desktop || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
[Desktop Entry]
Name=Iceweasel
Encoding=UTF-8
Exec=iceweasel %u
Icon=iceweasel
StartupNotify=true
Terminal=false
Comment=Browse the World Wide Web
GenericName=Web Browser
X-GNOME-FullName=Iceweasel Web Browser
X-MultipleArgs=false
Type=Application
Categories=Network;WebBrowser;
MimeType=text/html;text/xml;application/xhtml+xml;application/xml;application/vnd.mozilla.xul+xml;application/rss+xml;application/rdf+xml;image/gif;image/jpeg;image/png;x-scheme-handler/http;x-scheme-handler/https;
StartupWMClass=Iceweasel
X-XFCE-Source=file:///usr/share/applications/iceweasel.desktop
EOF
cat <<EOF > ~/.config/xfce4/panel/launcher-8/13684522859.desktop || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
[Desktop Entry]
Name=Geany
Encoding=UTF-8
Exec=geany %F
Icon=geany
StartupNotify=true
Terminal=false
Comment=A fast and lightweight IDE using GTK2
GenericName=Integrated Development Environment
Type=Application
Categories=GTK;Development;IDE;
MimeType=text/plain;text/x-chdr;text/x-csrc;text/x-c++hdr;text/x-c++src;text/x-java;text/x-dsrc;text/x-pascal;text/x-perl;text/x-python;application/x-php;application/x-httpd-php3;application/x-httpd-php4;application/x-httpd-php5;application/xml;text/html;text/css;text/x-sql;text/x-diff;
X-XFCE-Source=file:///usr/share/applications/geany.desktop
EOF
cat <<EOF > ~/.config/xfce4/panel/launcher-9/136845425410.desktop || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
[Desktop Entry]
Name=Application Finder
Exec=xfce4-appfinder
Icon=xfce4-appfinder
StartupNotify=true
Terminal=false
Type=Application
Categories=X-XFCE;Utility;
Comment=Find and launch applications installed on your system
X-XFCE-Source=file:///usr/share/applications/xfce4-appfinder.desktop
EOF
_TMP=""
[ "${burpFree}" != "false" ] && _TMP="-t int -s 5"
xfconf-query -n -a -c xfce4-panel -p /panels -t int -s 0
xfconf-query --create --channel xfce4-panel --property /panels/panel-0/plugin-ids \
-t int -s 1 -t int -s 2 -t int -s 3 -t int -s 4 ${_TMP} -t int -s 6 -t int -s 8 -t int -s 9 \
-t int -s 10 -t int -s 11 -t int -s 13 -t int -s 15 -t int -s 16 -t int -s 17 -t int -s 19 -t int -s 20
xfconf-query -n -c xfce4-panel -p /panels/panel-0/length -t int -s 100
xfconf-query -n -c xfce4-panel -p /panels/panel-0/size -t int -s 30
xfconf-query -n -c xfce4-panel -p /panels/panel-0/position -t string -s "p=6;x=0;y=0"
xfconf-query -n -c xfce4-panel -p /panels/panel-0/position-locked -t bool -s true
xfconf-query -n -c xfce4-panel -p /plugins/plugin-1 -t string -s applicationsmenu # application menu
xfconf-query -n -c xfce4-panel -p /plugins/plugin-2 -t string -s launcher # terminal ID: 13684522758
xfconf-query -n -c xfce4-panel -p /plugins/plugin-3 -t string -s places # places
xfconf-query -n -c xfce4-panel -p /plugins/plugin-4 -t string -s launcher # wireshark ID: 14470234761
[ "${burpFree}" != "false" ] && xfconf-query -n -c xfce4-panel -p /plugins/plugin-5 -t string -s launcher # burpsuite ID: 14470234962
xfconf-query -n -c xfce4-panel -p /plugins/plugin-6 -t string -s launcher # iceweasel ID: 13684522587
xfconf-query -n -c xfce4-panel -p /plugins/plugin-8 -t string -s launcher # geany ID: 13684522859 (geany gets installed later)
xfconf-query -n -c xfce4-panel -p /plugins/plugin-9 -t string -s launcher # search ID: 136845425410
xfconf-query -n -c xfce4-panel -p /plugins/plugin-10 -t string -s tasklist
xfconf-query -n -c xfce4-panel -p /plugins/plugin-11 -t string -s separator
xfconf-query -n -c xfce4-panel -p /plugins/plugin-13 -t string -s mixer # audio
xfconf-query -n -c xfce4-panel -p /plugins/plugin-15 -t string -s systray
xfconf-query -n -c xfce4-panel -p /plugins/plugin-16 -t string -s actions
xfconf-query -n -c xfce4-panel -p /plugins/plugin-17 -t string -s clock
xfconf-query -n -c xfce4-panel -p /plugins/plugin-19 -t string -s pager
xfconf-query -n -c xfce4-panel -p /plugins/plugin-20 -t string -s showdesktop
# application menu
xfconf-query -n -c xfce4-panel -p /plugins/plugin-1/show-tooltips -t bool -s true
xfconf-query -n -c xfce4-panel -p /plugins/plugin-1/show-button-title -t bool -s false
# terminal
xfconf-query -n -c xfce4-panel -p /plugins/plugin-2/items -t string -s "13684522758.desktop" -a
# places
xfconf-query -n -c xfce4-panel -p /plugins/plugin-3/mount-open-volumes -t bool -s true
# wireshark
xfconf-query -n -c xfce4-panel -p /plugins/plugin-4/items -t string -s "14470234761.desktop" -a
# burp
[ "${burpFree}" != "false" ] && xfconf-query -n -c xfce4-panel -p /plugins/plugin-5/items -t string -s "14470234962.desktop" -a
# iceweasel
xfconf-query -n -c xfce4-panel -p /plugins/plugin-6/items -t string -s "13684522587.desktop" -a
# geany
xfconf-query -n -c xfce4-panel -p /plugins/plugin-8/items -t string -s "13684522859.desktop" -a
# search
xfconf-query -n -c xfce4-panel -p /plugins/plugin-9/items -t string -s "136845425410.desktop" -a
# tasklist (& separator - required for padding)
xfconf-query -n -c xfce4-panel -p /plugins/plugin-10/show-labels -t bool -s true
xfconf-query -n -c xfce4-panel -p /plugins/plugin-10/show-handle -t bool -s false
xfconf-query -n -c xfce4-panel -p /plugins/plugin-11/style -t int -s 0
xfconf-query -n -c xfce4-panel -p /plugins/plugin-11/expand -t bool -s true
# systray
xfconf-query -n -c xfce4-panel -p /plugins/plugin-15/show-frame -t bool -s false
# actions
xfconf-query -n -c xfce4-panel -p /plugins/plugin-16/appearance -t int -s 1
xfconf-query -n -c xfce4-panel -p /plugins/plugin-16/items -t string -s "+logout-dialog" -t string -s "-switch-user" -t string -s "-separator" -t string -s "-logout" -t string -s "+lock-screen" -t string -s "+hibernate" -t string -s "+suspend" -t string -s "+restart" -t string -s "+shutdown" -a
# clock
xfconf-query -n -c xfce4-panel -p /plugins/plugin-17/show-frame -t bool -s false
xfconf-query -n -c xfce4-panel -p /plugins/plugin-17/mode -t int -s 2
xfconf-query -n -c xfce4-panel -p /plugins/plugin-17/digital-format -t string -s "%R, %Y-%m-%d"
# pager / workspace
xfconf-query -n -c xfce4-panel -p /plugins/plugin-19/miniature-view -t bool -s true
xfconf-query -n -c xfce4-panel -p /plugins/plugin-19/rows -t int -s 1
xfconf-query -n -c xfwm4 -p /general/workspace_count -t int -s 3
#--- Theme options
xfconf-query -n -c xsettings -p /Net/ThemeName -s "Kali-X"
xfconf-query -n -c xsettings -p /Net/IconThemeName -s "Vibrancy-Kali"
xfconf-query -n -c xsettings -p /Gtk/MenuImages -t bool -s true
xfconf-query -n -c xfce4-panel -p /plugins/plugin-1/button-icon -t string -s "kali-menu"
#--- Window management
xfconf-query -n -c xfwm4 -p /general/snap_to_border -t bool -s true
xfconf-query -n -c xfwm4 -p /general/snap_to_windows -t bool -s true
xfconf-query -n -c xfwm4 -p /general/wrap_windows -t bool -s false
xfconf-query -n -c xfwm4 -p /general/wrap_workspaces -t bool -s false
xfconf-query -n -c xfwm4 -p /general/click_to_focus -t bool -s false
#--- TouchPad
#xfconf-query -n -c pointers -p /SynPS2_Synaptics_TouchPad/Properties/Synaptics_Edge_Scrolling -t int -s 0 -t int -s 0 -t int -s 0
#xfconf-query -n -c pointers -p /SynPS2_Synaptics_TouchPad/Properties/Synaptics_Tap_Action -t int -s 0 -t int -s 0 -t int -s 0 -t int -s 0 -t int -s 0 -t int -s 0 -t int -s 0
#xfconf-query -n -c pointers -p /SynPS2_Synaptics_TouchPad/Properties/Synaptics_Two-Finger_Scrolling -t int -s 1 -t int -s 1
xfconf-query -n -c xfwm4 -p /general/click_to_focus -t bool -s true
#--- Hide icons
xfconf-query -n -c xfce4-desktop -p /desktop-icons/file-icons/show-filesystem -t bool -s false
xfconf-query -n -c xfce4-desktop -p /desktop-icons/file-icons/show-home -t bool -s false
xfconf-query -n -c xfce4-desktop -p /desktop-icons/file-icons/show-trash -t bool -s false
xfconf-query -n -c xfce4-desktop -p /desktop-icons/file-icons/show-removable -t bool -s false
#--- Start and exit values
xfconf-query -n -c xfce4-session -p /splash/Engine -t string -s ""
xfconf-query -n -c xfce4-session -p /shutdown/LockScreen -t bool -s true
xfconf-query -n -c xfce4-session -p /general/SaveOnExit -t bool -s false
#--- Power options
#xfconf-query -n -c xfce4-power-manager -p /xfce4-power-manager/lid-action-on-ac -t int -s 1
#xfconf-query -n -c xfce4-power-manager -p /xfce4-power-manager/lid-action-on-battery -t int -s 1
#--- App Finder
xfconf-query -n -c xfce4-appfinder -p /last/pane-position -t int -s 248
xfconf-query -n -c xfce4-appfinder -p /last/window-height -t int -s 742
xfconf-query -n -c xfce4-appfinder -p /last/window-width -t int -s 648
#--- Remove Mail Reader from menu
file=/usr/share/applications/exo-mail-reader.desktop #; [ -e "${file}" ] && cp -n $file{,.bkup}
sed -i 's/^NotShowIn=*/NotShowIn=XFCE;/; s/^OnlyShowIn=XFCE;/OnlyShowIn=/' "${file}"
grep -q "NotShowIn=XFCE" "${file}" || echo "NotShowIn=XFCE;" >> "${file}"
#--- Enable compositing
xfconf-query -n -c xfwm4 -p /general/use_compositing -t bool -s true
xfconf-query -n -c xfwm4 -p /general/frame_opacity -t int -s 85
##### Configure XFCE4
echo -e "\n ${GREEN}[+]${RESET} Configuring ${GREEN}XFCE4${RESET}${RESET} ~ desktop environment"
#--- Disable user folders
apt-get -y -qq install xdg-user-dirs || echo -e ' '${RED}'[!] Issue with apt-get'${RESET} 1>&2
xdg-user-dirs-update
file=/etc/xdg/user-dirs.conf; [ -e "${file}" ] && cp -n $file{,.bkup}
sed -i 's/^enable=.*/enable=False/' "${file}" #sed -i 's/^XDG_/#XDG_/; s/^#XDG_DESKTOP/XDG_DESKTOP/;' ~/.config/user-dirs.dirs
find ~/ -maxdepth 1 -mindepth 1 \( -name 'Documents' -o -name 'Music' -o -name 'Pictures' -o -name 'Public' -o -name 'Templates' -o -name 'Videos' \) -type d -empty -delete
xdg-user-dirs-update
#--- XFCE fixes for default applications
mkdir -p ~/.local/share/applications/
file=~/.local/share/applications/mimeapps.list; [ -e "${file}" ] && cp -n $file{,.bkup}
[ ! -e "${file}" ] && echo '[Added Associations]' > "${file}"
([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
for VALUE in file trash; do
sed -i 's#x-scheme-handler/'${VALUE}'=.*#x-scheme-handler/'${VALUE}'=exo-file-manager.desktop#' "${file}"
grep -q '^x-scheme-handler/'${VALUE}'=' "${file}" 2>/dev/null || echo 'x-scheme-handler/'${VALUE}'=exo-file-manager.desktop' >> "${file}"
done
for VALUE in http https; do
sed -i 's#^x-scheme-handler/'${VALUE}'=.*#x-scheme-handler/'${VALUE}'=exo-web-browser.desktop#' "${file}"
grep -q '^x-scheme-handler/'${VALUE}'=' "${file}" 2>/dev/null || echo 'x-scheme-handler/'${VALUE}'=exo-web-browser.desktop' >> "${file}"
done
[[ $(tail -n 1 "${file}") != "" ]] && echo >> "${file}"
file=~/.config/xfce4/helpers.rc; [ -e "${file}" ] && cp -n $file{,.bkup} #exo-preferred-applications #xdg-mime default
sed -i 's#^FileManager=.*#FileManager=Thunar#' "${file}" 2>/dev/null
grep -q '^FileManager=Thunar' "${file}" 2>/dev/null || echo 'FileManager=Thunar' >> "${file}"
#--- Configure file browser - Thunar (need to re-login for effect)
mkdir -p ~/.config/Thunar/
file=~/.config/Thunar/thunarrc; [ -e "${file}" ] && cp -n $file{,.bkup}
([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
sed -i 's/LastShowHidden=.*/LastShowHidden=TRUE/' "${file}" 2>/dev/null || echo -e "[Configuration]\nLastShowHidden=TRUE" > ~/.config/Thunar/thunarrc;
#--- XFCE fixes for GNOME Terminator (We do this later)
#mkdir -p ~/.local/share/xfce4/helpers/
#file=~/.local/share/xfce4/helpers/custom-TerminalEmulator.desktop; [ -e "${file}" ] && cp -n $file{,.bkup}
#sed -i 's#^X-XFCE-CommandsWithParameter=.*#X-XFCE-CommandsWithParameter=/usr/bin/terminator --command="%s"#' "${file}" 2>/dev/null || cat <<EOF > "${file}"
#[Desktop Entry]
#NoDisplay=true
#Version=1.0
#Encoding=UTF-8
#Type=X-XFCE-Helper
#X-XFCE-Category=TerminalEmulator
#X-XFCE-CommandsWithParameter=/usr/bin/terminator --command="%s"
#Icon=terminator
#Name=terminator
#X-XFCE-Commands=/usr/bin/terminator
#EOF
#file=~/.config/xfce4/helpers.rc; [ -e "${file}" ] && cp -n $file{,.bkup} #exo-preferred-applications #xdg-mime default
#sed -i 's#^TerminalEmulator=.*#TerminalEmulator=custom-TerminalEmulator#' "${file}"
#grep -q '^TerminalEmulator=custom-TerminalEmulator' "${file}" 2>/dev/null || echo 'TerminalEmulator=custom-TerminalEmulator' >> "${file}"
#--- XFCE fixes for Iceweasel (We do this later)
#file=~/.config/xfce4/helpers.rc; [ -e "${file}" ] && cp -n $file{,.bkup} #exo-preferred-applications #xdg-mime default
#sed -i 's#^WebBrowser=.*#WebBrowser=iceweasel#' "${file}"
#grep -q '^WebBrowser=iceweasel' "${file}" 2>/dev/null || echo 'WebBrowser=iceweasel' >> "${file}"
#--- Fix GNOME keyring issue
file=/etc/xdg/autostart/gnome-keyring-pkcs11.desktop; #[ -e "${file}" ] && cp -n $file{,.bkup}
grep -q "XFCE" "${file}" || sed -i 's/^OnlyShowIn=*/OnlyShowIn=XFCE;/' "${file}"
#--- Disable tracker (issue is, enables it in GNOME)
tracker-control -r
mkdir -p ~/.config/autostart/
rm -f ~/.config/autostart/tracker-*.desktop
rm -f /etc/xdg/autostart/tracker-*.desktop
#--- Set XFCE as default desktop manager
file=~/.xsession; [ -e "${file}" ] && cp -n $file{,.bkup} #~/.xsession
echo xfce4-session > "${file}"
#--- Enable num lock at start up (might not be smart if you're using a smaller keyboard (laptop?)) ~ https://wiki.xfce.org/faq
#xfconf-query -n -c keyboards -p /Default/Numlock -t bool -s true
apt-get -y -qq install numlockx || echo -e ' '${RED}'[!] Issue with apt-get'${RESET} 1>&2
file=/etc/xdg/xfce4/xinitrc; [ -e "${file}" ] && cp -n $file{,.bkup} #/etc/rc.local
([[ -e "${file}" && "$(tail -c 1 ${file})" != "" ]]) && echo >> "${file}"
grep -q '^/usr/bin/numlockx' "${file}" 2>/dev/null || echo "/usr/bin/numlockx on" >> "${file}"
#--- Add keyboard shortcut (CTRL+SPACE) to open Application Finder
file=~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml #; [ -e "${file}" ] && cp -n $file{,.bkup}
grep -q '<property name="<Primary>space" type="string" value="xfce4-appfinder"/>' "${file}" || sed -i 's#<property name="\<Alt\>F2" type="string" value="xfrun4"/>#<property name="\<Alt\>F2" type="string" value="xfrun4"/>\n <property name="\<Primary\>space" type="string" value="xfce4-appfinder"/>#' "${file}"
#--- Add keyboard shortcut (CTRL+ALT+t) to start a terminal window
file=~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml #; [ -e "${file}" ] && cp -n $file{,.bkup}
grep -q '<property name="<Primary><Alt>t" type="string" value="/usr/bin/exo-open --launch TerminalEmulator"/>' "${file}" || sed -i 's#<property name="\<Alt\>F2" type="string" value="xfrun4"/>#<property name="\<Alt\>F2" type="string" value="xfrun4"/>\n <property name="\<Primary\>\<Alt\>t" type="string" value="/usr/bin/exo-open --launch TerminalEmulator"/>#' "${file}"
#--- Create Conky refresh script (conky gets installed later)
file=/usr/local/bin/conky-refresh; [ -e "${file}" ] && cp -n $file{,.bkup}
cat <<EOF > "${file}" || echo -e ' '${RED}'[!] Issue with writing file'${RESET} 1>&2
#!/bin/bash
/usr/bin/timeout 5 /usr/bin/killall -9 -q -w conky
/usr/bin/conky &
EOF
chmod -f 0500 "${file}"
#--- Add keyboard shortcut (CTRL+r) to run the conky refresh script
file=~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-keyboard-shortcuts.xml #; [ -e "${file}" ] && cp -n $file{,.bkup}
grep -q '<property name="<Primary>r" type="string" value="/usr/local/bin/conky-refresh"/>' "${file}" || sed -i 's#<property name="\<Alt\>F2" type="string" value="xfrun4"/>#<property name="\<Alt\>F2" type="string" value="xfrun4"/>\n <property name="\<Primary\>r" type="string" value="/usr/local/bin/conky-refresh"/>#' "${file}"
#--- Remove any old sessions
rm -f ~/.cache/sessions/*
#--- Reload XFCE
#/usr/bin/xfdesktop --reload
##### Cosmetics (themes & wallpapers)
echo -e "\n ${GREEN}[+]${RESET} ${GREEN}Cosmetics${RESET}${RESET} ~ Making it different each startup"
mkdir -p ~/.themes/
export DISPLAY=:0.0 #[[ -z $SSH_CONNECTION ]] || export DISPLAY=:0.0
#--- shiki-colors-light v1.3 XFCE4 theme